I am trying to marry the git flow approach (w/ dev, test, uat, staging, prod env) & automated build and releases in Visual Studio Team System (VSTS). Slightly struggling due to VSTS needing a persistent branch to 'anchor' builds on – I am curious what other people do.
Our Approach
- branch
newFeature
fromdevelop
branch. - do work, & raise PR for
newFeature
. Once approved & automated build runs,newFeature
is merged in todevelop
and deleted. - This build, is then deployed to development environment, and sense checked.
- Same [unchanged] build can then be deployed to the test environment, and QA'ed.
- When testers are happy, release is prepared for UAT. We create a brand new
release-x
branch fromdevelop
, perhaps cherry pick things too.. release-x
is then build then deployed to UAT.- issues / defects are prioritised and resolved.. some go on backlog, some are made directly to
release-x
is critical. - once all ready
release-x
is merged tomaster
branch, which triggers a new, 3rd build.. - that build is deployed to staging env for final customer checks
- when all ok, same build is also deployed to production
So, to achieve this, we have a couple of build/release pipelines:
- dev/test – this takes the build produced on feature completion, and makes that same build avail for test
- staging/prod – this takes the build produced once a release is merge into master, and can also push it to prod
- don't have anything automated for UAT due to
release-x
not being permanent
The overall question I have here really two-fold:
-
Where / when should take a release branch?
- when a dev build is done?
- following an ok'ed test build?
- something else?
-
How best to avoid the 3 builds that we currently have? 😐
I think I would like to do the former… but I'm not sure how VSTS CICD can accommodate?
Best Answer
Your life will be easier if you only build from persistent branches. ie develop and master.
You are already doing this with your dev builds, if you follow gitflow you should build from the master branch after merging the release branch. Not the release branch pre merge.
Subsequent changes to the release are done on hotfix branches and again built on master once the hotfix has been merged in.
I would further advise not pushing your dev build further than the dev environment. All proper testing should be done against the same binaries that will be released. Not the same source code.
So I would go
Now obviously the downside of this is if you normally find lots of bugs during testing, your master branch has lots of 'bad' commits
The upside is you test the exact version of the software you deploy.
If you have lots of automated tests and they all pass in DEV then you shouldn't get any bugs in master.
If you are doing manual testing, then you are probably better off pushing the DEV build to TEST and doing your bug fixes as feature branches