Does GitLabCI provide build status badges?

Created on 21 February 2023, almost 2 years ago
Updated 5 August 2024, 5 months ago

Problem/Motivation

One of the great features of both Travis CI and DrupalCI are that they provide test summary 'badges' or 'pills' or 'embeds' (whatever you want to call them) that can allow you to follow the status of a test pipeline from an external site. We currently use these on D.O project pages on issues.

  • Does GitLab have this functionality?
  • If so, can we integrate it into Drupal.org project pages?
  • GitLab's API can provide this data, so we may be able to build our own badges

Proposed resolution

  • Research if this is possible 'out of the box'
  • Implement the out of the box solution, if it exists, or else look at creating it with the API
πŸ’¬ Support request
Status

Fixed

Component

gitlab-ci

Created by

πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @hestenet
  • πŸ‡ΊπŸ‡ΈUnited States hestenet Portland, OR πŸ‡ΊπŸ‡Έ
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    I am sure yesterday I saw in my GitLab repo a place where the 'badges' were displayed, along with the code snippet for embedding. But now when I look through again I can't find it! It is there, somewhere.

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    Here is the documenttaion on GitLab bagdes https://docs.gitlab.com/ee/user/project/badges.html

    The general form of the pipeline badge url is https://gitlab.example.com/<namespace>/<project>/badges/<branch>/pipeline.svg so the gitlab_templates pipeline badge is https://git.drupalcode.org/project/gitlab_templates/badges/1.0.x/pipeline.svg and can be seen here

    This image cannot be displayed within these comments, as it is not hosted on drupal.org. Maybe we can request that images on git.drupalcode.org allowed to be inserted here?

  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    Found it now: In your GitLab project -> Settings -> CI/CD -> General Pipelines -> Expand

  • Status changed to Closed: outdated about 1 year ago
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    The magic URL works and also note that the pipeline status is now displayed in both project pages (for the main branches) and the issue pages (for the MRs).

    I think this issue is no longer needed, but feel free to re-open if you think we should do something.

  • Status changed to Fixed 5 months ago
  • πŸ‡¬πŸ‡§United Kingdom jonathan1055

    There is nothing to do in the gitlab_templates code, but the original question was about displaying the badge on other sites, and that can be done via the info in #4 and #5.

    And for bonus points, if you want to display the badge and a link to the scheduled pipelines here in git.drupalcode.org, you can add this in the README.md file:

    [![Build Status](https://git.drupalcode.org/project/my_module/badges/2.x/pipeline.svg)](https://git.drupalcode.org/project/my_module/-/pipeline_schedules)
    
  • πŸ‡ͺπŸ‡ΈSpain fjgarlin

    Credits.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024