问题
I'm fairly new to git and Jenkins. We want to use Jenkins and follow the feature-branch-workflow concept, which I believe is similar to the GitHub flow.
I'm aware that the master branch should always be what's currently deployed in production, but then when should the master branch be updated? It seems like there are two choices:
- BEFORE deploying to production: A pull request gets approved and the successful merge with master triggers the build, deployment to a staging environment, QA testing, and then someone pushes a button to deploy to production
- AFTER deploying to production: Something (e.g. a pull request) triggers the build, testing, etc, and the code gets successfully released to production - THEN master is updated
But in the case of going with option (1), if the tests aren't passing and the newly updated master won't get released into production, do you then just reset master before you go home for the day?
回答1:
if the tests aren't passing and the newly updated master won't get released into production,
You can update an ephemeral QA/integration branch first, running the test, and update master if those test pass (and trigger the release into production)
"ephemeral" means: you create/reset the QA branch just for integrating the feature branches marked as being for the next release.
You can see an example of ephemeral branches in the git workflow.
来源:https://stackoverflow.com/questions/45155277/with-git-feature-branch-workflow-when-do-you-update-the-master-branch