I'm not sure if the summary is clear on this. What I want to do is create a jenkins build status badge url that will somehow be able to figure out the Git branch it is on, and add the correct branch suffix to the url dynamically.
I want to do this so I can create a readme file that always shows the master
, develop
, and <branch-i'm-looking-at>
jenkins builds of that repo, without having to manually update the badge for each branch.
I know how to create branch-specific build status badges. Jenkins automatically builds the markdown URL for you. For example one of mine for adevelop
branch looks like:
[]
(https://jenkins.mycompany.com/path/to/build/develop/)
I can imagine it'd be something using the ${BRANCH_NAME}
jenkins env var, but i can't think of how to create it. I'm not experienced enough with git hooks or other scripting to even start to come up with a way to do it.
Has anyone done this?