Jenkins git maven 发布 - git 推送 failed/updates 被拒绝
Jenkins git maven release - git push failed/updates were rejected
我正在尝试使用 git 实现 Jenkins maven 版本。我遵循了 this 指南,但我的发布失败并出现以下错误。它一边推一边抱怨。我正在使用工作区清理插件,所以每次它都应该获取项目的新副本。我不确定为什么会收到此错误。
我尝试添加一个执行“git fetch
”和“git pull origin master
”的前置步骤,但我仍然遇到错误。似乎它正在 jenkins 工作区以外的其他地方创建本地回购协议。有人可以指出我正确的方向吗?
10:44:05 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project test: Unable to commit files
10:44:05 [ERROR] Provider message:
10:44:05 [ERROR] The git-push command failed.
10:44:05 [ERROR] Command output:
10:44:05 [ERROR] To ssh://abc.example.com/test.git
10:44:05 [ERROR] ! [rejected] master -> master (fetch first)
10:44:05 [ERROR] error: failed to push some refs to 'ssh://gitlab@abc.example.com/test.git'
10:44:05 [ERROR] hint: Updates were rejected because the remote contains work that you do
10:44:05 [ERROR] hint: not have locally. This is usually caused by another repository pushing
10:44:05 [ERROR] hint: to the same ref. You may want to first integrate the remote changes
10:44:05 [ERROR] hint: (e.g., 'git pull ...') before pushing again.
10:44:05 [ERROR] hint: See the 'Note about fast-forwards' in 'git push --help' for details.
10:44:05 [ERROR] -> [Help 1]
您不应该在 release:prepare 即将更新的回购分支上完成远程提交。作为 mentioned here,这是与同一存储库的其他贡献者的沟通问题。
确保您的本地存储库是最新的 (git pull
),然后启动您的 mvn
命令。
这个GitLab issue还建议:
You could skip pushing back to master and just the commit with the new tag.
Run
mvn release:prepare release:perform -DpushChanges=false
git push —tags
Additional benefit: you do not spoil the master’s commit history with the two release-commits.
Of course now you need to bump your version somehow.
You could use the ci_pipeline_id approach via inclusion of this plugin.
我通过创建一个新的 jenkins 作业解决了这个问题。之后一切正常。
我正在尝试使用 git 实现 Jenkins maven 版本。我遵循了 this 指南,但我的发布失败并出现以下错误。它一边推一边抱怨。我正在使用工作区清理插件,所以每次它都应该获取项目的新副本。我不确定为什么会收到此错误。
我尝试添加一个执行“git fetch
”和“git pull origin master
”的前置步骤,但我仍然遇到错误。似乎它正在 jenkins 工作区以外的其他地方创建本地回购协议。有人可以指出我正确的方向吗?
10:44:05 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.2:prepare (default-cli) on project test: Unable to commit files
10:44:05 [ERROR] Provider message:
10:44:05 [ERROR] The git-push command failed.
10:44:05 [ERROR] Command output:
10:44:05 [ERROR] To ssh://abc.example.com/test.git
10:44:05 [ERROR] ! [rejected] master -> master (fetch first)
10:44:05 [ERROR] error: failed to push some refs to 'ssh://gitlab@abc.example.com/test.git'
10:44:05 [ERROR] hint: Updates were rejected because the remote contains work that you do
10:44:05 [ERROR] hint: not have locally. This is usually caused by another repository pushing
10:44:05 [ERROR] hint: to the same ref. You may want to first integrate the remote changes
10:44:05 [ERROR] hint: (e.g., 'git pull ...') before pushing again.
10:44:05 [ERROR] hint: See the 'Note about fast-forwards' in 'git push --help' for details.
10:44:05 [ERROR] -> [Help 1]
您不应该在 release:prepare 即将更新的回购分支上完成远程提交。作为 mentioned here,这是与同一存储库的其他贡献者的沟通问题。
确保您的本地存储库是最新的 (git pull
),然后启动您的 mvn
命令。
这个GitLab issue还建议:
You could skip pushing back to master and just the commit with the new tag.
Run
mvn release:prepare release:perform -DpushChanges=false git push —tags
Additional benefit: you do not spoil the master’s commit history with the two release-commits.
Of course now you need to bump your version somehow.
You could use the ci_pipeline_id approach via inclusion of this plugin.
我通过创建一个新的 jenkins 作业解决了这个问题。之后一切正常。