Skip to content

Commit e9a6916

Browse files
authored
Update trigger pipeline to use YAML resources (#10701)
1 parent a6dfc8c commit e9a6916

1 file changed

Lines changed: 30 additions & 21 deletions

File tree

.pipelines/Release-trigger.yml

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ parameters:
1212
- name: TargetPipelines
1313
type: object
1414
default:
15-
- id: 21120 # gallery web app
16-
paramName: NuGetGallerySubmoduleBranch
17-
- id: 21280 # gallery packages
18-
paramName: Branch
19-
- id: 21128 # jobs
20-
paramName: Branch
21-
- id: 21269 # common
22-
paramName: Branch
15+
- id: 21120
16+
name: Gallery Web App
17+
- id: 21280
18+
name: Gallery Packages
19+
- id: 21128
20+
name: Jobs
21+
- id: 21269
22+
name: Common
2323

2424
variables:
2525
- name: NugetMultifeedWarnLevel
@@ -28,16 +28,25 @@ variables:
2828
pool:
2929
vmImage: 'windows-latest'
3030

31-
steps:
32-
- ${{ each pipeline in parameters.TargetPipelines }}:
33-
- powershell: |-
34-
$body = @{
35-
"templateParameters" = @{
36-
"${{ pipeline.paramName }}" = "$(Build.SourceBranchName)"
37-
}
38-
}
39-
$headers = @{ "Authorization" = "Bearer $env:ACCESS_TOKEN" };
40-
$url = "$(System.CollectionUri)$(System.TeamProject)/_apis/pipelines/${{ pipeline.id }}/runs?api-version=7.0"
41-
Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body ($body | ConvertTo-Json) -ContentType "application/json"
42-
env:
43-
ACCESS_TOKEN: $(System.AccessToken)
31+
stages:
32+
- stage: Trigger
33+
displayName: "Trigger"
34+
jobs:
35+
- job: TriggerTargetPipelines
36+
displayName: "Trigger target pipelines"
37+
steps:
38+
- ${{ each pipeline in parameters.TargetPipelines }}:
39+
- powershell: |
40+
$body = @{
41+
resources = @{
42+
repositories = @{
43+
"NuGetGallery" = @{
44+
refName = "$(Build.SourceBranch)"
45+
}
46+
}
47+
}
48+
}
49+
$headers = @{ "Authorization" = "Bearer $(System.AccessToken)" };
50+
$url = "$(System.CollectionUri)$(System.TeamProject)/_apis/pipelines/${{ pipeline.id }}/runs?api-version=7.1"
51+
Invoke-RestMethod -Uri $url -Method POST -Headers $headers -Body ($body | ConvertTo-Json -Depth 10) -ContentType "application/json"
52+
displayName: "Trigger ${{ pipeline.name }}"

0 commit comments

Comments
 (0)