替换Bitbucket管道中的单个步骤

时间:2020-04-08 09:41:05

标签: bitbucket-pipelines

我在遵循干燥原则的情况下尝试构建相当复杂的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个步骤更复杂)。可以定义一个单一的管道,并以某种方式将这些工件注入锚点吗?

0 个答案:

没有答案