Commit daa2cc0e authored by André Anjos's avatar André Anjos 💬
Browse files

Merge branch 'find-runners' into 'master'

[scripts.jobs] Fix tag finding on CI

See merge request !267
parents 5e9108c1 2fbe9da3
Pipeline #55732 passed with stages
in 12 minutes and 33 seconds
......@@ -13,18 +13,23 @@ logger = get_logger(__name__)
epilog="""
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
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(
"-s",
"--status",
......@@ -36,31 +41,19 @@ Examples:
)
@verbosity_option()
@bdt.raise_on_error
def jobs(name, status):
def jobs(status, tags):
"""Lists jobs on a given runner identified by description."""
gl = get_gitlab_instance()
gl.auth()
names = name or [
"linux-shell",
"linux-docker",
"macpro",
"macmini",
"macm1",
]
tags = tags or ["bob"]
# search for the runner(s) to affect
runners = [
k
for k in gl.runners.list(all=True)
if k.attributes["description"] in names
]
runners = gl.runners.list(tag_list=tags)
if not runners:
raise RuntimeError(
"Cannot find runner with description = %s" % "|".join(names)
)
raise RuntimeError("Cannot find runner with tags = %s" % "|".join(tags))
for runner in runners:
jobs = runner.jobs.list(all=True, status=status)
......
......@@ -43,7 +43,7 @@ requirements:
- gitpython
- python-gitlab
- requests
- sphinx!=4.0.1
- sphinx >=4.0.2
- pyyaml >=5.1
- twine <3
- lxml
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment