Repository of useful scripts for GitLab.
script | alias | description |
---|---|---|
gl-ci-lint |
glcl |
Validate .gitlab-ci.yml |
gl-config |
|
Overwrite ~/.gl-config with default config values |
gl-issue-check |
glic |
Get issue URL link in Markdown format with checkbox |
gl-issue-jrnl |
glij |
Get Issue group and project ID with title for jrnl |
gl-issue-link |
glik |
Get the issue title with the URL link in Markdown format |
gl-issue-list |
glil |
Get the issue title with URL link in Markdown as a list item |
gl-issue-new |
gliw |
Create issue with defaults defined in ~/.gl-config |
gl-issue-note |
glin |
Insert note in Issue converting hh:mm time format into /spend time |
gl-issue-spend |
glis |
Insert /spend time in Issue converting from hh:mm time format |
gl-issue-title |
glit |
Get title of Issue |
gl-issue-url |
gliu |
Get URL of Issue |
gl-mr-check |
glmc |
Get MR URL link in Markdown format with checkbox |
gl-mr-jrnl |
glmj |
Get MR group and project ID with title for jrnl |
gl-mr-link |
glmk |
Get the MR title with the URL link in Markdown format |
gl-mr-new |
glmw |
Create MR with default values defined in ~/.gl-config |
gl-mr-note |
glmn |
Insert note in MR converting hh:mm time format into /spend time |
gl-mr-spend |
glms |
Insert /spend time in MR converting from hh:mm time format |
gl-mr-title |
glmt |
Get title of MR |
gl-mr-url |
glmu |
Get URL of MR |
gl-notifications-get |
glnu |
Get User notification level defined in GitLab |
gl-prj-config |
|
Apply project settings defined in ~/.gl-config |
gl-prj-list |
glpl |
List all projects in GitLab for current user |
gl-prj-upload |
|
Upload file in project and return URL link in Markdown |
gl-src-check |
glsk |
Check syntax using shellcheck and group errors by code |
gl-src-common |
|
Common variables and functions |
gl-src-help |
glsh |
Generate Markdown Help |
gl-src-table |
glst |
Generate Markdown Table Overview |
Clone the repository, for example in /opt
directory:
cd /opt
git clone https://gitlab.com/gcoop-libre/gitlab-bash-utils
Add to $HOME/.bashrc
:
# command and aliases of gitlab bash utils
if [[ -d "/opt/gitlab-bash-utils" ]]
then
PATH="/opt/gitlab-bash-utils:$PATH"
source /opt/gitlab-bash-utils/gl-src-alias
fi
The main dependency is glab
, install from:
https://github.com/profclems/glab
Other utils tools:
apt-get install coreutils curl jq gawk moreutils
Ensure configure glab
in ~/.config/glab-cli/config.yml
, for example:
git_protocol: https
editor:
browser:
glamour_style: dark
check_update: false
hosts:
gitlab.com:
token: z4r4z4acddfafafa
api_host: gitlab.com
git_protocol: https
api_protocol: https
user: osiux
git.example.com:
api_host: git.example.com
token: z4r4z4acddfafafa
git_protocol: https
api_protocol: https
skip_tls_verify: "false"
user: osiris
Remember replace hostnames, usernames and tokens.
You can define custom aliases in ~/.config/glab-cli/aliases.yml
, for
example:
ci: pipeline ci
co: mr checkout
ic: issue close
il: issue list
in: issue note
iu: issue update
iv: issue view
iw: issue new
ma: mr approve
mc: mr close
ml: mr list
mv: mr view
my: mr ready
Ensure configure gl
in ~/.gl-config
, for example:
GL_ACCESS_ADMIN: 60
GL_ACCESS_DEVELOPER: 30
GL_ACCESS_GUEST: 10
GL_ACCESS_MAINTAINER: 40
GL_ACCESS_MINIMAL: 5
GL_ACCESS_NONE: 0
GL_ACCESS_OWNER: 50
GL_ACCESS_REPORTER: 20
GL_BRANCH: master
GL_GITLAB_COM_DEFAULT_ASSIGNEE: osiux
GL_GITLAB_COM_PROXY_HTTP_ENABLED: 0
GL_GIT_EXAMPLE_COM_DEFAULT_ASSIGNEE: osiris
GL_GIT_EXAMPLE_COM_PROXY_HTTP_ENABLED: 1
GL_GIT_EXAMPLE_COM_PROXY_HTTP_HOST: 127.0.0.1
GL_GIT_EXAMPLE_COM_PROXY_HTTP_PORT: 3128
GL_INFO: 0
GL_MERGE_LEVEL: 40
GL_PROJECT_ALLOW_MERGE_ON_SKIPPED_PIPELINE: false
GL_PROJECT_MERGE_REQUESTS_ENABLED: true
GL_PROJECT_ONLY_ALLOW_MERGE_IF_ALL_DISCUSSIONS_ARE_RESOLVED: true
GL_PROJECT_ONLY_ALLOW_MERGE_IF_PIPELINE_SUCCEEDS: true
GL_PROXY_SOCKS_ENABLED: 1
GL_PROXY_SOCKS_HOST: 127.0.0.1
GL_PROXY_SOCKS_PORT: 90903
GL_PUSH_LEVEL: 40
GL_UNPROTECT_LEVEL: 40
If you use a bastion host to access to remote GitLab in private network, you can define a LocalForward, for example:
Host bastion
Hostname 192.168.0.1
LocalForward 3128 10.0.0.1:3128
DynamicForward :9090
Execute ssh -fqNC bastion
and you can acces to git.example.com
trought Proxy
Test your proxy
curl -I http://127.0.0.1:3128
The access to GitLab API need HTTP remote origin in ~/.git/config
Replace SSH URL:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = git@gitlab.com:/osiux/gitlab-bash-utils
with HTTPS URL:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = https://gitlab.com/osiux/gitlab-bash-utils
GNU General Public License, GPLv3.
This repo was created in 2022 by Osiris Alejandro Gomez, worker cooperative of gcoop Cooperativa de Software Libre.