Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 14c6a6c

Browse files
authored
Fix SBOM and release pipeline (#27)
* fix release yaml * fix stage name * fix yaml dependency * fix pool name * change pool name back * add dotnet install task * fix build to use proper outpath * update cert * fix out path * put signed bits in different folder * use different cert * fix signedzip location * change cert * fix test
1 parent 3e92cc1 commit 14c6a6c

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

build.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ param (
1515
try {
1616
Push-Location "$PSScriptRoot/src/code"
1717

18-
$outPath = "$PSScriptRoot/out"
18+
$outPath = "$PSScriptRoot/out/Microsoft.PowerShell.TextUtility"
1919

2020
if ($Clean) {
2121
if (Test-Path $outPath) {
@@ -26,7 +26,7 @@ try {
2626
dotnet clean
2727
}
2828

29-
dotnet publish --output "$PSScriptRoot/out" --configuration $Configuration
29+
dotnet publish --output $outPath --configuration $Configuration
3030
}
3131
finally {
3232
Pop-Location

yaml/releaseBuild.yml

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resources:
3939
name: PowerShell/compliance
4040

4141
stages:
42-
- stage: Build and Sign
42+
- stage: BuildAndSign
4343
displayName: Build and Sign
4444
jobs:
4545
- job: 'BuildAndSign'
@@ -51,15 +51,21 @@ stages:
5151
demands:
5252
- ImageOverride -equals PSMMS2019-Secure
5353
steps:
54+
- task: UseDotNet@2
55+
displayName: 'Use .NET Core sdk'
56+
inputs:
57+
packageType: sdk
58+
includePreviewVersions: true
59+
version: 6.x
5460
- powershell: |
5561
Get-ChildItem -Path env:
5662
displayName: Capture environment
5763
condition: succeededOrFailed()
58-
steps:
5964
- pwsh: |
6065
# build agents get reused so we make sure to remove the old archive
6166
Remove-Item -Path $(Build.SourcesDirectory)/SignedZip -Recurse -Force -ErrorAction Ignore
62-
Remove-Item -Path $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility -Recurse -Force -ErrorAction Ignore
67+
Remove-Item -Path $(Build.SourcesDirectory)/out -Recurse -Force -ErrorAction Ignore
68+
Remove-Item -Path $(Build.SourcesDirectory)/signed -Recurse -Force -ErrorAction Ignore
6369
.\build.ps1 -Clean
6470
Remove-Item .\out\*.pdb
6571
$packageVersion = (Import-PowerShellDataFile $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility/Microsoft.PowerShell.TextUtility.psd1).ModuleVersion
@@ -75,9 +81,9 @@ stages:
7581
# the folder which contains the binaries to sign
7682
buildOutputPath: $(Build.SourcesDirectory)/out
7783
# the location to put the signed output
78-
signOutputPath: $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility
84+
signOutputPath: $(Build.SourcesDirectory)/signed/Microsoft.PowerShell.TextUtility
7985
# the certificate ID to use
80-
certificateId: "CP-230012"
86+
certificateId: "CP-460906"
8187
# The file pattern to use
8288
# If not using minimatch: comma separated, with * supported
8389
# If using minimatch: newline separated, with !, **, and * supported.
@@ -89,30 +95,30 @@ stages:
8995

9096
- template: Sbom.yml@ComplianceRepo
9197
parameters:
92-
BuildDropPath: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility
98+
BuildDropPath: $(Build.SourcesDirectory)/signed/Microsoft.PowerShell.TextUtility
9399
Build_Repository_Uri: 'https://github.com/powershell/textutility'
94100
PackageName: 'Microsoft.PowerShell.TextUtility'
95101
PackageVersion: $(PackageVersion)
96102

97103
- pwsh: |
98-
New-Item -Path $(Build.SourcesDirectory)/out/SignedZip -ItemType Directory -ErrorAction Ignore
99-
Compress-Archive -Path $(Build.SourcesDirectory)/Microsoft.PowerShell.TextUtility -DestinationPath $(Build.SourcesDirectory)/out/SignedZip/Microsoft.PowerShell.TextUtility.zip -Force
104+
New-Item -Path $(Build.SourcesDirectory)/SignedZip -ItemType Directory -ErrorAction Ignore
105+
Compress-Archive -Path $(Build.SourcesDirectory)/signed/Microsoft.PowerShell.TextUtility -DestinationPath $(Build.SourcesDirectory)/SignedZip/Microsoft.PowerShell.TextUtility.zip -Force
100106
displayName: 'Compress archive'
101107
condition: succeededOrFailed()
102108
103109
- task: PublishPipelineArtifact@1
104110
inputs:
105-
targetpath: $(Build.SourcesDirectory)/out/Microsoft.PowerShell.TextUtility
111+
targetpath: $(Build.SourcesDirectory)/signed/Microsoft.PowerShell.TextUtility
106112
artifactName: Signed
107113

108114
- task: PublishPipelineArtifact@1
109115
inputs:
110-
targetpath: $(Build.SourcesDirectory)/out/SignedZip
116+
targetpath: $(Build.SourcesDirectory)/SignedZip
111117
artifactName: SignedZip
112118

113119
- stage: compliance
114120
displayName: Compliance
115-
dependsOn: Build
121+
dependsOn: BuildAndSign
116122
jobs:
117123
- job: Compliance_Job
118124
pool:

yaml/template/runtest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ jobs:
1414
artifactName: out
1515
targetPath: '$(Build.SourcesDirectory)/out'
1616
- pwsh: |
17-
Import-Module ./out/Microsoft.PowerShell.TextUtility.psd1
17+
Import-Module ./out/Microsoft.PowerShell.TextUtility
1818
Invoke-Pester -Path ./test -OutputFormat NUnitXml -EnableExit
1919
condition: succeeded()

0 commit comments

Comments
 (0)