Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gitlab-deps
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
Service Desk
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
pipelines
tools
gitlab-deps
Commits
cadc1cf7
Commit
cadc1cf7
authored
4 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
Better help messages
parent
d8a0b045
Branches
Branches containing commit
No related tags found
1 merge request
!1
Modular
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gitlab_docker_autodep/main.py
+39
-7
39 additions, 7 deletions
gitlab_docker_autodep/main.py
with
39 additions
and
7 deletions
gitlab_docker_autodep/main.py
+
39
−
7
View file @
cadc1cf7
...
@@ -12,6 +12,10 @@ from .rebuild import rebuild_deps
...
@@ -12,6 +12,10 @@ from .rebuild import rebuild_deps
from
.server
import
run_app
from
.server
import
run_app
def
_fmtdesc
(
s
):
return
s
.
strip
()
def
main
():
def
main
():
parser
=
argparse
.
ArgumentParser
(
parser
=
argparse
.
ArgumentParser
(
description
=
'
Rebuild Docker images on a Gitlab instance.
'
)
description
=
'
Rebuild Docker images on a Gitlab instance.
'
)
...
@@ -47,8 +51,22 @@ def main():
...
@@ -47,8 +51,22 @@ def main():
'
list-projects
'
,
'
list-projects
'
,
parents
=
[
common_parser
],
parents
=
[
common_parser
],
help
=
'
list projects
'
,
help
=
'
list projects
'
,
description
=
'
List all projects and their branches on the Gitlab
'
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
,
'
instance.
'
)
description
=
_fmtdesc
(
'''
List all projects and their branches on the Gitlab instance.
The output is a list of project paths with all their branches, separated
by a colon, one per line. Since the Gitlab
'
search
'
API is quite
coarse, you can then filter the output for specific projects or branches
using
'
grep
'
, e.g.:
gitlab-deps list-projects | grep ^path/to/my/group/
or
gitlab-deps list-projects | grep
'
:master$
'
'''
))
list_projects_parser
.
add_argument
(
list_projects_parser
.
add_argument
(
'
--search
'
,
'
--search
'
,
help
=
'
Search query used to filter project list on the server side
'
)
help
=
'
Search query used to filter project list on the server side
'
)
...
@@ -58,11 +76,25 @@ def main():
...
@@ -58,11 +76,25 @@ def main():
'
deps
'
,
'
deps
'
,
parents
=
[
common_parser
],
parents
=
[
common_parser
],
help
=
'
build dependency map
'
,
help
=
'
build dependency map
'
,
description
=
'
Generate a map of dependencies between projects on a
'
formatter_class
=
argparse
.
RawDescriptionHelpFormatter
,
'
Gitlab instance.
'
)
description
=
_fmtdesc
(
'''
deps_parser
.
add_argument
(
Generate a map of dependencies between projects on a
'
--docker
'
,
action
=
'
store_true
'
,
Gitlab instance.
help
=
'
Output dependencies between Docker images, not Gitlab projects
'
)
The input (on standard input) must consist of a list of projects along
with their branches, separated by a colon, one per line. If the branch
is unspecified,
'
master
'
is assumed.
The output consists of pairs of project / dependency (so, these are
'
forward
'
dependencies), for all projects/branches specified in the
input.
To obtain a list of reverse dependencies, one can simply swap the
columns in the output, e.g.:
gitlab-deps deps < project.list | awk
'
{print $2, $1}
'
'''
))
# Setup pipeline hooks on the specified projects.
# Setup pipeline hooks on the specified projects.
set_hooks_parser
=
subparsers
.
add_parser
(
set_hooks_parser
=
subparsers
.
add_parser
(
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment