I have a pipeline that uses a docker image.
I can specify the docker image name by hand, but I would like to get the right image name automatically, i.e. the docker image label is the branch name…
This way, I wouldn’t have to write one pipeline per branch, all the branches would use the same, as the docker image name would be deducted from the branch name.
I tried:
As far as I understand from the declarative Pipeline docs in my Jenkins:
BRANCH_NAME
For a multibranch project, this will be set to the name of the branch being built, for example in case you wish to deploy to production from master but not from feature branches; if corresponding to some kind of change request, the name is generally arbitrary (refer to CHANGE_ID and CHANGE_TARGET).