Runners

Runners are external process used to run CI jobs. They are deployed by the administrator and registered to the GitLab instance.

Shared runners are available for all projects. Specific runners are enabled for a list of projects.

Global runners (admin)

Examples

Use the list() and all() methods to list runners.

Both methods accept a scope parameter to filter the list. Allowed values for this parameter are:

  • active
  • paused
  • online
  • specific (all() only)
  • shared (all() only)

Note

The returned objects hold minimal information about the runners. Use the get() method to retrieve detail about a runner.

# List owned runners
runners = gl.runners.list()
# With a filter
runners = gl.runners.list(scope='active')
# List all runners, using a filter
runners = gl.runners.all(scope='paused')

Get a runner’s detail:

runner = gl.runners.get(runner_id)

Update a runner:

runner = gl.runners.get(runner_id)
runner.tag_list.append('new_tag')
runner.save()

Remove a runner:

gl.runners.delete(runner_id)
# or
runner.delete()

Project runners

Examples

List the runners for a project:

runners = gl.project_runners.list(project_id=1)
# or
runners = project.runners.list()

Enable a specific runner for a project:

p_runner = gl.project_runners.create({'runner_id': runner.id}, project_id=1)
# or
p_runner = project.runners.create({'runner_id': runner.id})

Disable a specific runner for a project:

gl.project_runners.delete(runner.id)
# or
project.runners.delete(runner.id)