英文:
How can i automate the merging from staging to production?
问题
这种方法的问题在于,每次从暂存到生产的手动合并请求之后,第二个合并请求最终会比第一个合并请求领先2个提交,这使得任何后续的合并请求都被阻塞,或者需要在本地合并然后上传。
我该如何自动化从暂存到生产的合并呢?
英文:
I have a project on gitlab with a staging and a production branches, i want to have my feature branches being automatically merged into staging with merge requests and the staging being merged into production with a manually created merge request.
The problem of this approach is that after every manual merge request from staging to production, the second one ends up being 2 commits ahead of the first one, making any subsequent merge request blocked or in the need to be locally merged and then uploaded.
How can i automate the merging from staging to production?
答案1
得分: 1
I think you should rethink your branching strategy. Do you really want to merge all of staging into production, or rather just those features that are ready?
I'd recommend merging the feature branches into main, and leave the integration/staging branch as it is. Regularly merge main into staging, and from time to time you recreate staging from scratch as taking main plus merging all current features branches into it.
With a bit of scripting, you can fully automate that using the Gitlab API to find MRs worth merging.
To control what feature branch gets merged into what target, we use custom labels to mark an MR as "merge into staging::automatically" after review. If the script fails to actually do the merge, it applies the label "merge into staging::failed" to the MR so everyone involved will get notified.
英文:
I think you should rethink your branching strategy. Do you really want to merge all of staging into production, or rather just those features that are ready?
I'd recommend merging the feature branches into main, and leave the integration/staging branch as it is. Regularily merge main into staging, and from time to time you recreate staging from scratch as taking main plus merging all current features branches into it.
With a bit of scripting, you can fully automate that using the Gitlab API to find MRs worth merging.
To control what feature branch gets merged into what target, we use custom labels to mark an MR as "merge into staging::automatically" after review. If the script fails to actually do the merge, it applies the label "merge into staging::failed" to the MR so everyone involed will get notified.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论