admin管理员组

文章数量:1384181

I have created a CI pipeline that is triggered when changes are pushed/merged into branch: "master".

trigger:
  batch: true
  branches:
    include:
      - master

pool: 
  vmImage: windows-latest

jobs:
  - job: Build
    condition: and(succeeded(),not(contains(variables['Build.SourceVersionMessage'], '[skip ci]'))) 
    steps:
      - script: echo "Hello world"!
        displayName: 'Echo Hello world'

      - script: echo "$(Build.SourceVersionMessage)"!
        displayName: 'Echo Build.SourceVersionMessage'

I want my pull request to not trigger this pipeline.

Is it possible to skip the CI pipeline if the pull request contains something like "[skip ci]"?

I know that something similar is possible when directly pushing into master, per the docs.

As you can see in the code above, I also tried a condition on the job, but it somehow always runs.

I have created a CI pipeline that is triggered when changes are pushed/merged into branch: "master".

trigger:
  batch: true
  branches:
    include:
      - master

pool: 
  vmImage: windows-latest

jobs:
  - job: Build
    condition: and(succeeded(),not(contains(variables['Build.SourceVersionMessage'], '[skip ci]'))) 
    steps:
      - script: echo "Hello world"!
        displayName: 'Echo Hello world'

      - script: echo "$(Build.SourceVersionMessage)"!
        displayName: 'Echo Build.SourceVersionMessage'

I want my pull request to not trigger this pipeline.

Is it possible to skip the CI pipeline if the pull request contains something like "[skip ci]"?

I know that something similar is possible when directly pushing into master, per the docs.

As you can see in the code above, I also tried a condition on the job, but it somehow always runs.

Share Improve this question edited Mar 18 at 9:37 kopolomo asked Mar 18 at 7:44 kopolomokopolomo 371 silver badge7 bronze badges 7
  • How do you (try to not) trigger that? What is the output it generates? – Ulrich Eckhardt Commented Mar 18 at 8:25
  • I was trying to not trigger this pipeline by having [skip ci] in the name or description of my pull request. However even when my pull request contains [skip ci] in the name, it still triggers the pipeline. – kopolomo Commented Mar 18 at 8:34
  • Hi there, can you verify the build reason for the unexpected run was Individual CI triggered by the PR merge commit not PR automated by the PR build validation? Is the pipeline YAML definition file that contains trigger: none to disable all CI triggers from the master branch or any other branch? Is the Git repo provider Azure Repos or other services like GitHub? – Alvin Zhao - MSFT Commented Mar 18 at 9:18
  • 1 Please also include the info I requested in the question, so that nobody has to guess what you are doing and how Azure behaves in response. – Ulrich Eckhardt Commented Mar 18 at 9:43
  • 1 Hi @Kopolomo03, Thanks for the update. That makes sense now. I can reproduce the issue and I am afraid the behavior is by design. Hope the information may be helpful to you. – Alvin Zhao - MSFT Commented Mar 18 at 9:55
 |  Show 2 more comments

1 Answer 1

Reset to default 1

I am afraid this behavior is by design.

As outlined in this document,

Finally, after you merge the PR, Azure Pipelines will run the CI pipelines triggered by pushes to the target branch, even if some of the merged commits' messages or descriptions contain [skip ci] (or any of its variants).

However, your pipeline should not reproduce the behavior. Based on your current pipeline YAML definition, which includes trigger: none, all CI triggers on the master branch should already be disabled. This means that the pipeline should not be triggered by any commit pushed to master, no matter it is a merge commit or a direct push.

The only way it would trigger is if the YAML definition from the master branch explicitly includes trigger: - master, as shown in the above image.

To further investigate, please verify:

  1. Whether the YAML trigger definition is being extracted from the .yml file in the master branch.
  2. Whether the YAML trigger settings have been overridden by UI settings.

本文标签: azurePull request NOCIskip ci not workingStack Overflow