Build merge request with simulating the merge (git merge --no-commit)

Answered

As I can see, when TeamCity builds a merge request it is building the project code from source branch. But shouldn't it build the code simulating the merge (code from source branch merged with destination branch)?
In example:
- I have a build validation that throws error when there is more than one .txt file on project folder.
- One user creates file1.txt on master.
- Other user creates file2.txt on develop.
- A merge request is create from develop to master.

In this scenario TeamCity is building with success the master, develop and the merge request. But after accept the merge request the master build is failing because can not have two .txt on project.
Is not intended that building the merge request it should test if the merge will be ok "after" the merge was done?
Git has "git merge --no-commit" and "git merge --abort" commands to do it!

1 comment
Comment actions Permalink

Hi Rodrigo,

 

we would need to understand what exactly "merge request" is in your setup. If I understand it correctly, it would just be GitLab's pull request model, correct? I'm not used to merge requests from "normal" branches, just the specifically designed branches that the diverse git hosting services have for them.

 

If it's the case, the main issue is that not all remote providers offer this "resulting" merge commit as an option, and currently TeamCity does not create it on its own. We are planning on implementing a way to do it as part of our pull requests but we are not quite there yet. We have this task in our issue tracker to improve the feature in that matter: https://youtrack.jetbrains.com/issue/TW-62734 , please vote for it. The easiest way to achieve this right now is to simply create a build step that will go first, perform the required git tasks to run the merge, then run your build on the merged data.

 

If you meant something else, while you could probably use the same workaround, it would be useful for us to know exactly the scenario you are dealing with. 

0

Please sign in to leave a comment.