A super simple bash script to check the status of a GitLab CI pipeline.
$ git push
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"pending"
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"running"
...
$ git pipeline-status
Status of last pipeline for user/project on gitlab/master:
"success"
Aside from git
and curl
, you will need jq
(see https://stedolan.github.io/jq/, or just brew install jq
).
Your GitLab private access token needs to be set in an environment variable called GITLAB_API_PRIVATE_TOKEN
.
Your GitLab remote needs to be named either gitlab
or origin
. If it's not, you can override those via the GITLAB_REMOTE
environment variable.
~/bin
needs to be in your $PATH
- Copy the attached
git-pipeline-status
into your~/bin
directory - Make it executable:
chmod +x ~/bin/git-pipeline-status
git pipeline-status
"How does putting a random script in my ~/bin
make this work?" See git source and this coderwall blog post
For GitLab grouped projects (eg.
foo/bar/my-project
) it's giving a 404 error.I fixed it by adding a global flag to the regex in this line: