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-statusinto your~/bindirectory - 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
This does not work with groups still if you have a stand-alone instance (not gitlab.com), to fix this change the following variables
This should fix any issues, the domain was being kept in the project path, because of this GitLab will return a
404error.References: