Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.devtools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.devtools
Merge requests
!26
New functionality for enabling/disabling and inspecting runners
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
New functionality for enabling/disabling and inspecting runners
runners-cmd
into
master
Overview
0
Commits
2
Pipelines
1
Changes
5
Merged
André Anjos
requested to merge
runners-cmd
into
master
6 years ago
Overview
0
Commits
2
Pipelines
1
Changes
5
Expand
This MR introduces the following features:
Consolidate all gitlab-related commands under the command "gitlab"
Add a new command "gitlab runners" to manage runners in projects (enable/disable)
Add a new command "gitlab jobs" to list jobs in shared runners
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
f997dde8
2 commits,
6 years ago
5 files
+
182
−
0
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
5
Search (e.g. *.vue) (Ctrl+P)
bob/devtools/scripts/jobs.py
0 → 100644
+
53
−
0
Options
#!/usr/bin/env python
import
os
import
click
from
.
import
bdt
from
..release
import
get_gitlab_instance
from
..log
import
verbosity_option
,
get_logger
,
echo_normal
logger
=
get_logger
(
__name__
)
@click.command
(
epilog
=
'''
Examples:
1. List running jobs on a runner defined by its description (macmini):
$ bdt gitlab jobs -vv macmini
'''
)
@click.argument
(
'
name
'
)
@click.option
(
'
-s
'
,
'
--status
'
,
type
=
click
.
Choice
([
'
running
'
,
'
success
'
,
'
failed
'
,
'
canceled
'
]),
default
=
'
running
'
,
show_default
=
True
,
help
=
'
The status of jobs we are searching for - one of
"
running
"
,
'
\
'"
success
"
,
"
failed
"
or
"
canceled
"'
)
@verbosity_option
()
@bdt.raise_on_error
def
jobs
(
name
,
status
):
"""
Lists jobs on a given runner
"""
gl
=
get_gitlab_instance
()
gl
.
auth
()
user_id
=
gl
.
user
.
attributes
[
'
id
'
]
# search for the runner to affect
the_runner
=
[
k
for
k
in
gl
.
runners
.
list
(
all
=
True
)
if
\
k
.
attributes
[
'
description
'
]
==
name
]
if
not
the_runner
:
raise
RuntimeError
(
'
Cannot find runner with description = %s
'
,
name
)
the_runner
=
the_runner
[
0
]
logger
.
info
(
'
Found runner %s (id=%d)
'
,
the_runner
.
attributes
[
'
description
'
],
the_runner
.
attributes
[
'
id
'
])
jobs
=
the_runner
.
jobs
.
list
(
all
=
True
,
status
=
status
)
logger
.
info
(
'
There are %d jobs running on %s
'
,
len
(
jobs
),
name
)
for
k
in
jobs
:
echo_normal
(
'
** job %d: %s (%s), since %s, by %s [%s]
'
%
\
(
k
.
id
,
k
.
attributes
[
'
project
'
][
'
path_with_namespace
'
],
k
.
attributes
[
'
name
'
],
k
.
attributes
[
'
started_at
'
],
k
.
attributes
[
'
user
'
][
'
username
'
],
k
.
attributes
[
'
web_url
'
]))
Loading