git - 避免在 BitBucket 管道中使用 Master 分支

标签 git bitbucket bitbucket-pipelines

我正在基于 docker 的 BitBucket 存储库上设置 CI 管道。基本上,我正在运行构建命令然后进行测试。到目前为止,这一切都有效,但我遇到的问题是 BitBucket 只有提交或让我编辑对 master 分支上的 bitbucket-pipelines.yaml 文件的更改。

我不是该项目的唯一开发人员,现在我们的 master 是我们的 staging/ready for prod 分支,我们都同意使用其他分支来做事情,让我们中的一个人管理 master 并 merge 到其中。

我的问题是,我可以使用另一个不同于 master 的分支来“管理”我的管道文件,比如我们的事件开发分支吗?出于某种原因,我找不到将管道添加到另一个分支的方法,并且在开发分支上推送 bitbucket-pipelines.yaml 文件不会触发构建。

作为引用,我的管道 yaml:

image: atlassian/default-image:2

pipelines:
  # pull-requests:
  #   'feature/*':
  #     - step:
  #       services:
  #         - docker
  branches:
    develop:
      # each step starts a new Docker container with a clone of your repository
      - step:
        services:
          - docker
        script:
          - (cd app/laravel/ ; npm install)
          - (cd app/laravel/ ; npm run production)
          - docker build -t myApp -f app/Dockerfile app/
          - docker stack up -c docker/docker-compose.yaml myApp

最佳答案

您应该能够在您想要的任何分支中拥有管道。
来自 troubleshooting section :

My branch doesn't build

Make sure that there is a bitbucket-pipelines.yml file in the root of your branch.

To build a branch, you must specify a default or a branch-specific pipeline configuration.
For more information, see Configure bitbucket-pipelines.yml.


我会在 branch workflow 之后进行测试,首先使用简化的 yaml(一个只对给定分支进行回显),用于测试。
OP RoboBear确认 in the comments , bitbucket-pipelines.yml必须使用 .yml扩展名,而不是 .yaml .

关于git - 避免在 BitBucket 管道中使用 Master 分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62160195/

相关文章:

git - 如何使用TortoiseHg将项目 pull 入或推送到GitHub存储库?

git - 理解 git 子模块状态输出

git - 将 Mercurial 项目转换为 Git

Git merge 请求序列

Git 每次提交和 pull 时都要求输入密码

kubernetes - 使用 BitBucket 将 Nodejs 应用程序导出到 Kubernetes

git - 在 Windows 上设置 autocrlf = input 有什么害处?

java - play框架路径只能访问两次

javascript - 将 secret 存储到 Bitbucket Pipelines 中,然后在 App Engine 上部署?

curl - 我可以向来自管道的 Bitbucket 拉取请求中的报告添加玩笑代码覆盖率吗