Zempik
Zempik

Reputation: 97

how do I add a gitlab badge with a dynamic branch?

I use a closed gitlab repository. the badge is generated as a job artifact (anybadge). %{default_branch} - master

if the branch is master or develop, then everything is simple. I add a link to the badge in the settings:

 https://example.com/%{project_path}/-/jobs/artifacts/master/raw/master.svg?job=badge

but I can't configure adding a badge for the "release/1.1" branch. The value 1.1 is constantly changing. I don't want to change the link in the settings every time.

I would like to add a link like this (release*):

 https://example.com/%{project_path}/-/jobs/artifacts/release*/raw/release.svg?job=badge

Is there any solution for dynamic branches? I will be glad to have any suggestions.

p.s. using the gitlab api badge is a difficult option.

Upvotes: 0

Views: 2622

Answers (2)

sehe
sehe

Reputation: 420

As Adam Marshall already answered, gitlab currently (to my knowledge) has no native way to do this. You can try to achieve something similar with using an external api for badges, e.g. https://shields.io/ , if your project fulfills the requirements.

Upvotes: 1

Adam Marshall
Adam Marshall

Reputation: 7649

As of Gitlab 13.9, it doesn't appear that there's a way to do this. I did come across this issue where someone is requesting a similar feature to what you described, but it was opened 4 years ago and the last activity was 8 months ago asking for a progress update. I would upvote the issue (the thumbsup icon at the top) and enable notifications to stay aware of updates. Also, if you're a paying customer, talking to support to request the feature can help move development along.

Upvotes: 1

Related Questions