admin管理员组文章数量:1399145
I have three stages of branches: local branch → staging → production.
Right now, developers move their code to the staging branch, but I have three pipelines running in staging. I want to run only one pipeline on the master branch. How can I do that?
This is my current .yml file in GitLab:
stages:
- deploy-staging
- deploy-production
deploy-staging:
stage: deploy-staging
tags:
- CD
script:
- echo "Staging deployment started."
- echo updating gittestproject
- ssh [email protected] 'cd /var/www/html/gittestproject; git pull origin staging'
- echo "Deployment Succeed."
rules:
- if: '$CI_COMMIT_BRANCH == "staging"' # Run only if on staging branch
when: manual
deploy-production:
stage: deploy-production
tags:
- CD
script:
- echo "Production deployment started."
- echo updating gittestproject
- ssh [email protected] 'cd /var/www/html/gittestproject_production; git pull origin master'
- echo "Deployment Succeed."
rules:
- if: '$CI_COMMIT_BRANCH == "master"' # Run only if on master branch
when: manual
本文标签: Optimizing GitLab CICD running a single pipeline on the master branchStack Overflow
版权声明:本文标题:Optimizing GitLab CICD: running a single pipeline on the master branch - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744212957a2595507.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论