From 2df008a1061edafafca8ddc461d7c133838480ef Mon Sep 17 00:00:00 2001 From: Manuel de la Pena Date: Tue, 7 May 2024 11:55:38 -0400 Subject: [PATCH] [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 --- .../devops/automation/templates/mac/build.yml | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/tools/devops/automation/templates/mac/build.yml b/tools/devops/automation/templates/mac/build.yml index 1c9d14ad22..3d94e49491 100644 --- a/tools/devops/automation/templates/mac/build.yml +++ b/tools/devops/automation/templates/mac/build.yml @@ -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)// + - 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