首页 > 解决方案 > 替换 bitbucket 管道中的单步

问题描述

我正在尝试在遵循干原则的同时构建相当复杂的 Bitbucket 管道。

到目前为止,我在definitions部分定义了多个自定义步骤:

definitions:
  steps:
    - step: &foo
        name: foo
        script:
          ...
    - step: &bar
        name: bar
        script:
          ...

现在,除了一个工件/变量外,我有两个几乎相同的自定义管道。

pipelines:
    custom:
      action-a:
        - step:
           name: action a
           script:
             - echo "1" > .value
           artifacts:
             - .value
        - step: *bar
        - step: *foo
      action-b:
        - step:
           name: action b
           script:
             - echo "2" > .value
           artifacts:
             - .value
        - step: *bar
        - step: *foo

步骤生成.value工件之后的所有内容都是相同的(并且比仅 2 个步骤更复杂)。是否可以定义一个管道并以某种方式用锚注入这个工件?

标签: bitbucket-pipelines

解决方案


推荐阅读