如果更改来自特定分支的合并,则跳过 Azure Pipeline 作业(或整个管道)

问题描述 投票:0回答:1

如果从特定分支的合并触发,我想跳过管道作业(或整个管道)。

源分支是

fe-release-inte-package
,合并消息始终是
Merge pull request XXX from fe-release-inte-package into development
,其中
XXX
是一个整数。

以下是我所做的:

variables:
  CUSTOM_SOURCE_VERSION_MESSAGE: $(Build.SourceVersionMessage)

jobs:
  - job: deploy
    pool:
      name: Azure Pipelines
      vmImage: ubuntu-latest
    condition: not(contains(variables['CUSTOM_SOURCE_VERSION_MESSAGE'], 'fe-release-inte-package'))
    steps:
      - script: |
          echo "Printing all pipeline variables:"
          printenv
        displayName: Print all variables

条件已设置,在“打印所有变量”步骤中,我看到以下输出: CUSTOM_SOURCE_VERSION_MESSAGE=Merge pull request 8415 from fe-release-inte-package into development

对我来说一切看起来都是正确的,问题是作业仍在运行(因为我看到了上面的
printenv

输出)。

我没有看到任何其他包含 

fe-release-inte-package

文本的变量。我如何更新条件以使其在这种情况下起作用?

    

azure-devops deployment azure-pipelines cicd
1个回答
0
投票

# app-ci YAML pipeline resources: pipelines: - pipeline: securitylib source: security-lib-ci trigger: branches: include: - releases/* exclude: - releases/old*

并且已经提出了
类似的问题
,指出如果您想使用所有分支(但只有一些分支),则需要将

include 子句与 '*'

 一起使用。
虽然这个问题已经有 5 年历史了,所以从那时起它可能已经得到了改进 - 你可以在没有 
include
 子句的情况下进行测试,如果它不起作用,则添加它。
	

© www.soinside.com 2019 - 2024. All rights reserved.