Search code examples
azure-devopsazure-pipelinesazure-pipelines-yamlazure-container-registry

Unable to create ACR container resource trigger


Having trouble setting up a pipeline that is triggered by pushing an image to an ACR repository. No matter how i try to define a trigger i always get the error:

Configuring the trigger failed, edit and save the pipeline again

As far as i can tell there's no more details as to what the problem is. Saving without a trigger entry seams fine.

Here's my pipeline:

trigger:
- none

resources:
  containers:
  - container: 'MyContainer'
    type: ACR
    azureSubscription: 'My-ServicePrincipal'
    resourceGroup: 'My-App-Development'
    registry: 'myappregistry.azurecr.io'
    repository: 'myrepository'
    image: 'myrepository' 
    trigger: 
      enabled: true
      tags:
        include: 
        - latest

pool:
  vmImage: ubuntu-latest

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

Solution

  • I attempt in my YAML pipeline with the same configurations like as yours, and get the same issue.

    However, after I changed the configurations like as below, the issue disappeared, and the trigger can work well as expected.

    trigger: none
    
    resources:
      containers:
      - container: MyACR
        type: ACR
        azureSubscription: {name of ARM connection}
        resourceGroup: {name of resource group}
        registry: {name of ACR}
        repository: {name of repository}
        image: {name of image}
        trigger:
          enabled: true
          tags:
            include:
            - latest
    . . .
    

    OR

    trigger: none
    
    resources:
      containers:
      - container: MyACR
        type: ACR
        azureSubscription: {name of ARM connection}
        resourceGroup: {name of resource group}
        registry: {name of ACR}
        repository: {name of repository}
        trigger:
          tags:
            include:
            - latest
    . . .