[CI] Fix mac tests on post build pipeline (#20543)
To be able to download a artifact from a build that triggered the post build pipeline we cannot use the DownloadPipelineArtifact task with the same values since the artifact wont be found. This change adds an if statement to do the right thing based on the trigger so that we can have both pipelines running correctly until we remove the tests from the build. --------- Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This commit is contained in:
Родитель
6d137cbeb2
Коммит
2df008a106
|
@ -137,13 +137,30 @@ steps:
|
|||
displayName: 'Remove Provisionator Tool Cache'
|
||||
condition: ${{ parameters.clearProvisionatorCache }}
|
||||
|
||||
# Go get the tests!
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download Mac tests
|
||||
inputs:
|
||||
# Go get the tests!, this depends on how the test was triggered
|
||||
- ${{ if or(contains(variables['Build.Reason'], 'ResourceTrigger'), contains(variables['Build.Reason'], 'BuildCompletion')) }}:
|
||||
- download: macios
|
||||
artifact: mac-test-package
|
||||
displayName: Download Mac tests
|
||||
patterns: '**/mac-test-package.7z'
|
||||
allowFailedBuilds: true
|
||||
path: $(Build.SourcesDirectory)/artifacts/tmp
|
||||
|
||||
# the default location when downloading is $(Pipeline.Workspace)/<pipeline resource identifier>/<artifact name>
|
||||
- pwsh: |
|
||||
$source = "$(Pipeline.Workspace)/macios/mac-test-package"
|
||||
$destination = "$(Build.SourcesDirectory)/artifacts/tmp/mac-test-package"
|
||||
New-Item -ItemType Directory -Force -Path $destination
|
||||
Write-Host "Moving content from $source to $destination"
|
||||
# move all the files from the source to the destination
|
||||
Get-ChildItem -Path $source -Recurse -File | Move-Item -Destination $destination
|
||||
displayName: Move artifacts to the expected location
|
||||
|
||||
- ${{ else }}:
|
||||
- task: DownloadPipelineArtifact@2
|
||||
displayName: Download Mac tests
|
||||
inputs:
|
||||
patterns: '**/mac-test-package.7z'
|
||||
allowFailedBuilds: true
|
||||
path: $(Build.SourcesDirectory)/artifacts/tmp
|
||||
|
||||
- bash: |
|
||||
set -ex
|
||||
|
|
Загрузка…
Ссылка в новой задаче