From b209de3d277aeae228cc4523c83846fe8c3bad5c Mon Sep 17 00:00:00 2001 From: Ben Broderick Phillips Date: Mon, 4 Mar 2024 16:24:13 -0500 Subject: [PATCH] Use single publish task for publish artifact --- .../templates/steps/publish-1es-artifact.yml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/eng/common/pipelines/templates/steps/publish-1es-artifact.yml b/eng/common/pipelines/templates/steps/publish-1es-artifact.yml index ce8421c4b3a..b06b2d0e444 100644 --- a/eng/common/pipelines/templates/steps/publish-1es-artifact.yml +++ b/eng/common/pipelines/templates/steps/publish-1es-artifact.yml @@ -10,19 +10,21 @@ parameters: ArtifactName: '' ArtifactPath: '' CustomCondition: true - DisplayName: 'Publish Artifacts' steps: - - task: 1ES.PublishPipelineArtifact@1 + - pwsh: | + Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}" condition: and(succeeded(), ${{ parameters.CustomCondition }}) - displayName: '${{ parameters.DisplayName }} - ${{ parameters.ArtifactName }}' - inputs: - artifact: '${{ parameters.ArtifactName }}' - path: '${{ parameters.ArtifactPath }}' + displayName: Set Artifact Name - - task: 1ES.PublishPipelineArtifact@1 + - pwsh: | + Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)" condition: and(failed(), ${{ parameters.CustomCondition }}) - displayName: 'Failed - ${{ parameters.DisplayName }} - ${{ parameters.ArtifactName }}' + displayName: Set Failed Artifact Name + + - task: 1ES.PublishPipelineArtifact@1 + condition: and(succeeded(), ${{ parameters.CustomCondition }}) + displayName: 'Publish ${{ parameters.ArtifactName }} Artifacts' inputs: - artifact: '${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)' + artifact: '$(PublishArtifactName)' path: '${{ parameters.ArtifactPath }}'