简体   繁体   中英

Azure Pipelines: Individual CI triggered for pipelines despite trigger: none

I'm a bit at a loss currently with pipeline triggers in azure piplines:

My pipelines keep triggering for individual CI whenever I commit to my pipeline experimentation branch my_pipeline_experiment_branch .

Screenshot from Run-History of Main

(Ignore that they're all failing - that's expected...)

This issue has started when I have introduced pipeline resource into another completely unrelated pipeline yaml.

This is part of the MAIN Pipeline YAML as example. I have specified trigger: none and pr: none for all pipelines where this occurs. I've also tried the different combinations with the commented out triggers on the resources.

My expectation is that, this should disable all CI triggers for that pipeline.

Any idea what is going on here? I'm starting to think I am going mad...

trigger: none
#  branches:
#    exclude: 
#      - '*'

pr: none ## added because i found that on a random stackoverflow answer, that this is by default enabled?!

pool:
  vmImage: ubuntu-latest

resources:
  repositories:
    - repository: my_repo
      type: git
      name: project/repo
      ref: feature/my_pipeline_exeperiment_branch # just for dev purposes... 
     # trigger: none
    - repository: central_repo
      type: git
      name: project2/central_repo
      ref: main
     # trigger: none

I have also tried pausing the pipelines via their settings... this is also ignored.

Edit: added Screenshot of pipeline trigger configuration: MAIN Triggers config

I believe the issue is your main branch still listens on the trigger on commit. Though you are committing your code to the experimental branch, unless you manually run the pipeline and select the source pipeline definition:

在此处输入图像描述

The pipeline definition will evaluate the main YAML definition of the pipeline for any trigger and/or include/exclude. You may want to leverage exclude on the main to preserve existing CI/CD workflows if the repo is being worked on through other branches.

 trigger:
  branches:
    include:
    - releases/*
    - main
    exclude:
    - topic/*

I believe this is the closest for Microsoft documentation on this . 在此处输入图像描述

I appear to have solved it myself - and it's incredibly stupid:

The issue at hand was that the main pipeline yaml had not been completely validated with the changed trigger setup (hence all the failed runs in screenshot). Once I had resolved these issues, the trigger configuration appears to have finally been accepted.

So to note for someone with a similar issue: Make sure you had a version validated by Devops / without errors, that included the correct triggers. If you change the triggers and the validation fails, the triggers are not set correctly.

Edit: I've been thinking about this and honestly, i find this a bit counter-intuitive: If something fails the YAML validation, it'll be executed as a CI-Trigger but eventually fail due to the validation issues. Somewhat strange.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM