microsoft / azure-pipelines-yaml

Azure Pipelines YAML examples, templates, and community interaction
MIT License
1.21k stars 934 forks source link

Downstream Pipeline does not trigger from upstream pipeline #514

Closed jontreynes closed 4 years ago

jontreynes commented 4 years ago

This repo is for working in the open on Azure Pipelines YAML features. It's not a great place to make new feature requests, report problems, or get support. Issues you open here may sit unreviewed for a very long time.

I have an upstream pipeline named manual-version-layers in a pipeline folder called myfolder Also, an upstream pipeline named layer-ztest in a pipeline folder called myfolder

Below is essentially the folder structure on a branch called users/joreynes/179828

./
Layers/ztest/Pipelines/Pipeline.yaml  # which is used in layer-ztest pipeline
Layers/Pipeline.Version.yaml          # which is used in manual-version-layers pipeline

Layers/Pipeline.Version.yaml looks like

name: kit-publish-$(Date:yyyyMMdd).$(Rev:rr)

trigger:
  branches:
    include:
    - users/*
  paths:
    include:
      - /layers/Pipeline.Version.yaml

variables:
  - name: system.debug 
    value: true

pool: custom_vmss

steps:
- bash: echo "what is good"

Layers/ztest/Pipelines/Pipeline.yaml looks like

name: layer-ztest-$(Date:yyyyMMdd).$(Rev:rr)

trigger:
  branches:
    include:
    - users/*
  paths:
    include:
      - /layers/ztest
      - /scripts
    exclude: 
      - /**/*.md
      - /.attachments

variables:
  - name: system.debug 
    value: true

pool: custom_vmss

resources:
  pipelines:
  - pipeline: main
    source: manual-version-layers
    trigger:
      branches:
        include:
          - refs/heads/master   
          - refs/heads/users/*

steps:
- bash: echo "runId [$(resources.pipeline.main.runID)]"

Whenever I trigger (through batch push or manually) manual-version-layers, layer-ztest does not get triggered.

If I ever trigger (through batch push or manually) layer-ztest, the pipeline will successfully print the runId of the latest manual-version-layers

I need the Downstream Pipeline to be auto triggered from the upstream pipeline. I'm not sure what I'm missing. Any idea what's wrong?

I’d rather not Override the YAML CI trigger b/c I prefer having the trigger defined in code


UPDATE: Interestingly enough this somehow works when triggering from an upstream pipeline.

Layers/Pipeline.Version.yaml looks like

name: kit-publish-$(Date:yyyyMMdd).$(Rev:rr)

trigger:
  branches:
    include:
    - users/*
  paths:
    include:
      - /layers/Pipeline.Version.yaml

variables:
  - name: system.debug 
    value: true

pool: custom_vmss

steps:
- bash: echo "what is good"
- bash: echo "hi" > '$(System.DefaultWorkingDirectory)/hi.txt'

Layers/ztest/Pipelines/Pipeline.yaml looks like

name: layer-ztest-$(Date:yyyyMMdd).$(Rev:rr)

trigger:
  branches:
    include:
    - users/*
  paths:
    include:
      - /layers/ztest
      - /scripts
    exclude: 
      - /**/*.md
      - /.attachments

variables:
  - name: system.debug 
    value: true

pool: custom_vmss

resources:
  pipelines:
  - pipeline: main
    source: manual-version-layers
    trigger:
      branches:
        include:
          - refs/heads/master   
          - refs/heads/users/*

steps:
- bash: echo "runId [$(resources.pipeline.main.runID)]"
- task: DownloadPipelineArtifact@2
  displayName: 'Download Pipeline Artifact'
  condition: succeeded()
  inputs:
    source: specific
    runVersion: latestFromBranch
    runBranch: refs/heads/users/joreynes/179828
    project: 'ATT Cloud'   
    pipeline: 430
    preferTriggeringPipeline: true
    buildVersionToDownload: 'specific'
    runId:  $(resources.pipeline.main.runID)
    path: $(Build.ArtifactStagingDirectory)
mozts2005 commented 4 years ago

@jontreynes You may want to try adding quotes to your branch paths as is noted in issue #478

https://github.com/microsoft/azure-pipelines-yaml/issues/478#issuecomment-615417243 Hope this helps.

stale[bot] commented 4 years ago

In order to consolidate to fewer feedback channels, we've moved suggestions and issue reporting to Developer Community. Sorry for any confusion resulting from this move.