0

I have a pipeline which I want to trigger when PR is merged into master. I have tried different things, but this did not work. Furthermore, I am neither getting any error nor pipeline is triggering.

I do not want this to be triggered on PR creation. I want this to be triggered when PR is merged into master. That is the reason I have not added pr in my yml.

What am I missing here?

Approaches:

  • Enabled "Continuous Integration" option enter image description here
  • Following trigger syntax per Microsoft recommendation
trigger:
  batch: True
  branches:
    include:
    - master
  paths:
    include:
    - cosmos
  • Setting up valid YML file enter image description here

Pipeline:

# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
  batch: True
  branches:
    include:
    - master
  paths:
    include:
    - cosmos
stages:
  - stage: SOME_PATH_dev
    displayName: SOME_PATH_dev
    jobs:
      - deployment: 'DeployToDev'
        environment: Dev
        cancelTimeoutInMinutes: 1
        pool:
          vmImage: ubuntu-latest
        strategy:
          runOnce:
            deploy:
              steps:
                - checkout: self 
                - task: AzureResourceGroupDeployment@2
                  displayName: Azure Deployment:Create Or Update Resource Group action on SOME_PATH_dev
                  inputs:
                    ConnectedServiceName: SOME_KEY
                    resourceGroupName: SOME_PATH_dev
                    location: West US
                    csmFile: cosmos/deploy.json
                    csmParametersFile: cosmos/parameters-dev.json
                    deploymentName: SOME_PATH.Cosmos.DEV

Repo Structure:

enter image description here

References:

GThree
  • 2,708
  • 7
  • 34
  • 67
  • 1
    *That is the reason I have not added pr in my yml.*. Note that the `pr` section in YAML is for **GitHub**, not Azure Pipelines. It wouldn't do anything in Azure Pipelines. – Daniel Mann Jul 27 '22 at 21:52
  • Does the pipeline work when you trigger it manually? Did you confirm there are no syntax errors? – Daniel Mann Jul 27 '22 at 21:53
  • @DanielMann Yes for both. – GThree Jul 27 '22 at 21:59
  • @DanielMann found the solution. I was updating YML files and expecting trigger. I needed to change any file(s) in `cosmos` folder to trigger the pipelines. – GThree Jul 28 '22 at 20:46

1 Answers1

0

I was changing YML (pipeline) files instead of files inside cosmos folder and expecting trigger.

GThree
  • 2,708
  • 7
  • 34
  • 67