Search code examples
python-gitlab

How do I list the tags for a runner using python-gitlab


I know how to get to (some) attributes of runners setup for a gitlab project. I need though to list the tags each runner defines?

Below is as far as I have gone.

gl = gitlab.Gitlab(url=<my-gitlab-url>, private_token=<my-gitlab-api-token>)

project = gl.projects.get(<my-project-id>)

for runner in project.runners.list(get_all=True):
    # How do I list the tags for the runner?

Thanks!


Solution

  • OK, got it: Adding runner = gl.runners.get(runner.id) fills in many more attributes of the runner.

    gl = gitlab.Gitlab(url=<my-gitlab-url>, private_token=<my-gitlab-api-token>)
    
    project = gl.projects.get(<my-project-id>)
    
    for runner in project.runners.list(get_all=True):
        runner = gl.runners.get(runner.id)
        print(runner.tag_list)