2
votes

Using Azure Devops YAML Pipelines and trying to have a pipeline trigger on a container being pushed to an ACR.

According to the documentation in the link below, I should be able to access the tag and other information related to the image using variables like RESOURCES_CONTAINER_IDENTIFIER_TAG that should be available.

https://docs.microsoft.com/en-us/azure/devops/pipelines/process/resources?view=azure-devops&tabs=schema

However, I see no trace of variables from Containers or Repositories. It works fine with Pipelines and I haven't tested Builds. To be clear, the pipeline is triggered fine but inside the pipeline I cannot see which tag triggered it.

So is there something special that needs to be done here or is it released in the documentation but not working yet?

1
Hi, please run command env | sort in bash task and then check whether the RESOURCES_CONTAINER_IDENTIFIER_TAG variable exists there.LoLance
Already did that. It exists for pipeline resources but not for repo nor containers.Mats Iremark
Hi Mats, sorry for the delay. As I know the resources.container.<Alias>.tag should work after Sprint 159. Normally we're in Sprint 164, so it should work for your situation. If you specify the repository like repository : xxx/xxx:v1-tag, the resources.container.xxx.tag will output v1-tag and if you use something like repository : xxx/xxx, the resources.container.xxx.tag will output the latest tag. Can you share more details about how you define the yaml and how you design the test?LoLance
Hi friend, is there any update for this issue? If it persists, could you please share the info about your yaml and corresponding log.LoLance
I did get a response from the Azure Devops team that this feature indeed was not yet implemented, even though the docs say so. They adviced me to post a feature request which I did. Hope it will be implemented soon. :)Mats Iremark

1 Answers

2
votes

Just as the document states:

resources.container.<Alias>.tag is what you want and it should work because this feature is supported since Sprint 159. (Now it's Sprint 164.)

Sample yaml:

resources:
  containers:
  - container: ACRResource1
    type: ACR
    azureSubscription: ARM
    resourceGroup: xxx
    registry: xxx
    repository: xxx/docker-acr:v1-tag
  - container: ACRResource2
    type: ACR
    azureSubscription: ARM
    resourceGroup: xxx
    registry: xxx
    repository: xxx/docker-acr

Sample output:

resources.container.ACRResource1.tag = v1-tag
resources.container.ACRResource2.tag = v10-tag  (latest tag value)

Make sure you configured the yaml and settings well and created valid service connections.