Skip to content

Commit 704ee90

Browse files
authored
Update the combined package build to release the daily builds (PowerShell#10449)
1 parent da74854 commit 704ee90

15 files changed

+313
-61
lines changed

.vsts-ci/install-ps.yml

+48-8
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ phases:
4646
parameters:
4747
scriptName: sudo ./tools/install-powershell.sh
4848
jobName: InstallPowerShellUbuntu
49-
pool: Hosted Ubuntu 1604
49+
pool: ubuntu-latest
5050
verification: |
5151
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
5252
{
@@ -57,7 +57,7 @@ phases:
5757
parameters:
5858
scriptName: sudo ./tools/install-powershell.sh
5959
jobName: InstallPowerShellAmazonLinux
60-
pool: Hosted Ubuntu 1604
60+
pool: ubuntu-latest
6161
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
6262
verification: |
6363
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
@@ -69,7 +69,7 @@ phases:
6969
parameters:
7070
scriptName: sudo ./tools/installpsh-amazonlinux.sh
7171
jobName: InstallPSHAmazonLinux
72-
pool: Hosted Ubuntu 1604
72+
pool: ubuntu-latest
7373
container: pshorg/powershellcommunity-test-deps:amazonlinux-2.0
7474
verification: |
7575
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
@@ -83,14 +83,14 @@ phases:
8383
parameters:
8484
scriptName: ./tools/install-powershell.sh
8585
jobName: InstallPowerShellCentOS
86-
pool: Hosted Ubuntu 1604
86+
pool: ubuntu-latest
8787
container: mcr.microsoft.com/powershell/test-deps:centos-7
88-
88+
8989
- template: templates/install-ps-phase.yml
9090
parameters:
9191
scriptName: ./tools/install-powershell.sh
9292
jobName: InstallPowerShellDebian9
93-
pool: Hosted Ubuntu 1604
93+
pool: ubuntu-latest
9494
container: mcr.microsoft.com/powershell/test-deps:debian-9
9595

9696

@@ -103,7 +103,7 @@ phases:
103103
parameters:
104104
scriptName: ./tools/install-powershell.sh
105105
jobName: InstallPowerShellMacOS
106-
pool: Hosted macOS
106+
pool: macOS-latest
107107
verification: |
108108
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"6.2.0")
109109
{
@@ -115,4 +115,44 @@ phases:
115115
parameters:
116116
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath
117117
jobName: InstallPowerShellPS1Ubuntu
118-
pool: Hosted Ubuntu 1604
118+
pool: ubuntu-latest
119+
120+
- template: templates/install-ps-phase.yml
121+
parameters:
122+
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
123+
jobName: InstallPowerShellPS1UbuntuDaily
124+
pool: ubuntu-latest
125+
verification: |
126+
Write-Verbose $PSVersionTable.PSVersion -verbose
127+
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.0.0")
128+
{
129+
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
130+
}
131+
132+
- template: templates/install-ps-phase.yml
133+
parameters:
134+
scriptName: pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
135+
jobName: InstallPowerShellMacOSDaily
136+
pool: macOS-latest
137+
verification: |
138+
Write-Verbose $PSVersionTable.PSVersion -verbose
139+
if ([Version]"$($PSVersionTable.PSVersion.Major).$($PSVersionTable.PSVersion.Minor).$($PSVersionTable.PSVersion.Patch)" -lt [version]"7.0.0")
140+
{
141+
throw "powershell was not upgraded: $($PSVersionTable.PSVersion)"
142+
}
143+
144+
- template: templates/install-ps-phase.yml
145+
parameters:
146+
scriptName: |
147+
pwsh -c ./tools/install-powershell.ps1 -AddToPath -Daily
148+
jobName: InstallPowerShellWindowsDaily
149+
pool: windows-latest
150+
verification: |
151+
$newVersion = &$env:LOCALAPPDATA\Microsoft\powershell-daily\pwsh -v
152+
$newVersion -match '^PowerShell ((\d*\.\d*\.\d*)(-\w*(\.\d*)?)?){1}'
153+
$versionOnly = $Matches[2]
154+
Write-verbose "$newVersion; versionOnly: $versionOnly" -verbose
155+
if ([Version]$versionOnly -lt [version]"7.0.0")
156+
{
157+
throw "powershell was not upgraded: $newVersion"
158+
}

.vsts-ci/templates/install-ps-phase.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
parameters:
2-
pool: 'Hosted Ubuntu 1604'
2+
pool: 'ubuntu-latest'
33
jobName: 'none'
44
scriptName: ''
55
container: ''
@@ -16,12 +16,12 @@ jobs:
1616
container: ${{ parameters.container }}
1717

1818
pool:
19-
name: ${{ parameters.pool }}
19+
vmImage: ${{ parameters.pool }}
2020

2121
displayName: ${{ parameters.jobName }}
2222

2323
steps:
24-
- powershell: |
24+
- pwsh: |
2525
Get-ChildItem -Path env:
2626
displayName: Capture environment
2727
condition: succeededOrFailed()
@@ -37,6 +37,6 @@ jobs:
3737
continueOnError: ${{ parameters.continueOnError }}
3838
3939
- ${{ if ne(parameters.verification, '') }}:
40-
- powershell: ${{ parameters.verification }}
40+
- pwsh: ${{ parameters.verification }}
4141
displayName: Verification
4242
continueOnError: ${{ parameters.continueOnError }}

tools/install-powershell.ps1

+49-20
Original file line numberDiff line numberDiff line change
@@ -236,42 +236,71 @@ if (-not $IsWinEnv) {
236236
}
237237
}
238238
$tempDir = Join-Path ([System.IO.Path]::GetTempPath()) ([System.IO.Path]::GetRandomFileName())
239-
New-Item -ItemType Directory -Path $tempDir -Force -ErrorAction SilentlyContinue
239+
$null = New-Item -ItemType Directory -Path $tempDir -Force -ErrorAction SilentlyContinue
240240
try {
241241
# Setting Tls to 12 to prevent the Invoke-WebRequest : The request was
242242
# aborted: Could not create SSL/TLS secure channel. error.
243243
$originalValue = [Net.ServicePointManager]::SecurityProtocol
244244
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
245245

246246
if ($Daily) {
247-
if (-not (Get-Module -Name PackageManagement -ListAvailable)) {
248-
throw "PackageManagement module is required to install daily PowerShell."
247+
$metadata = Invoke-RestMethod https://pscoretestdata.blob.core.windows.net/buildinfo/daily.json
248+
$release = $metadata.ReleaseTag -replace '^v'
249+
$blobName = $metadata.BlobName
250+
251+
if ($IsWinEnv) {
252+
if ($UseMSI) {
253+
$packageName = "PowerShell-${release}-win-${architecture}.msi"
254+
} else {
255+
$packageName = "PowerShell-${release}-win-${architecture}.zip"
256+
}
257+
} elseif ($IsLinuxEnv) {
258+
$packageName = "powershell-${release}-linux-${architecture}.tar.gz"
259+
} elseif ($IsMacOSEnv) {
260+
$packageName = "powershell-${release}-osx-${architecture}.tar.gz"
249261
}
250262

251263
if ($architecture -ne "x64") {
252264
throw "The OS architecture is '$architecture'. However, we currently only support daily package for x64."
253265
}
254266

255-
## Register source if not yet
256-
if (-not (Get-PackageSource -Name powershell-core-daily -ErrorAction SilentlyContinue)) {
257-
$packageSource = "https://powershell.myget.org/F/powershell-core-daily"
258-
Write-Verbose "Register powershell-core-daily package source '$packageSource' with PackageManagement" -Verbose
259-
Register-PackageSource -Name powershell-core-daily -Location $packageSource -ProviderName nuget -Trusted -ErrorAction SilentlyContinue
267+
268+
$downloadURL = "https://pscoretestdata.blob.core.windows.net/${blobName}/${packageName}"
269+
Write-Verbose "About to download package from '$downloadURL'" -Verbose
270+
271+
$packagePath = Join-Path -Path $tempDir -ChildPath $packageName
272+
if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
273+
# On Windows PowerShell, progress can make the download significantly slower
274+
$oldProgressPreference = $ProgressPreference
275+
$ProgressPreference = "SilentlyContinue"
260276
}
261277

262-
if ($IsWinEnv) {
263-
$packageName = "powershell-win-x64-win7-x64"
264-
} elseif ($IsLinuxEnv) {
265-
$packageName = "powershell-linux-x64"
266-
} elseif ($IsMacOSEnv) {
267-
$packageName = "powershell-osx-x64"
278+
try {
279+
Invoke-WebRequest -Uri $downloadURL -OutFile $packagePath
280+
} finally {
281+
if (!$PSVersionTable.ContainsKey('PSEdition') -or $PSVersionTable.PSEdition -eq "Desktop") {
282+
$ProgressPreference = $oldProgressPreference
283+
}
268284
}
269285

270-
$package = Find-Package -Source powershell-core-daily -AllowPrereleaseVersions -Name $packageName
271-
Write-Verbose "Daily package found. Name: $packageName; Version: $($package.Version)" -Verbose
286+
$contentPath = Join-Path -Path $tempDir -ChildPath "new"
272287

273-
Install-Package -InputObject $package -Destination $tempDir -ExcludeVersion -ErrorAction SilentlyContinue
274-
$contentPath = [System.IO.Path]::Combine($tempDir, $packageName, "content")
288+
$null = New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue
289+
if ($IsWinEnv) {
290+
if ($UseMSI -and $Quiet) {
291+
Write-Verbose "Performing quiet install"
292+
$process = Start-Process msiexec -ArgumentList "/i", $packagePath, "/quiet" -Wait -PassThru
293+
if ($process.exitcode -ne 0) {
294+
throw "Quiet install failed, please rerun install without -Quiet switch or ensure you have administrator rights"
295+
}
296+
} elseif ($UseMSI) {
297+
Start-Process $packagePath -Wait
298+
} else {
299+
Expand-ArchiveInternal -Path $packagePath -DestinationPath $contentPath
300+
}
301+
} else {
302+
tar zxf $packagePath -C $contentPath
303+
}
275304
} else {
276305
$metadata = Invoke-RestMethod https://raw.githubusercontent.com/PowerShell/PowerShell/master/tools/metadata.json
277306
if ($Preview) {
@@ -312,7 +341,7 @@ try {
312341

313342
$contentPath = Join-Path -Path $tempDir -ChildPath "new"
314343

315-
New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue
344+
$null = New-Item -ItemType Directory -Path $contentPath -ErrorAction SilentlyContinue
316345
if ($IsWinEnv) {
317346
if ($UseMSI -and $Quiet) {
318347
Write-Verbose "Performing quiet install"
@@ -350,7 +379,7 @@ try {
350379
if (-not (Test-Path "~/.rcedit/rcedit-x64.exe")) {
351380
Write-Verbose "Install RCEdit for modifying exe resources" -Verbose
352381
$rceditUrl = "https://github.com/electron/rcedit/releases/download/v1.0.0/rcedit-x64.exe"
353-
New-Item -Path "~/.rcedit" -Type Directory -Force -ErrorAction SilentlyContinue
382+
$null = New-Item -Path "~/.rcedit" -Type Directory -Force -ErrorAction SilentlyContinue
354383
Invoke-WebRequest -OutFile "~/.rcedit/rcedit-x64.exe" -Uri $rceditUrl
355384
}
356385

tools/packaging/packaging.psm1

+6
Original file line numberDiff line numberDiff line change
@@ -3129,6 +3129,12 @@ function Get-PackageVersionAsMajorMinorBuildRevision
31293129

31303130
if ($packageBuildTokens)
31313131
{
3132+
if($packageBuildTokens.length -gt 4)
3133+
{
3134+
# MSIX will fail if it is more characters
3135+
$packageBuildTokens = $packageBuildTokens.Substring(0,4)
3136+
}
3137+
31323138
$packageVersion = $packageVersion + '.' + $packageBuildTokens
31333139
}
31343140
else

tools/releaseBuild/azureDevOps/releaseBuild.yml

+9
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,15 @@ jobs:
9595
- upload_alpine
9696
- build_macOS
9797

98+
- template: templates/json.yml
99+
parameters:
100+
parentJobs:
101+
- WinPackageSigningJob
102+
- upload_deb
103+
- upload_rpm
104+
- upload_alpine
105+
- MacPackageSigningJob
106+
98107
- template: templates/testartifacts.yml
99108

100109
- job: release_json

tools/releaseBuild/azureDevOps/templates/SetVersionVariables.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
parameters:
22
ReleaseTagVar: v6.2.0
33
ReleaseTagVarName: ReleaseTagVar
4+
CreateJson: 'no'
45

56
steps:
67
- powershell: |
7-
$releaseTag = tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag ${{ parameters.ReleaseTagVar }} -Variable "${{ parameters.ReleaseTagVarName }}"
8+
$createJson = ("${{ parameters.ReleaseTagVarName }}" -ne "no")
9+
$releaseTag = tools/releaseBuild/setReleaseTag.ps1 -ReleaseTag ${{ parameters.ReleaseTagVar }} -Variable "${{ parameters.ReleaseTagVarName }}" -CreateJson:$createJson
810
$version = $releaseTag.Substring(1)
911
$vstsCommandString = "vso[task.setvariable variable=Version]$version"
10-
Write-Host "sending " + $vstsCommandString
12+
Write-Host ("sending " + $vstsCommandString)
1113
Write-Host "##$vstsCommandString"
1214
1315
$azureVersion = $releaseTag.ToLowerInvariant() -replace '\.', '-'
1416
$vstsCommandString = "vso[task.setvariable variable=AzureVersion]$azureVersion"
15-
Write-Host "sending " + $vstsCommandString
17+
Write-Host ("sending " + $vstsCommandString)
1618
Write-Host "##$vstsCommandString"
1719
displayName: 'Set ${{ parameters.ReleaseTagVarName }} and other version Variables'
1820

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
parameters:
2+
parentJobs: []
3+
4+
jobs:
5+
- job: json
6+
displayName: Create Json for Blob
7+
dependsOn:
8+
${{ parameters.parentJobs }}
9+
condition: succeeded()
10+
pool:
11+
vmImage: windows-latest
12+
13+
steps:
14+
#- task: <task type name>@<version>
15+
# inputs:
16+
# <task specific inputs>
17+
# displayName: '<display name of task>'
18+
- template: SetVersionVariables.yml
19+
parameters:
20+
ReleaseTagVar: $(ReleaseTagVar)
21+
CreateJson: yes
22+
23+
- task: AzureFileCopy@1
24+
displayName: 'upload signed msi to Azure - ${{ parameters.architecture }}'
25+
inputs:
26+
SourcePath: '$(BuildInfoPath)'
27+
azureSubscription: '$(AzureFileCopySubscription)'
28+
Destination: AzureBlob
29+
storage: '$(StorageAccount)'
30+
ContainerName: 'BuildInfo'
31+
condition: and(succeeded(), eq(variables['IS_DAILY'], 'true'))
32+
33+
- task: AzureCLI@1
34+
displayName: 'Make blob public'
35+
inputs:
36+
azureSubscription: '$(AzureFileCopySubscription)'
37+
scriptLocation: inlineScript
38+
inlineScript: 'az storage container set-permission --account-name $(StorageAccount) --name $(azureVersion) --public-access blob'
39+
condition: and(succeeded(), eq(variables['IS_DAILY'], 'true'))
40+
41+
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
42+
displayName: 'Component Detection'
43+
inputs:
44+
sourceScanPath: '$(Build.SourcesDirectory)'
45+
snapshotForceEnabled: true

tools/releaseBuild/azureDevOps/templates/linux.yml

+9-7
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ jobs:
5151
buildName: ${{ parameters.buildName }}
5252
steps:
5353

54+
- template: shouldSign.yml
55+
5456
- template: SetVersionVariables.yml
5557
parameters:
5658
ReleaseTagVar: $(ReleaseTagVar)
@@ -86,12 +88,12 @@ jobs:
8688
Get-ChildItem -Path '$(System.ArtifactsDirectory)\rpm\*.rpm' -recurse | ForEach-Object { $authenticodefiles += $_.FullName}
8789
tools/releaseBuild/generatePackgeSigning.ps1 -LinuxFiles $authenticodeFiles -path "$(System.ArtifactsDirectory)\package.xml"
8890
displayName: 'Generate RPM Signing Xml'
89-
condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
91+
condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
9092
9193
- powershell: |
9294
Get-Content "$(System.ArtifactsDirectory)\package.xml"
9395
displayName: 'Capture RPM signing xml'
94-
condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
96+
condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
9597
9698
- task: PkgESCodeSign@10
9799
displayName: 'CodeSign RPM $(System.ArtifactsDirectory)\package.xml'
@@ -102,7 +104,7 @@ jobs:
102104
outPathRoot: '$(Build.StagingDirectory)\signedPackages'
103105
binVersion: $(SigingVersion)
104106
binVersionOverride: $(SigningVersionOverride)
105-
condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
107+
condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
106108

107109
- task: AzureFileCopy@1
108110
displayName: 'Upload to Azure - DEB and tar.gz'
@@ -125,7 +127,7 @@ jobs:
125127
Destination: AzureBlob
126128
storage: '$(StorageAccount)'
127129
ContainerName: '$(AzureVersion)'
128-
condition: and(and(succeeded(), ne(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
130+
condition: and(and(succeeded(), ne(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
129131

130132
- task: AzureFileCopy@1
131133
displayName: 'Upload to Azure - RPM - Signed'
@@ -135,17 +137,17 @@ jobs:
135137
Destination: AzureBlob
136138
storage: '$(StorageAccount)'
137139
ContainerName: '$(AzureVersion)'
138-
condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
140+
condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
139141

140142
- template: upload-final-results.yml
141143
parameters:
142144
artifactPath: $(System.ArtifactsDirectory)\rpm\release
143-
condition: and(and(succeeded(), ne(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
145+
condition: and(and(succeeded(), ne(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
144146

145147
- template: upload-final-results.yml
146148
parameters:
147149
artifactPath: '$(Build.StagingDirectory)\signedPackages'
148-
condition: and(and(succeeded(), eq(variables['Build.Reason'], 'Manual')),eq(variables['buildName'], 'RPM'))
150+
condition: and(and(succeeded(), eq(variables['SHOULD_SIGN'], 'true')),eq(variables['buildName'], 'RPM'))
149151

150152
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
151153
displayName: 'Component Detection'

0 commit comments

Comments
 (0)