Skip to content

Commit 39a6517

Browse files
azure-sdkbenbp
andauthored
Sync eng/common directory with azure-sdk-tools for PR 7810 (#34633)
* Run publish on failed or succeeded * Expand agent os string detection * Check agent job status env var for artifact name detection * Add sbomEnabled flag to publish template * Fix image and artifact name conditional --------- Co-authored-by: Ben Broderick Phillips <[email protected]>
1 parent 97c01e0 commit 39a6517

File tree

3 files changed

+16
-14
lines changed

3 files changed

+16
-14
lines changed

eng/common/pipelines/templates/jobs/generate-job-matrix.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
value: $[ coalesce(variables.jobMatrixFilter, '.*') ]
6767
pool:
6868
name: ${{ parameters.Pool }}
69-
vmImage: ${{ parameters.OsVmImage }}
69+
image: ${{ parameters.OsVmImage }}
7070
os: ${{ parameters.Os }}
7171
${{ if parameters.DependsOn }}:
7272
dependsOn: ${{ parameters.DependsOn }}

eng/common/pipelines/templates/steps/publish-1es-artifact.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,28 @@
55
# ArtifactName - The name of the artifact in the "successful" case.
66
# ArtifactPath - The path we will be publishing.
77
# 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
89

910
parameters:
1011
ArtifactName: ''
1112
ArtifactPath: ''
1213
CustomCondition: true
14+
SbomEnabled: true
1315

1416
steps:
1517
- 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
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)
2425
2526
- task: 1ES.PublishPipelineArtifact@1
26-
condition: and(succeeded(), ${{ parameters.CustomCondition }})
27+
condition: and(succeededOrFailed(), ${{ parameters.CustomCondition }})
2728
displayName: 'Publish ${{ parameters.ArtifactName }} Artifacts'
2829
inputs:
29-
artifact: '$(PublishArtifactName)'
30-
path: '${{ parameters.ArtifactPath }}'
30+
artifactName: '$(PublishArtifactName)'
31+
targetPath: '${{ parameters.ArtifactPath }}'
32+
sbomEnabled: ${{ parameters.SbomEnabled }}

eng/common/scripts/Verify-AgentOS.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ function Throw-InvalidOperatingSystem {
1010

1111
if ($IsWindows -and $AgentImage -match "windows|win|MMS\d{4}") {
1212
$osName = "Windows"
13-
} elseif ($IsLinux -and $AgentImage -match "ubuntu") {
13+
} elseif ($IsLinux -and $AgentImage -match "ubuntu|linux") {
1414
$osName = "Linux"
15-
} elseif ($IsMacOs -and $AgentImage -match "macos") {
15+
} elseif ($IsMacOs -and $AgentImage -match "macos|macOS") {
1616
$osName = "macOS"
1717
} else {
1818
Throw-InvalidOperatingSystem

0 commit comments

Comments
 (0)