繁体   English   中英

如何在bitbucket中创建两个管道?

[英]How to create two pipelines in bitbucket?

我在Heroku中有两个应用程序。 一个是阶段,另一个是生产。 当前在我的BitBucket中,主分支将部署到Heroku中的生产服务器。 我希望将我的登台分支部署到Heroku中的登台服务器。

这是我生产的bitbucket-pipelines.yml

image: node:6
clone:
  depth: full
pipelines:
  branches:
    master:
        - step:
            script:
              - npm install
              - npm test
              - git config --global user.email "abc@abc.com"
              - git config --global user.name "abc@abc.com"
              - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME_PRODUCTION.git HEAD 

我怎样才能创建另一个bitbucket-pipelines.yml用于暂存分支并将其推送到暂存服务器?

您应该在所有分支机构中拥有相同的bitbucket-pipelines.yml文件。 配置中的规则将确定执行哪些管道。

您可以具有这样的配置,该配置将在master分支更改时部署到master,同样在staging分支更改时部署到staging。

image: node:6
clone:
  depth: full
pipelines:
  branches:
    master: # Only runs when master branch is changed. Deploys to production.
        - step:
            script:
              - npm install
              - npm test
              - git config --global user.email "abc@abc.com"
              - git config --global user.name "abc@abc.com"
              - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME_PRODUCTION.git HEAD
    staging: # Only runs when staging branch is changed. Deploys to staging.
        - step:
            script:
              - npm install
              - npm test
              - git config --global user.email "abc@abc.com"
              - git config --global user.name "abc@abc.com"
              - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME_STAGING.git HEAD

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM