API to get allowed agents by CI_JOB_TOKEN

New api endpoint: /api/v4/job/allowed_agents

returns:

{
  "allowed_agents": [
    {
        "id": 5,  // agent id
        "config_project": {
          "id": 3,
        }
    },
    {
        "id": 3,
        "config_project": {
          "id": 3,
        }
    },
  ],
  "job": {
    "id": 9 // job id
  },
  "project": {
    "id": 123213 // project id
  },
  "pipeline": {
    "id": 2323 // pipeline id
  },
  "user": {
    "id": 1,
    "username": "root"
  }
}

Specifications from the epic:

  • allowed_agents will only include agents for the JOB_TOKEN project. Adding external agents requires additional permissions, which will be handled in follow-up issues.
  • Endpoint auth: The user running the CI job should have Developer rights on the project configuring the agent used.
  • This feature can be disabled -- I think this will be handled in the agentk config file so the API does not need to worry about this setting.
Edited Apr 01, 2021 by Mikhail Mazurskiy
Assignee Loading
Time tracking Loading