Skip to content

Commit da209ed

Browse files
committed
touchups
1 parent c5463fe commit da209ed

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

docs/pipelines/process/resources.md

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
---
22
title: Resources in YAML pipelines
3-
description: Learn about defining and consuming YAML resources that you can use anywhere in your pipelines, or to trigger pipeline automation.
3+
description: Learn about defining YAML resources that you can consume in your pipelines and using them to download artifacts, call variables, or trigger pipeline automation.
44
ms.topic: conceptual
55
ms.assetid: b3ca305c-b587-4cb2-8ac5-52f6bd46c25e
66
ms.date: 08/04/2025
77
monikerRange: "<=azure-devops"
8+
#customer intent: As an Azure Pipelines user, I want to know about defining and consuming resources in YAML pipelines so I can use the resources to access artifacts and automate workflows.
89
---
910

1011
# Resources in YAML pipelines
@@ -15,7 +16,7 @@ This article discusses resources for YAML pipelines. A resource is anything a pi
1516

1617
After you define a resource, you can consume it anywhere in your pipeline. For more information and examples, see [Resource definitions](#resource-definitions).
1718

18-
You can use resource status to automatically [trigger](#triggers) pipelines by setting the `trigger` property in the resource definition. When a resource triggers a pipeline run, the pipeline `resources.triggeringAlias` and `resources.triggeringCategory` variables are set to the resource name and category. These variables are empty unless the `Build.Reason` variable is set to `ResourceTrigger`.
19+
You can use resource status to automatically [trigger](#triggers) pipelines by setting the `trigger` property in the resource definition. The pipeline `resources.triggeringAlias` and `resources.triggeringCategory` variables are then set to the resource name and category. These variables are empty unless the `Build.Reason` variable is set to `ResourceTrigger`.
1920

2021
Resources allow full [traceability](#traceability) for the services a pipeline uses, including version, artifacts, associated commits, and work items. If you subscribe to trigger events on your resources, you can fully automate your DevOps workflows.
2122

@@ -25,7 +26,7 @@ Resources allow full [traceability](#traceability) for the services a pipeline u
2526

2627
Resources must be authorized to be used in YAML pipelines. Resource owners control the users and pipelines that can access their resources. There are several ways to authorize a YAML pipeline to use resources.
2728

28-
- You can use the resource's administration settings to **Grant access permissions to all pipelines**. For example, you can manage secure files and variable groups on the **Pipelines** > **Library** page, and agent pools and service connections in **Project settings** > **Pipelines**. This authorization is convenient for resources you don't need to restrict, such as test resources.
29+
- Use the resource's administration settings to **Grant access permissions to all pipelines**. For example, you can manage secure files and variable groups on the **Pipelines** > **Library** page, and agent pools and service connections in **Project settings** > **Pipelines**. This authorization is convenient for resources you don't need to restrict, such as test resources.
2930

3031
- Make sure you have at least **User** role in the [agent pool security roles](../../organizations/security/about-security-roles.md#agent-pool-security-roles-project-level) for your project. YAML pipelines you create are automatically authorized to use resources where you have **User** role.
3132

@@ -39,11 +40,13 @@ Setting a [required template](../security/templates.md#set-required-templates) a
3940

4041
## Manual resource version picker
4142

42-
Azure Pipelines automatically evaluates the default versions for resources based on their resource definitions. For scheduled runs, or manual runs if you don't manually choose a different run, Azure Pipelines considers only successfully completed continuous integration (CI) runs to evaluate default resource versions.
43+
Azure Pipelines evaluates the default versions for resources based on their resource definitions. For scheduled runs, or manual runs if you don't manually choose a run, Azure Pipelines considers only successfully completed continuous integration (CI) runs to evaluate default resource versions.
4344

4445
You can use the manual resource version picker to choose different resource versions when you manually trigger a YAML continuous deployment (CD) pipeline. The resource version picker is supported for pipeline, build, repository, container, and package resources.
4546

46-
For `pipeline` resources, the manual version picker lets you see all available runs across all branches, search the runs based on the pipeline number or branch, and pick a run that's successful, failed, or in progress. You don't need to wait for a CI run to complete, or rerun it because of an unrelated failure, before you can run your CD pipeline. You have the flexibility to choose any run that you know produced the artifacts you need.
47+
For `pipeline` resources, the manual version picker lets you see all available runs across all branches, search the runs based on the pipeline number or branch, and pick a run that's successful, failed, or in progress.
48+
49+
You don't need to wait for a CI run to complete, or rerun it because of an unrelated failure, before you can run your CD pipeline. You have the flexibility to choose any run that you know produced the artifacts you need.
4750

4851
To use the resource version picker, select **Resources** in the **Run pipeline** pane, select a resource, and pick a specific version from the list of available versions. For resources where you can't fetch available versions, like GitHub packages, you can enter your desired version in the text field.
4952

@@ -60,12 +63,12 @@ YAML pipeline resources can be:
6063
- [Repositories](#repositories-resource), or
6164
- [Webhooks](#webhooks-resource).
6265

63-
The following sections provide information and examples for the Azure Pipelines resource categories. For complete schema information, see the [resources](/azure/devops/pipelines/yaml-schema/resources) definition in the [YAML schema reference for Azure Pipelines](/azure/devops/pipelines/yaml-schema).
66+
The following sections provide definitions and examples of the YAML pipeline resource categories. For complete schema information, see the [resources](/azure/devops/pipelines/yaml-schema/resources) definition in the [YAML schema reference for Azure Pipelines](/azure/devops/pipelines/yaml-schema).
6467

6568
<a name="define-a-pipelines-resource"></a>
6669
### Pipelines resource
6770

68-
You can use CI `pipeline` resources as [triggers](#triggers) for your CD workflows. You can also use the `pipeline` label to reference the pipeline resource from other parts of your pipeline, such as to [download artifacts](#pipeline-artifact-download) or [use pipeline resource variables](#pipeline-resource-variables). Only Azure Pipelines can use the `pipelines` resource.
71+
You can use CI `pipeline` resources as [triggers](#triggers) for your CD workflows. You can also reference `pipeline` resources from your pipeline to [download artifacts](#pipeline-artifact-download) or [use pipeline resource variables](#pipeline-resource-variables). Only Azure Pipelines can use the `pipelines` resource.
6972

7073
In the `pipelines` resource definition:
7174
- `pipeline` is a unique name you use to reference the pipeline resources.
@@ -578,7 +581,9 @@ You can use Azure Pipelines pipeline, container, build, and package resources to
578581

579582
The `webhooks` resource in YAML pipelines lets you integrate your pipelines with external services like GitHub, GitHub Enterprise, Nexus, and Artifactory to automate workflows. For on-premises services where Azure DevOps doesn't have visibility into the process, you can configure webhooks on the service to trigger your pipelines automatically.
580583

581-
To subscribe to a webhook event, you define a `webhook` resource in your pipeline and specify an incoming webhook service connection. The following example defines and calls a webhook resource:
584+
To subscribe to a webhook event, you define a `webhook` resource in your pipeline and specify an incoming webhook service connection. For complete schema information, see the [resources.webhooks.webhook](/azure/devops/pipelines/yaml-schema/resources-webhooks-webhook) definition.
585+
586+
You can consume the JSON payload data as variables in your jobs by using the format `${{ parameters.<WebhookAlias>.<JSONPath>}}`. The following example defines and then calls a webhook resource:
582587

583588
```yaml
584589
resources:
@@ -590,9 +595,29 @@ steps:
590595
- script: echo ${{ parameters.myWebHookResource.resource.message.title }}
591596
```
592597

593-
For complete schema information, see the [resources.webhooks.webhook](/azure/devops/pipelines/yaml-schema/resources-webhooks-webhook) definition.
598+
You can define filters on the webhook resource based on the JSON payload data to customize triggers for each pipeline. Whenever the incoming webhook service connection receives a webhook event, a new run triggers for all the pipelines subscribed to that webhook event.
599+
600+
The following example uses webhook filters.
594601

595-
You can consume the JSON payload data as variables in your jobs by using the format `${{ parameters.<WebhookAlias>.<JSONPath>}}`. You can define filters on the webhook resource based on the JSON payload data to customize triggers for each pipeline. Whenever the incoming webhook service connection receives a webhook event, a new run triggers for all the pipelines subscribed to that webhook event.
602+
```yml
603+
resources:
604+
webhooks:
605+
- webhook: MyWebhookTrigger
606+
connection: MyWebhookConnection
607+
filters:
608+
- path: repositoryName
609+
value: maven-releases
610+
- path: action
611+
value: CREATED
612+
613+
steps:
614+
- task: PowerShell@2
615+
inputs:
616+
targetType: 'inline'
617+
script: |
618+
Write-Host ${{ parameters.MyWebhookTrigger.repositoryName}}
619+
Write-Host ${{ parameters.MyWebhookTrigger.component.group}}
620+
```
596621

597622
#### Webhook trigger configuration
598623

@@ -625,28 +650,6 @@ To trigger your pipeline using a webhook, you make a `POST` request to `https://
625650
>[!NOTE]
626651
>Accessing data from the webhook's request body can lead to incorrect YAML. For example, the pipeline step `- script: echo ${{ parameters.WebHook.resource.message }}` pulls in the entire JSON message, which generates invalid YAML. Any pipeline triggered via this webhook doesn't run, because the generated YAML is invalid.
627652

628-
The following example uses webhook filters.
629-
630-
```yml
631-
resources:
632-
webhooks:
633-
- webhook: MyWebhookTrigger
634-
connection: MyWebhookConnection
635-
filters:
636-
- path: repositoryName
637-
value: maven-releases
638-
- path: action
639-
value: CREATED
640-
641-
steps:
642-
- task: PowerShell@2
643-
inputs:
644-
targetType: 'inline'
645-
script: |
646-
Write-Host ${{ parameters.MyWebhookTrigger.repositoryName}}
647-
Write-Host ${{ parameters.MyWebhookTrigger.component.group}}
648-
```
649-
650653
::: moniker-end
651654

652655
## Traceability

0 commit comments

Comments
 (0)