sbt-release icon indicating copy to clipboard operation
sbt-release copied to clipboard

Fails on `pushChanges` stage when the branch is not up to date with remote

Open zallek opened this issue 6 years ago • 0 comments

Hi, sbt-release fails when a commit is pushed on remote while releasing:

sbt-release is used by our CI after tests run successfully. Before running sbt release, the remote is checkout. Everything works fine except when a commit is pushed by someone else (or something else) while releasing. Indeed, the last step pushChanges tries to push version change commit to remote though it's not up to date anymore making git push fails.

Should we add a git pull before pushing ?

Using sbt release 1.0.4

CI Logs:

[info] Packaging /tmp/dd7109b097dc2011d2efbd3a4c50082a49bb928e_df296e25-5492-4733-8f15-dd42a7a9e63d/cerberus/cerberus-jaw/app/target/cerberus-jaw-0.84.jar ...
[info] Done packaging.
[info] 	published cerberus-jaw to s3://sf-repo-jar-e64d87d322660c184242a7270bcfd377/release/com/tinyclues/cerberus/cerberus-jaw/0.84/cerberus-jaw-0.84.pom
[info] 	published cerberus-jaw to s3://sf-repo-jar-e64d87d322660c184242a7270bcfd377/release/com/tinyclues/cerberus/cerberus-jaw/0.84/cerberus-jaw-0.84.jar
[info] 	published cerberus-jaw to s3://sf-repo-jar-e64d87d322660c184242a7270bcfd377/release/com/tinyclues/cerberus/cerberus-jaw/0.84/cerberus-jaw-0.84.jar
[success] Total time: 35 s, completed Dec 20, 2017 9:46:01 AM
[info] Setting version to '0.85-SNAPSHOT'.
[info] Reapplying settings...
[info] Set current project to cerberus-jaw (in build file:/tmp/dd7109b097dc2011d2efbd3a4c50082a49bb928e_df296e25-5492-4733-8f15-dd42a7a9e63d/cerberus/cerberus-jaw/app/)
[info] [master c463a88] Setting version to 0.85-SNAPSHOT
[info]  1 file changed, 1 insertion(+), 1 deletion(-)
[info] To [email protected]:tinyclues/odyssey.git
[info]  ! [rejected]        master -> master (fetch first)
[info] error: failed to push some refs to '[email protected]:tinyclues/odyssey.git'
[info] hint: Updates were rejected because the remote contains work that you do
[info] hint: not have locally. This is usually caused by another repository pushing
[info] hint: to the same ref. You may want to first integrate the remote changes
[info] hint: (e.g., 'git pull ...') before pushing again.
[info] hint: See the 'Note about fast-forwards' in 'git push --help' for details.
java.lang.RuntimeException: Nonzero exit value: 1
	at scala.sys.package$.error(package.scala:27)
	at sbt.AbstractProcessBuilder.getString(ProcessImpl.scala:134)
	at sbt.AbstractProcessBuilder.$bang$bang(ProcessImpl.scala:137)
	at sbtrelease.ReleaseStateTransformations$$anonfun$pushChangesAction$1.apply(ReleaseExtra.scala:250)
	at sbtrelease.ReleaseStateTransformations$$anonfun$pushChangesAction$1.apply(ReleaseExtra.scala:239)
	at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4.sbtrelease$ReleasePlugin$autoImport$ReleaseKeys$$anonfun$$filterFailure$1(ReleasePlugin.scala:169)
	at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4$$anonfun$7$$anonfun$apply$3.apply(ReleasePlugin.scala:183)
	at sbtrelease.ReleasePlugin$autoImport$ReleaseKeys$$anonfun$4$$anonfun$7$$anonfun$apply$3.apply(ReleasePlugin.scala:183)
	at scala.Function$$anonfun$chain$1$$anonfun$apply$1.apply(Function.scala:24)
	at scala.Function$$anonfun$chain$1$$anonfun$apply$1.apply(Function.scala:24)

zallek avatar Dec 20 '17 14:12 zallek