Gitlab CLI clients¶
glab¶
Official gitlab cli client
see glab.md
python-gitlab¶
- 1.7k ⭐
-
Ubuntu package lacks behind as expected!
ln -s /usr/bin/python-gitlab ~/bin/gitlab
or:
CLI usage¶
https://python-gitlab.readthedocs.io/en/stable/cli-objects.html
Config: ~/.python-gitlab.cfg
Show current user:
Show project:
Download latest artifacts:
gitlab -g open.greenhost.net project artifacts --id 6 --ref-name 555_prom_alerts --job setup-openappstack
List all master pipeline ids:
Snipetts:
gitlab snippet list
e="$(cat bin/nextcloud_deck_export.py)"
gitlab snippet create --title nextcloud_deck_export.py --file-name nextcloud_deck_export.py \
--visibility public --content "$e"
lab¶
config at: /home/varac/.config/lab.hcl
Usage¶
Show all merged MRs: lab mr list -s merged -a Pretty-print MR list:
lab mr list -s merged -a | awk '{first = $1; $1=""; print "*" $0, "(" first ")"}'
narkoz/gitlab¶
Usage:
gitlab projects '{per_page: 70}' | grep platf
gitlab merge_requests 128162 --json
gitlab merge_request 128162 230544 --json
gitlab create_merge_request 128195 \
"Don't remove nfs client tools on vagrant" \
"{source_branch: 'dont_remove_nfs_client_on_vagrant', \
target_branch: 'develop', target_project_id: 128162}"
Other clients¶
Unmaintained cli clients (as of 2021-03)¶
- https://gitlab.com/shank-utils/gitlab-cli (last commit 2016-03)
- https://github.com/lighttiger2505/lab Last commit 2019-04
Recursively clone all projects in group¶
Gitlabber¶
- GitHub
- Arch package
python-gitlabberis out of date !
Install¶
Config¶
- Create a Gitlab PAT with
read_apiandread_repositoryaccess. - Some config options are available via env vars, see Usage
- Sync speed can be improved much with
--concurrencyand-api-concurrencyparameters, i.e. :gitlabber --api-concurrency 15 --concurrency 10 .Speed improvement for many repos: ~30 mins with defaults, 3 mins with increased concurrency shown above
Print Gitlab group/project tree:
Clone all projects:
Issues¶
- Default pull behaviour fails for checked-out local-only branches that are not present at the remote
- Gitlabber's default is to pull using
git pull -v -- origin, which will fail if a local branch is checked out which is not present at the remote server, either because it is deleted after merging a MR, or if it is not yet pushed. Fix: Use--use-fetchinstead:
- Gitlabber's default is to pull using
gitlab-clone¶
- GitHub Couldn't get it working
glabenv¶
CLI to export and synchronize Gitlab environment variables
- GitHub
- Not available as Arch/AUR package