This plugin allows running builds on merge results before the merge was committed. It helps to detect integration problems.
Merge commit which is created by this build step is not pushed to the remote repository, it exists only on an agent.
There is only one field in the Build Step configuration: Target branch.
There are at least two ways to configure this plugin:
- If you want to run builds on merge results with any target branch (e.g. main) you should type this one in the Target branch field. You can also add build step conditions for any purposes, e.g. do merge only for several branches (like in the screen: run all builds in bugfix_* branches on merge result with main).
- Most Git-services don't provide the merge-commits of (Merge|Pull)-requests explicitly or don't recommend using them (GitHub, GitLab, BitBucket Server, BitBucket Cloud). So, if you want to run the build on the merge commit you should use Pull Request plugin integration. You should type %teamcity.pullRequest.target.branch% into Target branch field and add necessary condition: teamcity.pullRequest.target.branch exists.
This plugin also works with several VCS-roots. When Build Branch isn't found it falls back to the <default>
branch. When it exists, preliminary merge commit with target branch creates.
If you want to run builds on the source and pre-merge branches you should configure two Build configurations: with Preliminary Merge Build Step and without.
Kotlin DSL configuration is also available for this Step. The code below describes the second example:
steps {
preliminaryMerge {
name = "premerge"
conditions {
exists("teamcity.pullRequest.target.branch")
}
targetBranchName = "%teamcity.pullRequest.target.branch%"
}
}
If you have any questions please contact me: danila.manturov@jetbrains.com