Skip to content
Snippets Groups Projects
Commit 24fadd7c authored by André Anjos's avatar André Anjos :speech_balloon:
Browse files

[scripts.jobs] Fix tag finding on CI

parent 5e9108c1
No related branches found
No related tags found
1 merge request!267[scripts.jobs] Fix tag finding on CI
Pipeline #55726 canceled
...@@ -13,18 +13,23 @@ logger = get_logger(__name__) ...@@ -13,18 +13,23 @@ logger = get_logger(__name__)
epilog=""" epilog="""
Examples: Examples:
1. List running jobs on any of our runners 1. List running jobs on any runners with tag "bob" (default)
$ bdt gitlab jobs -vv $ bdt gitlab jobs -vv
2. List running jobs on a runner defined by its description: 2. List running jobs on a runner with tag "macos":
$ bdt gitlab jobs -vv macmini $ bdt gitlab jobs -vv macos
2. List running jobs on a runner with tag "macos" and "foo":
$ bdt gitlab jobs -vv macos foo
""" """
) )
@click.argument("name", nargs=-1) @click.argument("tags", nargs=-1)
@click.option( @click.option(
"-s", "-s",
"--status", "--status",
...@@ -36,31 +41,19 @@ Examples: ...@@ -36,31 +41,19 @@ Examples:
) )
@verbosity_option() @verbosity_option()
@bdt.raise_on_error @bdt.raise_on_error
def jobs(name, status): def jobs(status, tags):
"""Lists jobs on a given runner identified by description.""" """Lists jobs on a given runner identified by description."""
gl = get_gitlab_instance() gl = get_gitlab_instance()
gl.auth() gl.auth()
names = name or [ tags = tags or ["bob"]
"linux-shell",
"linux-docker",
"macpro",
"macmini",
"macm1",
]
# search for the runner(s) to affect # search for the runner(s) to affect
runners = [ runners = gl.runners.list(tag_list=tags)
k
for k in gl.runners.list(all=True)
if k.attributes["description"] in names
]
if not runners: if not runners:
raise RuntimeError( raise RuntimeError("Cannot find runner with tags = %s" % "|".join(tags))
"Cannot find runner with description = %s" % "|".join(names)
)
for runner in runners: for runner in runners:
jobs = runner.jobs.list(all=True, status=status) jobs = runner.jobs.list(all=True, status=status)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment