我有一个master和一个dev分支,我将每次提交都推送给这两个。我在管道中都再次运行了测试。但是,我不想同时部署这两者,只需要部署master分支即可。
当前发生的情况是,进入部署步骤的第二个分支将被暂停。当前是相同的代码,但并非总是如此。我想知道是否有一种方法可以实现类似的设置。
pipelines:
default:
-step:
name: My Test Step
# ...
-step
name: Deployment Step
# ....
这是我的bitbucket-pipelines.yml文件当前的结构。
答案 0 :(得分:1)
您需要此配置。此指导仅在主提交上运行。
pipelines:
branches:
master:
- step:
name: Clone
script:
- ....
答案 1 :(得分:0)
您需要在bitbucket-pipelines.yml
上指定管道触发器
参考:https://support.atlassian.com/bitbucket-cloud/docs/yaml-anchors/
示例:
definitions:
steps:
# Build
- step: &build
name: Install and Test
....
# Deployment
- step: &deploy
name: Deploy Artifacts
trigger: automatic
deployment: test
....
# Runner
pipelines:
# Running by tags
tags:
v*:
- step: *build
- step:
<<: *deploy
deployment: test
trigger: manual
# Running by branch
branches:
master:
- step: *build
- step:
<<: *deploy
deployment: staging
trigger: manual
develop:
- step: *build
- step:
<<: *deploy
deployment: test
trigger: automatic