Skip to content

Built in badge for latest release

Bala Kumar requested to merge release-badge into master

What does this MR do and why?

Adds a built in badge for the latest release. We generate and render from the backend, a svg badge image with the key-text as Latest Release and the value-text as the latest release tag name of the project (Example here). If releases are not created for the project we show the value-text as none.

This is a coach will finish MR carried over from Community contribution !18098 (closed).

Relates to #33368 (closed)

We also support the various style format and customization for badges as listed in https://docs.gitlab.com/ee/ci/pipelines/settings.html#badge-styles

Note:

  • We will create a follow up documentation MR for this feature.
  • The link_url for the badge in project general settings page can be documented as https://gitlab.com/%{project_path}/-/releases till the other issue is shipped (after which we can have a permalink like releases/permalink/latest). This approach is more viable as changing the link url otherwise will lead to additional frontend effort for handling other native badges namely pipeline and coverage.
  • The image_url for the badge in project general settings page will be https://gitlab.com/%{project_path}/-/badges/release.svg

Screenshots or screen recordings

Badge configuration snippet in Project -> Settings -> CI/CD -> General pipelines

ci_cd_badge_snippet

Project -> Settings -> General

release_badge_general_settings

View badge on project stats

view_badge_on_project_stats

No releases for a project !78899 (comment 826855632)

How to set up and validate locally

  1. Create a release as mentioned in https://docs.gitlab.com/ee/user/project/releases/#create-a-release-in-the-releases-page
  2. Configure the badge and view it as referenced in !78899 (merged)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Bala Kumar

Merge request reports