Bitbucket管道仅构建至主版本

时间:2018-10-09 14:43:38

标签: git heroku bitbucket bitbucket-pipelines

在我的Bitbucket项目存储库中,我有3个分支机构

  1. 主人
  2. 登台
  3. 发展

在我的Heroku帐户上,我有两个应用程序

  1. MyProductionApp
  2. MyStagingApp

这两个应用程序都是相同的,唯一的区别是我在演示版中实现了分阶段访问或展示了新功能,然后在生产中实现了这些功能。

如您所知,master分支是用来构建MyProductionApp的,而staging分支是用来部署MyStagingApp的。开发分支是进行主动开发的地方,然后通过拉取请求将其合并到staging / master。

我通过以下方式设置了bitbucket-pipelines.yml文件

image: node:6.9.4
clone:
  depth: full
pipelines:
  default:
      - step:
          script: #default script to run
            - echo "This default script will run when something is pushed to this branch"
  branches:
    master:
      - step:
          name: Heroku Production Deployment
          deployment: production
          caches:
            - node
          script: #deploy master branch to heroku prod app
            - npm install
            - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_PROD_APP.git HEAD:master
    staging:
      - step:
          name: Heroku Staging Deployment
          deployment: staging
          caches:
            - node
          script: #deploy staging branch to heroku staging app
            - npm install
            - git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_STAGING_APP.git HEAD:staging

.yml文件的所有三个分支都相同。

问题是当某些内容被推送/合并时,仅构建了主机。它永远不会构建我的登台应用程序。

因此,如果我添加新代码并仅合并到暂存中,它将运行此.yml文件,但它将仅生成主文件。在管道日志中,它显示以下消息

  

git push   https://heroku:$ HEROKU_API_KEY@git.heroku.com/$HEROKU_STAGING_APP.git   HEAD:stagingremote:推送到非主分支,跳过构建。

结果,我无法在登台应用程序上展示新功能或错误修复。知道为什么它会跳过“非主”分支上的构建吗?我需要进行哪些设置才能做到这一点?

0 个答案:

没有答案