10

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?

1
  • I haven't found any good documentation on their build badge URLs. If anyone has a link please post.
    – aglassman
    Sep 3, 2015 at 19:54

5 Answers 5

13

Now you can get the badge from this url:

https://gitlab.com/[namespace]/[project]/badges/[branch]/pipeline.svg
9

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
2
  • Their documentation is pretty bad on this. Joran's URL above does work.
    – aglassman
    Sep 3, 2015 at 19:53
  • @aglassman good point. I have included Joran's comment in the answer for more visibility.
    – VonC
    Sep 3, 2015 at 19:55
5

I have found such link http://some.domain/projects/:ID/builds/:SHA/status . Problem resolved

1
4

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:

  1. go to Settings > CI / CD
  2. expand the General pipelines settings section
  3. scroll down to Pipeline status and/or Coverage report
  4. select your branch
  5. copy whatever you need (Markdown, perhaps)

For reference, see:

1

API

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 ways lab is to hub, what glab is to gh.

lab aims to feel familiar to a git user and leverages git to power many of it's commands. glab will feel more familiar to gh 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]

Examples

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\]

Examples

$ glab pipeline status --live
$ glab pipeline status --branch=master   // Get pipeline for master branch
$ glab pipe status   // Get pipeline for current branch

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.