从 azure devops 上的功能分支触发构建时的运行阶段

时间:2021-01-25 08:17:19

标签: azure-devops azure-pipelines

当构建来自功能分支时,我们需要运行阶段,我们创建功能分支如下 壮举/123 壮举/美国广播公司...等 所以当构建来自像 feat/* 这样的任何功能分支时,需要执行阶段。

尝试设置如下条件,但没有成功。

jobs:
- job: DockerBuildtask
condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/develop'), eq(variables['build.sourceBranch'], 'refs/heads/release'), eq(variables['build.sourceBranch'], 'refs/heads/feat.*'), eq(variables['build.sourceBranch'], 'refs/heads/bugfix.*')))

jobs:
- job: DockerBuildtask
condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/develop'), eq(variables['build.sourceBranch'], 'refs/heads/release'), eq(variables['build.sourceBranch'], 'refs/heads/feat/*.'), eq(variables['build.sourceBranch'], 'refs/heads/bugfix/*.')))

jobs:
- job: DockerBuildtask
condition: and(succeeded(), or(eq(variables['build.sourceBranch'], 'refs/heads/develop'), eq(variables['build.sourceBranch'], 'refs/heads/release'), eq(variables['build.sourceBranch'], 'refs/heads/feat*.'), eq(variables['build.sourceBranch'], 'refs/heads/bugfix*.')))

但无法成功..我在这里遗漏了什么吗?

1 个答案:

答案 0 :(得分:0)

您有 eq(variables['build.sourceBranch'], 'refs/heads/feat.'),就您而言,它应该是 contains(variables['build.sourceBranch'], 'refs/heads/feat')。我假设您已正确设置 CI triggers