Tom*_*ink 5 git maven-3 maven maven-release-plugin jenkins
我们最近从 SVN 迁移到了 git。除了在 git 上发布其他(意外)问题之外,我想知道如何处理以下问题:
当我在 Jenkins 上开始发布运行并且一些开发人员(意外地)在发布的第一阶段推送时,发布构建失败并出现以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:2.5.3:prepare (default-cli) on project xyz: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] To ssh://[some-ip]/home/git/xyz
[ERROR] ! [rejected] release/xyz-6.10 -> release/xyz-6.10 (fetch first)
[ERROR] error: failed to push some refs to 'ssh://[some-ip]/home/git/xyz'
[ERROR] hint: Updates were rejected because the remote contains work that you do
[ERROR] hint: not have locally. This is usually caused by another repository pushing
[ERROR] hint: to the same ref. You may want to first integrate the remote changes
[ERROR] hint: (e.g., 'git pull ...') before pushing again.
[ERROR] hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[ERROR] -> [Help 1]
Run Code Online (Sandbox Code Playgroud)
Jenkins 用于启动发布构建的 maven 命令是(我们在 Windows 上构建,因此不幸的是,-DautoVersionSubmodules由于git add包含所有修改的命令行太长,我们不得不激活pom.xml):
mvn -B -DdevelopmentVersion=xyz-6.10.0-rc3-SNAPSHOT -DreleaseVersion=xyz-6.10.0-rc2 -Dtag=xyz-6.10.0-rc2 -Dresume=false -e -Dgoals=deploy -DautoVersionSubmodules=true -DcommitByProject=true -P[some-profiles] -T1C release:prepare release:perform -Darguments=-T1C
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法可以阻止其他用户推送(但允许 Jenkins 推送!)?或者任何其他稳定的工作 - 或最佳实践?
使用的版本:
预先感谢您的帮助。
我希望您同意发布失败是正确的。在这种情况下,解决这个问题并不是什么大问题:更新项目并进行另一个版本。解决此问题的最简单方法是:沟通:) 只需通知同事您计划发布此版本即可。我听说过的另一个解决方案是:先创建一个分支,然后从这个分支发布。没有人会更改分支的内容,因此这应该是一个安全的解决方案,但需要额外的工作。由您决定是否值得。大多数时候并非如此。
| 归档时间: |
|
| 查看次数: |
1221 次 |
| 最近记录: |