Git Publisher标记早期版本?

Git Publisher标记早期版本?,git,jenkins,merge,tags,publisher,Git,Jenkins,Merge,Tags,Publisher,有没有办法配置Jenkins和Git Publisher插件来标记主分支之外的修订版 我们希望通过几个步骤来管理我们的集成过程,这些步骤依次验证我们的软件,并以自动化的方式促进这一过程,方法是标记通过第一步的最新版本,然后在通过第二步时向该版本添加另一个标记。有可能是后来的一些修订版在这段时间里没有通过第一步或者其他什么,所以我们不再向头部添加标签了。我们设想的其他一些场景也可能需要这种非头部标记 我已经尝试在Execute命令步骤中签出所需的标记,或者在Git SCM Branch字段中指定标

有没有办法配置Jenkins和Git Publisher插件来标记主分支之外的修订版

我们希望通过几个步骤来管理我们的集成过程,这些步骤依次验证我们的软件,并以自动化的方式促进这一过程,方法是标记通过第一步的最新版本,然后在通过第二步时向该版本添加另一个标记。有可能是后来的一些修订版在这段时间里没有通过第一步或者其他什么,所以我们不再向头部添加标签了。我们设想的其他一些场景也可能需要这种非头部标记

我已经尝试在Execute命令步骤中签出所需的标记,或者在Git SCM Branch字段中指定标记,但是我一直遇到一个非ff合并错误,因为在应用标记后,我无法拉取或重新基址

唯一正在推动的更改是正在添加的标记

这可能吗

以下是控制台输出中的内容:

 > /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.

这还不可用,但有一张罚单:

经过几天的努力,我发现了以下解决方法:

在jenkins框中缓存git凭据:

$ git config --global credential.helper 'cache --timeout 600'
这使凭证可用于Jenkins中的执行Shell构建步骤:

$ /usr/local/bin/git tag -a "v${APPLICATION_VERSION}(${BUILD_DISPLAY_NAME})" ${GIT_COMMIT} -m "Tag at ${BUILD_ID}"
$ /usr/local/bin/git push Bitbucket "v${APPLICATION_VERSION}(${BUILD_DISPLAY_NAME})"
(注意:应用程序_版本和GIT_提交变量已由上游作业设置)