我们最近从 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]
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
有没有一种简单的方法来阻止其他用户推送(但允许 Jenkins 推送!)?或者任何其他稳定的解决方法 - 或最佳实践?
使用的版本:
- Maven 3.3.9
- Maven 发布插件 2.5.3
- git 2.8.1
- 詹金斯 1.629
- Jenkins Maven 发布插件 插件 0.14.0
- Windows 10
预先感谢您的帮助。
我希望您同意发布失败是正确的。在这种情况下,解决这个问题并不是什么大问题:更新项目并进行另一个版本。
解决此问题的最简单方法是:沟通:) 只需通知同事您计划发布此版本即可。
我听说过的另一个解决方案是:先创建一个分支,然后从这个分支发布。没有人会更改分支的内容,因此这应该是一个安全的解决方案,但需要额外的工作。由您决定是否值得。大多数时候并非如此。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)