Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
9ce1a06
parent ed4cd20d800cbab789b6b516f324498e022a1d02
adityapatwardhan Jul 15, 2019
a62335c
Create directory if it does not exist
Jul 21, 2020
840c4d1
Fix SDK tests
Jul 21, 2020
d247fff
Make trigger manual for testing
Jul 22, 2020
9e45b04
Fix typo in stage bame
Jul 22, 2020
af96a5b
Remove version from pipeline resource
Jul 22, 2020
d180688
Add branch in pipeline resource
Jul 22, 2020
2dc48c8
Change build name in pipeline resource
Jul 22, 2020
cf32324
Add quotes
Jul 22, 2020
2c74b49
Remove branch
Jul 22, 2020
f7d10cf
Fix build name
Jul 22, 2020
ac1494c
Fix build name
Jul 22, 2020
674bcc5
Fix sdk download
Jul 22, 2020
5b34550
Use pipeline resource
Jul 22, 2020
d3de2ae
Fixes for consuming pipeline resource
Jul 22, 2020
12de68f
Path fixes to use pipeline resource
Jul 22, 2020
743796b
Fix global tools and package validation
Jul 22, 2020
b4c08a0
Add logging to install global tool
Jul 22, 2020
e86a2f8
Fix exe name for global tool
Jul 22, 2020
5f9ded3
Test end to end
Jul 22, 2020
cdf55b2
Keep using preview5 for test
Jul 22, 2020
cff3f84
Fix global tool tests
Jul 22, 2020
e72b210
Add scripts for release tasks
Jul 23, 2020
e6702c5
Fix template paths
Jul 23, 2020
f7d97e8
Fix tabbing
Jul 23, 2020
ae7574e
Fix paths after download
Jul 23, 2020
7a274b0
Fix yaml template name
Jul 23, 2020
757fbee
Enable trigger
Jul 23, 2020
7c6ddf3
Disable deploy tasks for testing
Jul 23, 2020
a53070f
Fix yaml
Jul 24, 2020
32e7454
Fix local clone of internal repo
Jul 24, 2020
bcde4f1
Fix issues in package release
Jul 24, 2020
46dee0d
Fix issues in buildjson
Jul 24, 2020
6be6386
Fix typo
Jul 24, 2020
37cdb2b
Fix typo
Jul 24, 2020
ceabead
Add approval for VPack and remove commented publish code
Aug 10, 2020
5df77ce
Fix build name
Aug 10, 2020
1cc6599
Undo change for disabling compliance
Aug 10, 2020
fd5c9ac
Add update deps step
Aug 11, 2020
05d02e4
Empty commit
adityapatwardhan Aug 11, 2020
d020e60
Add release deps json to pipeline
adityapatwardhan Aug 12, 2020
2b126d3
Address feedback
adityapatwardhan Aug 12, 2020
edbb4e2
Add variable groups to jobs when using variables
adityapatwardhan Aug 12, 2020
2f2812c
Fix yaml and add display names to stages
adityapatwardhan Aug 12, 2020
5f22800
Fix stage dependencies
adityapatwardhan Aug 12, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions tools/releaseBuild/azureDevOps/releasePipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
trigger: none

# needed to disable CI trigger and allow manual trigger
# when the branch is same as pipline source, the latest build from the source is used.
# all environment used are for manual tasks and approvals.

resources:
pipelines:
- pipeline: releasePipeline
source: 'Coordinated Packages'
trigger:
branches:
- release/*

variables:
runCodesignValidationInjection: false

stages:
- stage: ValidateSDK
displayName: Validate SDK
dependsOn: []
jobs:
- template: templates/release-SDKTests.yml
parameters:
jobName: WinSDK
displayName: Windows SDK Test
imageName: windows-latest

- template: templates/release-SDKTests.yml
parameters:
jobName: LinuxSDK
displayName: Linux SDK Test
imageName: ubuntu-latest

- template: templates/release-SDKTests.yml
parameters:
jobName: macOSSDK
displayName: macOS SDK Test
imageName: macOS-latest

- stage: PRCreation
displayName: Create PR in GH Master
dependsOn: []
jobs:
- deployment: CreatePRInMaster
displayName: Update README.md and metadata.json
pool: server
environment: PSReleaseCreatePR

- stage: ValidateGlobalTool
displayName: Validate Global Tool
dependsOn: []
jobs:
- template: templates/release-GlobalToolTest.yml
parameters:
jobName: WinGblTool
displayName: Global Tool Test Windows
imageName: windows-latest
globalToolExeName: 'pwsh.exe'
globalToolPackageName: 'PowerShell.Windows.x64'

- template: templates/release-GlobalToolTest.yml
parameters:
jobName: LinuxWinGblTool
displayName: Global Tool Test Linux
imageName: ubuntu-latest
globalToolExeName: 'pwsh'
globalToolPackageName: 'PowerShell.Linux.x64'

- stage: ValidatePkgNames
dependsOn: []
displayName: Package Names validation
jobs:
- job: ValidatePkgNames
pool:
vmImage: windows-latest
variables:
- group: 'Azure Blob variable group'
steps:
- template: templates/release-ValidatePackageNames.yml

- stage: StartDocker
dependsOn: []
displayName: Kick Off Docker Staging build
jobs:
- deployment: PSDockerKickOff
displayName: Start Docker build
pool: server
environment: PSReleaseDockerKickOff

- stage: ManualValidation
dependsOn: []
displayName: Manual Validation
jobs:
- deployment: ValidateWinPkg
displayName: Validate Windows Packages
pool: server
environment: PSReleaseWinPkgValidate

- deployment: ValidateLinuxPkg
displayName: Validate Linux Packages
pool: server
environment: PSReleaseLinuxPkgValidate

- stage: ReleaseAutomation
displayName: Release Automation
dependsOn: []
jobs:
- deployment: ReleaseAutomationKickOff
displayName: Kick off release ReleaseAutomation
pool: server
environment: PSReleaseAutomationKickOff

- stage: GitHubDraftRelease
displayName: Create GitHub draft release
# do not include stages that are likely to fail in dependency as there is no way to force deploy.
dependsOn:
- ValidateSDK
- PRCreation
- ValidatePkgNames
- StartDocker
- ManualValidation
- ReleaseAutomation

# The environment here is used for approval.
jobs:
- deployment: AzureBlobPublic
displayName: Make Azure Blob Public
pool:
vmImage: windows-latest
variables:
- group: 'ACR'
environment: PSReleaseAzureBlobPublic
strategy:
runOnce:
deploy:
steps:
- template: templates/release-MakeContainerPublic.yml

- job: GitHubDraft
displayName: Create GitHub Draft release
pool:
vmImage: windows-latest
variables:
- group: 'Azure Blob variable group'
- group: 'AzDevOpsArtifacts'
dependsOn: AzureBlobPublic
steps:
- template: templates/release-CreateGitHubDraft.yml

- stage: GitHubManualTasks
displayName: GitHub manual tasks
dependsOn: GitHubDraftRelease
jobs:
- deployment: UpdateChangeLog
displayName: Update Change Log
pool : server
environment: PSReleaseUpdateChangeLog

- deployment: PushTag
displayName: Push Git Tag
pool : server
environment: PSReleasePushTag

- deployment: MakeDraftPublic
displayName: Make GitHub Draft public
pool : server
environment: PSReleaseDraftPublic

- stage: PublishPackages
displayName: Publish packages
dependsOn: GitHubManualTasks
jobs:
- job: PublishNuget
pool:
vmImage: windows-latest
steps:
- template: templates/release-ReleaseToNuGet.yml

- job: PublishPkgsMsftCom
pool:
vmImage: ubuntu-latest
variables:
- group: 'AzDevOpsArtifacts'
- group: 'packages.microsoft.com'
steps:
- template: templates/release-PublishPackageMsftCom.yml

- stage: ChangesToMaster
displayName: Ensure changes are in GH master
dependsOn: PublishPackages
jobs:
- deployment: MergeToMaster
displayName: Make sure changes are in master
pool: server
environment: PSReleaseChangesToMaster

- stage: ReleaseDocker
displayName: Release Docker
dependsOn:
- StartDocker
jobs:
- deployment: ReleaseDocker
displayName: Release Docker
pool: server
environment: PSReleaseDockerRelease

- stage: ReleaseSnap
displayName: Release Snap
dependsOn:
- PublishPackages
- ChangesToMaster
jobs:
- deployment: ReleaseSnap
displayName: Release Snap
pool: server
environment: PSReleaseSnapRelease

- stage: UpdateDotnetDocker
dependsOn: GitHubManualTasks
displayName: Update DotNet SDK Docker images
jobs:
- deployment: DotnetSDkDocker
displayName: Update .NET SDK docker images
pool: server
environment: PSReleaseUpdateDotnetDocker

- stage: BuildInfoJson
dependsOn: GitHubManualTasks
displayName: Upload BuildInfoJson
jobs:
- job: UploadJson
pool:
vmImage: windows-latest
variables:
- group: 'Azure Blob variable group'
steps:
- template: templates/release-BuildJson.yml

- stage: ReleaseVPack
dependsOn: GitHubManualTasks
displayName: Release VPack
jobs:
- deployment: ReleaseVPackManual
displayName: Release VPack
pool: server
environment: PSReleaseVpack

- stage: ReleaseDeps
dependsOn: GitHubManualTasks
displayName: Update pwsh.deps.json links
jobs:
- template: templates/release-UpdateDepsJson.yml

- stage: ReleaseClose
displayName: Finish Release
dependsOn:
- ReleaseVPack
- BuildInfoJson
- UpdateDotnetDocker
- ReleaseDocker
- ReleaseSnap
- ChangesToMaster
- ReleaseDeps
jobs:
- deployment: RetainBuild
displayName: Retain Build
pool: server
environment: PSReleaseRetainBuild

- deployment: DeleteBranch
displayName: Delete release branch
pool: server
environment: PSReleaseDeleteBranch
14 changes: 13 additions & 1 deletion tools/releaseBuild/azureDevOps/templates/nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,18 @@ jobs:
binVersionOverride: $(SigningVersionOverride)
condition: and(succeeded(), eq(variables['SHOULD_SIGN'], 'true'))

- pwsh: |
if (-not (Test-Path '$(System.ArtifactsDirectory)\signed\')) { $null = New-Item -ItemType Directory -Path '$(System.ArtifactsDirectory)\signed\' }
Copy-Item -Path '$(PackagePath)\*.nupkg' -Destination '$(System.ArtifactsDirectory)\signed\' -Verbose -Force
Copy-Item -Path '$(PackagePath)\globaltool\*.nupkg' -Destination '$(System.ArtifactsDirectory)\signed\' -Verbose -Force
displayName: Fake copy when not signing
condition: eq(variables['SHOULD_SIGN'], 'false')

- powershell: |
Import-Module $(Build.SourcesDirectory)\build.psm1 -Force
Get-ChildItem -Recurse "$(System.ArtifactsDirectory)\signed\*.nupkg" -Verbose | ForEach-Object { Start-NativeExecution -sb { nuget.exe verify -All $_.FullName } }
displayName: Verify all packages are signed
condition: eq(variables['SHOULD_SIGN'], 'true')

- task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@3
displayName: 'Run MpCmdRun.exe'
Expand All @@ -156,7 +164,11 @@ jobs:
artifactPath: '$(System.ArtifactsDirectory)\signed'

- powershell: |
$null = New-Item -Path "$(System.ArtifactsDirectory)\signed\globaltool" -ItemType Directory
if (-not (Test-Path "$(System.ArtifactsDirectory)\signed"))
{
$null = New-Item -Path "$(System.ArtifactsDirectory)\signed\globaltool" -ItemType Directory
}

Move-Item -Path "$(System.ArtifactsDirectory)\signed\PowerShell.*" -Destination "$(System.ArtifactsDirectory)\signed\globaltool" -Force
Get-ChildItem "$(System.ArtifactsDirectory)\signed\globaltool" -Recurse
displayName: Move global tool packages to subfolder and capture
Expand Down
69 changes: 69 additions & 0 deletions tools/releaseBuild/azureDevOps/templates/release-BuildJson.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
steps:
- download: releasePipeline
artifact: BuildInfoJson

- pwsh: |
$jsonFile = Get-Item "$ENV:PIPELINE_WORKSPACE/releasePipeline/BuildInfoJson/*.json"
$fileName = Split-Path $jsonFile -Leaf

$dateTime = [datetime]::UtcNow
$dateTime = [datetime]::new($dateTime.Ticks - ($dateTime.Ticks % [timespan]::TicksPerSecond), $dateTime.Kind)

$buildInfo = Get-Content $jsonFile | ConvertFrom-Json
$buildInfo.ReleaseDate = $dateTime

$targetFile = "$ENV:PIPELINE_WORKSPACE/$fileName"
ConvertTo-Json -InputObject $buildInfo | Out-File $targetFile -Encoding ascii

$vstsCommandString = "vso[task.setvariable variable=BuildInfoJsonFile]$targetFile"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"


## Create 'lts.json' if it's the latest stable and also a LTS release.

$vstsCommandCopyLTSBuildInfo = "vso[task.setvariable variable=CopyLTSBuildInfo]NO"

if ($fileName -eq "stable.json")
{
$releaseTag = $buildInfo.ReleaseTag
$version = $releaseTag -replace '^v'
$semVersion = [System.Management.Automation.SemanticVersion] $version

if ($semVersion.PreReleaseLabel -eq $null -and $semVersion.Minor % 2 -eq 0 -and $semVersion.Major -ge 7)
{
$ltsFile = "$ENV:PIPELINE_WORKSPACE/lts.json"
Copy-Item -Path $targetFile -Destination $ltsFile -Force
$vstsCommandLtsJsonFile = "vso[task.setvariable variable=LtsBuildInfoJsonFile]$ltsFile"
$vstsCommandCopyLTSBuildInfo = "vso[task.setvariable variable=CopyLTSBuildInfo]YES"
}
}

Write-Host "sending " + $vstsCommandCopyLTSBuildInfo
Write-Host "##$vstsCommandCopyLTSBuildInfo"

if ($vstsCommandLtsJsonFile)
{
Write-Host "sending " + $vstsCommandLtsJsonFile
Write-Host "##$vstsCommandLtsJsonFile"
}
displayName: Download and Capture NuPkgs

- task: AzureFileCopy@2
displayName: 'AzureBlob build info JSON file Copy'
inputs:
SourcePath: '$(BuildInfoJsonFile)'
azureSubscription: '$(AzureFileCopySubscription)'
Destination: AzureBlob
storage: '$(StorageAccount)'
ContainerName: BuildInfo

- task: AzureFileCopy@2
displayName: 'AzureBlob build info ''lts.json'' Copy when needed'
inputs:
SourcePath: '$(LtsBuildInfoJsonFile)'
azureSubscription: '$(AzureFileCopySubscription)'
Destination: AzureBlob
storage: '$(StorageAccount)'
ContainerName: BuildInfo
condition: and(succeeded(), eq(variables['CopyLTSBuildInfo'], 'YES'))
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
steps:
- download: none

- template: release-SetReleaseTagAndContainerName.yml

- pwsh: |
$azcopy = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe"
& $azcopy /Source:https://$(StorageAccount).blob.core.windows.net/$(AzureVersion) /Dest:$(System.ArtifactsDirectory) /S /SourceKey:$(StorageAccountKey)
displayName: Download Azure Artifacts

- pwsh: |
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse | Select-Object -ExpandProperty Name
displayName: Capture downloaded artifacts

- pwsh: |
git clone https://$(AzureDevOpsPat)@mscodehub.visualstudio.com/PowerShellCore/_git/Internal-PowerShellTeam-Tools '$(Pipeline.Workspace)/tools'
displayName: Clone Internal-Tools repository

- pwsh: |
Import-module '$(Pipeline.Workspace)/tools/Scripts/GitHubRelease.psm1'
Publish-ReleaseDraft -Tag '$(ReleaseTag)' -Name '$(ReleaseTag) Release of PowerShell' -Description '<-- Update Me -->' -User PowerShell -Repository PowerShell -PackageFolder $(System.ArtifactsDirectory) -Token $(GitHubReleasePat)
displayName: Publish Release Draft
Loading