开发和主分支将bitbucket-pipelines.yml推到哪里?

时间:2020-04-14 00:10:54

标签: bitbucket-pipelines

我有一个开发部门和一个master分支。我将bitbucket-pipeline.yml推送到master分支,并意识到要在developer分支上运行我的管道。最好先将其提交到开发部门吗?

1 个答案:

答案 0 :(得分:1)

如果分支中有bitbucket-pipelines.yml-在向该分支提交内容时,该文件将用于管道;如果创建PR,则将使用第一个分支中的文件(与提交)。

最佳实践是在每个分支中使用一个配置,该配置共享所有分支/标记/拉取请求的逻辑,如果您需要不同分支的规则,则只需在bitbucket-pipelines.yml中指定它们。 / p>

我在每个分支中都有此文件:

image: satantime/puppeteer-node:12.16.1-buster

pipelines:
    default:
        - step: &Preparation
        - step: &Manual
        - step: &BuildAOT
        - step: &Lint
        - step: &CodeStyle
        - step: &LintTs
        - step: &LintCss
        - step: &UT
        - step: &E2E
        - step: &BuildDocker
    pull-requests:
        '**':
            - step: *Preparation
            - step: *Manual
            - parallel:
                  - step: *CodeStyle
                  - step: *Lint
            - step: *BuildAOT
            - parallel:
                  - step: *UT
                  - step: *E2E
            - step: *BuildDocker
    branches:
        '**': # <- rules for all branches
            - step: *Preparation
            - step: *BuildDocker
        'master': # <- rules for the master branch
            - step: *Preparation
            - step: *UT
            - step: *E2E
            - step: *BuildDocker