cResults
cResults

Reputation: 803

For Azure DevOps "pipelines" resource, what is the intended use and set-up of "resources: pipelines: pipeline: tags:"?

We are trying to figure out what is the intended use/behavior/set-up of tags defined in the Azure DepOs docs Define a pipelines resource.

We have a build pipeline that has the following task at the very end, adding the Deployable-Artifact tag to builds that produce an artifact.

- script: echo "##vso[build.addbuildtag]Deployable-Artifact"
  condition: and(succeeded(), not(in(variables['Build.Reason'], 'PullRequest', 'Schedule')))

We are in the process of converting our classic build and releases to pipelines, so when we read the docs

tags: [ string ] # list of tags required on the pipeline to pickup default artifacts, optional; Used only for manual or scheduled triggers

and then configure our release pipeline as follows:

trigger: none
pr: none
resources:
  pipelines:
  - pipeline: API-Deployment 
    source: API-Build
    tags: 
    - Deployable-Artifact   
    trigger: 
      branches:
        include: 
        - refs/heads/main

we are expecting it to filter the builds available to the release resources similar to what we were able to do with build tags in classic releases. However, as per our condition above, we are not expecting to see any PR builds or failed builds in the following Resources selector ui for manually triggering the releases, but they are there

enter image description here

The answer found here suggests that "resources: pipelines: pipeline: tags:" should be a build tag while "resources: pipelines: pipeline: trigger: tags:" should be a repo tag. If this is true, it would be very helpful to indicate that in the documentation.

What behavior should we expect when adding a build tag to "resources: pipelines: pipeline: tags:"?

Upvotes: 2

Views: 2441

Answers (1)

Jane Ma-MSFT
Jane Ma-MSFT

Reputation: 5242

What behavior should we expect when adding a build tag to "resources: pipelines: pipeline: tags:"?

If a pipeline is triggered by another pipeline, then, of course, it will choose the build that triggers it as its resource.

If a pipeline is triggered manually or scheduled:

  1. The pipeline will choose the latest build as its resource if tag is not set.
  2. The pipeline will choose the latest build that meets tag as its resource if tag is set.

Upvotes: 0

Related Questions