-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathpublish-artifact.yml
More file actions
28 lines (24 loc) · 1.31 KB
/
publish-artifact.yml
File metadata and controls
28 lines (24 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# This step is used to prevent duplication of artifact publishes when there is an issue that would prevent the overall success of the job.
# Ensuring that we only publish when successful (and two a differently named artifact otherwise) will allow easy retry on a build pipeline
# without running into the "cannot override artifact" failure when we finally do get a passing run.
# ArtifactName - The name of the artifact in the "successful" case.
# ArtifactPath - The path we will be publishing.
# CustomCondition - Used if there is additional logic necessary to prevent attempt of publish.
parameters:
ArtifactName: ''
ArtifactPath: ''
CustomCondition: true
DisplayName: 'Publish Artifacts'
steps:
- task: 1ES.PublishPipelineArtifact@1
condition: and(succeeded(), ${{ parameters.CustomCondition }})
displayName: '${{ parameters.DisplayName }} - ${{ parameters.ArtifactName }}'
inputs:
artifact: '${{ parameters.ArtifactName }}'
path: '${{ parameters.ArtifactPath }}'
- task: 1ES.PublishPipelineArtifact@1
condition: and(failed(), ${{ parameters.CustomCondition }})
displayName: 'Failed - ${{ parameters.DisplayName }} - ${{ parameters.ArtifactName }}'
inputs:
artifact: '${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)'
path: '${{ parameters.ArtifactPath }}'