Rob*_*ear 4 git bitbucket bitbucket-pipelines
我正在基于 docker 的 BitBucket 存储库上设置 CI 管道。基本上,我正在运行构建命令然后进行测试。到目前为止,这一切都有效,但我遇到的问题是 BitBucket只提交或让我编辑对 master 分支上的bitbucket-pipelines.yaml文件的更改。
我不是该项目的唯一开发人员,现在我们的 master 是我们的 staging/ready for prod 分支,我们都同意使用其他分支来处理事情,让我们中的一个人管理 master 并合并到其中。
我的问题是,我可以使用另一个不同于 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
Run Code Online (Sandbox Code Playgroud)
我的问题是,尚未为存储库启用管道,并且由于我将 bitbucket-pipelines.yml 文件添加到不是主分支的分支,并且没有使用入门教程,因此尚未为存储库启用管道。转到存储库设置 -> 管道 | 设置 -> 启用管道。然后,您必须使用 bitbucket-pipelines.yml 将另一个更改推送到分支,并且它应该运行管道。
您应该能够在您想要的任何分支中拥有管道。
从故障排除部分:
我的分支没有建立
确保
bitbucket-pipelines.yml分支的根目录中有一个文件。要构建分支,您必须指定一个
default或一个branch-specific管道配置。
有关更多信息,请参阅配置 bitbucket-pipelines.yml。
我会在分支工作流之后测试它,首先使用简化的 yaml(一个只对给定分支进行回显),以进行测试。
正如OP RoboBear在评论中确认的那样,bitbucket-pipelines.yml必须使用.yml扩展名,而不是 .yaml.