Is there a way to configure Jenkins and the Git Publisher add-on to tag a revision that's not at the head of the master branch?
We would like to manage our integration process with a couple of steps that validate our software in sequence, and to facilitate this in an automated way by tagging the latest revision that has passed the first step, then adding another tag to that revision when it passes the second step. It's possible that some later revision might in the meantime have failed the first step or something, so that we aren't adding the tag to the head anymore. There are some other scenarios that we envision that also might call for such non-head tagging, as well.
I've tried checking out the desired tag in the Execute Command step or by specifying the tag in the Git SCM Branch field, but I keep hitting a non-ff merge error because I can't pull or rebase after the tag is applied.
The only change being pushed is the tag being added.
Is this possible?
Here's what's in the console output:
> /usr/bin/git tag -l test-tag
> /usr/bin/git tag -a -f -m Testing tag built from environment variable test-tag
Pushing tag test-tag to repo origin
> /usr/bin/git config --get remote.origin.url
> /usr/bin/git push ssh://jenkins@ncs-gerrit.inhouse.com:29418/ncs-test test-tag
ERROR: Failed to push tag test-tag to origin
hudson.plugins.git.GitException: Command "/usr/bin/git push ssh://jenkins@ncs-gerrit.inhouse.com:29418/ncs-test test-tag" returned status code 1:
stdout:
stderr: To ssh://jenkins@ncs-gerrit.inhouse.com:29418/ncs-test
! [rejected] test-tag -> test-tag (non-fast-forward)
error: failed to push some refs to 'ssh://jenkins@ncs-gerrit.inhouse.com:29418/ncs-test'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.