Hi everyone,
Currently creating project badges, on a self managed gitlab ce 14.10.5 (I know, upgrades are needed and planned before the end of this quarter), but as I’m asked to do it for the 580 projects of my gitlab instance, I went the API route and will script this.
For a code coverage badge, I’m executing the following curl command through a Debian terminal :
curl --request POST --header “PRIVATE-TOKEN: XXX” --data “link_url=https://gitlab.example.com/%25{project_path}/-/commits/%25{default_branch}/&image_url=https://gitlab.example.com/%25{project_path}/badges/%25{default_branch}/coverage.svg?key_text=Main%20test%20coverage&key_width=130&name=Main%20code%20coverage%20status” “https://gitlab.example.com/api/v4/projects/XYZ/badges”
Badge is indeed created on project number XYZ but the key_width parameter isn’t showing up in the API response body.
Checking the project number XYZ, the image_url and rendered_image_url don’t carry the key_width parameter.
Checking the web interface and the badge is using the standard width, so the name “Main test coverage” can’t be properly displayed.
Parameters before and after, key_text and key_name are processed and displayed in both API get calls and the web interface.
I also tried modifying that same badge through API call thanks to a PUT command and the key_width parameter is just like it doesn’t exist.
Using the web interface, and doing it manually does the job however.
I just can’t afford doing the manual operation for the hundreds of projects hosted on this gitlab server.
What am I doing wrong with the key_width parameter ?
Thanks very much for your assistance, wishing you a great day !