Wrong Automerge behaviour

I made a simple project to test release process.

It have two build maven steps for maven-release-plugin:

And one build feature 

But it seems that auto merge starts to work BEFORE maven tasks starts. Here git log from Idea 

But i want to run automerge AFTER my maven build streps finished

 

0
8 comments

Which commit triggered the build? current to master? Or any of the maven-release-plugin? Do the maven projects commit anything on their own? If so, automerge will still work after the maven build steps finish, but it will work with the commit that trigger the build.

0

I turned off triggers for this build. It starts manualy. I start build on master.

Maven do two commits wich marked with [maven-release-plugin] prefix. Nothing more. 
Step by step

  1. When I do "current to master" commit (15:36) I have 0.42-SNAPSHOT in pom.xml
  2. in "[maven-release-plugin] prepare release release-test-0.42" maven set version to 0.42
  3. in "[maven-release-plugin] prepare for next development iteration" maven set version to 0.43-SNAPSHOT
  4. merge commit "Merge branch 'refs/heads/master" (from master to current) pass version 0.42-SNAPSHOT but I expect version should be 0.43-SNAPSHOT

Commits have been made by maven is using user *BOT, Teamcity is using user with name TEAMCITY.
So I can understand that mergecommit from "automerge build feature" is made  from commit where build start not from commit build finished, as I expect

 

0

Hi, and thanks for clarifying. As mentioned, I guess the problem with the timing is that because teamcity merges the branch at the point of the commit that was taken by the build at the start, it feels like it's actually doing it before, but it's not the case. The merge happens after the build, but will merge the commit that was picked up at the start of the build.

First, as a workaround, you can simply add a last build step to merge the branch only if the build is successful.

Then, if you would like this to be directly supported by the automerge feature, please fill a request in our tracker here: https://youtrack.jetbrains.com/issues/TW

0

I didn't understand the workaround.

What exactly build step should add to build configuration?

And, yes, I have already post a bug in youtrack :)

0

Thanks for writing up the request.

Regarding the workaround, add a build step, use a command line script, then simply run manually the merge. Something like:
git checkout master
git merge %teamcity.build.branch%
(add git push if required)

0

I see another workaround - make chain of builds. First build make release with maven tasks and second build will call "automerge build feature". But it's not cool use build configuration only for use feature.

0

My workaround doesn't work. :( It seems that depended build start at the same commit.

0

Hi Alexey,

as you have experienced, the chain of builds will not help in your case. Snapshot dependencies are meant explicitly to keep order, but in that order they retain as well the revision that started the build to ensure consistency with the code base, to avoid commits that happened between the start of the build and the end of the chain to impact the results. We prefer suggesting non-manual steps when possible, if I suggested the manual step is because I can't think of a better way to do it right now.

0

Please sign in to leave a comment.