5
5
# ArtifactName - The name of the artifact in the "successful" case.
6
6
# ArtifactPath - The path we will be publishing.
7
7
# CustomCondition - Used if there is additional logic necessary to prevent attempt of publish.
8
+ # SbomEnabled - Set whether to auto-inject 1es pipeline template sbom tasks
8
9
9
10
parameters :
10
11
ArtifactName : ' '
11
12
ArtifactPath : ' '
12
13
CustomCondition : true
14
+ SbomEnabled : true
13
15
14
16
steps :
15
17
- pwsh : |
16
- Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}"
17
- condition: and(succeeded(), ${{ parameters.CustomCondition }})
18
- displayName: Set Artifact Name
19
-
20
- - pwsh : |
21
- Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)"
22
- condition: and(failed(), ${{ parameters.CustomCondition }})
23
- displayName: Set Failed Artifact Name
24
-
18
+ if ($env:AGENT_JOBSTATUS -eq "Failed") {
19
+ Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}-FailedAttempt$(System.JobAttempt)"
20
+ } else {
21
+ Write-Host "##vso[task.setvariable variable=PublishArtifactName;]${{ parameters.ArtifactName }}"
22
+ }
23
+ condition: and(succeededOrFailed(), ${{ parameters.CustomCondition }})
24
+ displayName: Set Artifact Name $(Agent.JobStatus)
25
25
- task : 1ES.PublishPipelineArtifact@1
26
- condition : and(succeeded (), ${{ parameters.CustomCondition }})
26
+ condition : and(succeededOrFailed (), ${{ parameters.CustomCondition }})
27
27
displayName : ' Publish ${{ parameters.ArtifactName }} Artifacts'
28
28
inputs :
29
- artifact : ' $(PublishArtifactName)'
30
- path : ' ${{ parameters.ArtifactPath }}'
29
+ artifactName : ' $(PublishArtifactName)'
30
+ targetPath : ' ${{ parameters.ArtifactPath }}'
31
+ sbomEnabled : ${{ parameters.SbomEnabled }}
0 commit comments