In the git flow model should I build from the merge commit in master to release?
At my company we have a CI/Build server that we use to test and build releases (as well as features and the develop branch).
In the git flow branching model when it is time to release you branch off develop and name it (for instance) release-1.4. The CI/Build server would then automatically build the branch and we would deploy it to a staging server for manual integration testing. Once we are satisfied with the build we would like to deploy it. But in the git flow branching model we need to merge to master and tag first. The question is, do we need to run another build and test cycle after this merge or what?
It seems weird to merge and tag ending up with the tag pointing at a different (technically) commit than the release was built off of. It also seems bad to rebuild after we get into master because we would then feel compelled to test that build to make sure it is ok too.
- using git-flow with multiple git repositories per project/app?
- Git flow branching for fixing a bug
- git merge and different gitignore for each branch
- Versioning and release management with multiple products with shared code base
- Why cannot a feature be finished with unstaged changes?
- Commit to develop branch directly in Git Flow?
The options I’ve come up with are:
- build in the release branch and then merge and rebuild and test in the master branch
- build and test in the release branch then merge and trust that no new build is needed
- Modify the git flow model to remove the step of merging to master and just tag the final commit in the release branch that we want to release.
- What would be lost by not merging to master?
- In this case we could probably just develop in master
2 Solutions collect form web for “In the git flow model should I build from the merge commit in master to release?”
The question is, do we need to run another build and test cycle after this merge or what?
That merge shouldn’t break anything because it should be a fast-forward merge, all the commits on master are on the release branch. Therefore, you can not create a bug on master post-merge that wasn’t on the release branch.
So technically yes, it isn’t the precise commit you built, but the philosophy is that everything on the master branch is in production. At anytime, if someone pulls the master branch he should get the current production code. That’s why you don’t merge and then build, and test, and wait, and fix things on master for a release.
Now things does not always go smoothly. By the time the release has been validated and is ready to ship, you may have encounter major production bugs that needed a hotfix, in that case some commits have been pushed to master and develop but not to the release branch. If this happens, I’d rebase (be careful with that when working in team, merge is safer) the release branch on develop (to catch up with the hotfixes) and rebuild again. To sum up, if there are no hotfixes between the time the release branch was created and the time it is validated, no need to rebuild.
If your merge into master branch isn’t fast-forward it means that it can result in new, untested code. Even completely obvious and automatic merges can result in code that simply won’t compile. So, if for some reason it’s not an ff merge, you need to test. Otherwise, it’s the same commit.