I want to add in cap deploy scenario checking build status from GitLab CI
.
Is it possible?
Does GitLab CI
has some API to get build/pipeline status by commit SHA
?
You can find the build badge information on the Pipelines settings page, that is
https://<your-gitlab-installation-domain>/<group-name>/<repository-name>/settings/ci_cd
For a specific repository:
For reference, see:
Now you can get the badge from this url:
https://gitlab.com/[namespace]/[project]/badges/[branch]/pipeline.svg
Since GitLab 8.1, there is the new commit status API.
GitLab CI Commits API v4:
List the statuses of a commit
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/projects/17/repository/commits/18f3e63d05582537db6d183d9d557be09e1f90c8/statuses
P.s. GitLabs tokens are being managed in the Personal Access Tokens page (https://gitlab.example.com/profile/personal_access_tokens
)
glab
and lab
There are two great tools to work with GitLab
:
Both glab and
lab
are open-source tools with the same goal of bringing GitLab to your command line and simplifying the developer workflow. In many wayslab
is to hub, what glab is to gh.
lab
aims to feel familiar to agit
user and leveragesgit
to power many of it's commands.glab
will feel more familiar togh
users and in turn is more interactive and likely more beginner friendly for that reason.
lab ci status
For textual representation of a CI pipeline with lab
you may want:
lab ci status [branch] [flags]
lab ci status
lab ci status upstream 608 --merge-request
lab ci status 600 --wait
lab ci status upstream 125 --merge-request --bridge 'security-tests'
glab pipeline status
For textual representation of a CI pipeline with glab
you may want:
glab pipeline status \[flags\]
$ glab pipeline status --live
$ glab pipeline status --branch=master // Get pipeline for master branch
$ glab pipe status // Get pipeline for current branch
GitLab CI is based on Travis, which provide build status url and even build status picture:
https://travis-ci.org/[YOUR_GITHUB_USERNAME]/[YOUR_PROJECT_NAME].png
# or, limited to some branches
https://travis-ci.org/[YOUR_GITHUB_USERNAME]/[YOUR_PROJECT_NAME].png?branch=master,staging,production
Joran Beasley mentions the url:
http://gitlabci.example.com/projects/2/status.png?ref=master
I have found such link http://some.domain/projects/:ID/builds/:SHA/status . Problem resolved
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With