Skip to content

Commit

Permalink
[ci] Fix variable names for release triggering build (dotnet#6887)
Browse files Browse the repository at this point in the history
Context: https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/resources-pipelines-pipeline?view=azure-pipelines#the-pipeline-resource-metadata-as-predefined-variables

Commit 7982895 added a new pipeline that can be used to trigger release
definitions, however the automatic trigger was not fully testable until
after it was merged.

Update the new pipeline to use the correct variable names that are set
when it is automatically triggered by the Xamarin.Android pipeline.
  • Loading branch information
pjcollins authored and jonpryor committed May 23, 2022
1 parent b6fe6eb commit fafdba7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions build-tools/automation/azure-pipelines-release-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,22 @@ jobs:
steps:
- checkout: none

- powershell: 'gci env: | format-table -autosize -wrap'
displayName: print environment variables

- powershell: |
$triggeringBuild = @{
"triggeringBuild" = @{
"id" = "$(Build.TriggeredBy.BuildId)"
"pipeline" = "$(Build.TriggeredBy.DefinitionId)"
"project" = "$(Build.TriggeredBy.ProjectID)"
"id" = "$(resources.pipeline.xamarin-android.runID)"
"pipeline" = "$(resources.pipeline.xamarin-android.pipelineID)"
"branch" = "$(resources.pipeline.xamarin-android.sourceBranch)"
"commit" = "$(resources.pipeline.xamarin-android.sourceCommit)"
}
}
$json = $triggeringBuild | ConvertTo-Json
New-Item -Path $(Build.StagingDirectory) -Name triggering-build.json -ItemType file -Value $json -Force
$jsonContent = Get-Content "$(Build.StagingDirectory)\triggering-build.json" | ConvertFrom-Json
Write-Host Triggering Build Info: $jsonContent.triggeringBuild.project - $jsonContent.triggeringBuild.pipeline - $jsonContent.triggeringBuild.id
Write-Host Triggering Pipeline and Run IDs: $jsonContent.triggeringBuild.pipeline - $jsonContent.triggeringBuild.id
displayName: write triggering-build.json
- task: PublishPipelineArtifact@1
Expand Down

0 comments on commit fafdba7

Please sign in to comment.