Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
86 changes: 86 additions & 0 deletions tools/releaseBuild/azureDevOps/templates/vpackReleaseJob.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
parameters:
architecture: x64

jobs:
- job: vpack_${{ parameters.architecture }}
displayName: Build and Publish VPack - ${{ parameters.architecture }}
condition: succeeded()
pool: Package ES Standard Build
steps:

- template: ./SetVersionVariables.yml
parameters:
ReleaseTagVar: $(ReleaseTagVar)

- pwsh: |
$azcopy = "C:\Program Files (x86)\Microsoft SDKs\Azure\AzCopy\AzCopy.exe"

Write-Host "running: $azcopy /Source:https://$(StorageAccount).blob.core.windows.net/$(AzureVersion) /Dest:$(System.ArtifactsDirectory) /S /SourceKey:****** /Pattern:PowerShell-$(Version)-win-${{ parameters.architecture }}.zip /Z:$(AGENT.TEMPDIRECTORY)"
& $azcopy /Source:https://$(StorageAccount).blob.core.windows.net/$(AzureVersion) /Dest:$(System.ArtifactsDirectory) /S /SourceKey:$(StorageAccountKey) /Pattern:PowerShell-$(Version)-win-${{ parameters.architecture }}.zip /Z:$(AGENT.TEMPDIRECTORY)
displayName: 'Download Azure Artifacts'

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

- pwsh: |
$message = @()
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -include *.zip, *.msi | ForEach-Object {
if($_.Name -notmatch 'PowerShell-\d\.\d\.\d\-([a-z]*.\d+\-)?win\-(fxdependent|x64|arm32|arm64|x86|fxdependentWinDesktop)\.(msi|zip){1}')
{
$messageInstance = "$($_.Name) is not a valid package name"
$message += $messageInstance
Write-Warning $messageInstance
}
}

if($message.count -gt 0){throw ($message | out-string)}
displayName: 'Validate Zip and MSI Package Names'

- pwsh: |
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -include *.zip, *.msi | ForEach-Object {
if($_.Name -match 'PowerShell-\d\.\d\.\d\-([a-z]*.\d+\-)?win\-(${{ parameters.architecture }})\.(zip){1}')
{
$destDir = "$(System.ArtifactsDirectory)\vpack${{ parameters.architecture }}"
$null = new-item -ItemType Directory -Path $destDir
Expand-Archive -Path $_.FullName -DestinationPath $destDir
$vstsCommandString = "vso[task.setvariable variable=vpackDir]$destDir"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
}
}
displayName: 'Extract Zip'

- pwsh: |
$vpackVersion = '$(version)'

if('$(VPackPublishOverride)' -ne '' -and '$(VPackPublishOverride)' -ne 'None' )
{
Write-Host "Using VPackPublishOverride varabile"
$vpackVersion = '$(VPackPublishOverride)'
}

$vstsCommandString = "vso[task.setvariable variable=vpackVersion]$vpackVersion"
Write-Host "sending " + $vstsCommandString
Write-Host "##$vstsCommandString"
displayName: 'Set vpackVersion'

- pwsh: |
Get-ChildItem -Path env:
displayName: Capture Environment
condition: succeededOrFailed()

- task: PkgESVPack@10
displayName: 'Package ES - VPack '
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
inputs:
sourceDirectory: '$(vpackDir)'
description: PowerShell ${{ parameters.architecture }} $(version)
pushPkgName: 'PowerShell.${{ parameters.architecture }}'
configurations: Release
platforms: x64
target: '$(System.ArtifactsDirectory)'
owner: tplunk
provData: false
version: '$(vpackVersion)'
condition: and(succeeded(), eq(variables['Build.Reason'], 'Manual'))
55 changes: 55 additions & 0 deletions tools/releaseBuild/azureDevOps/vpackRelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: vpack-$(Build.BuildId)
trigger:
branches:
include:
- master
- release*
pr:
branches:
include:
- master
- release*

variables:
- name: DOTNET_CLI_TELEMETRY_OPTOUT
value: 1
- name: POWERSHELL_TELEMETRY_OPTOUT
value: 1
- group: Azure Blob variable group
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adityapatwardhan Note that this YAML tells what variable groups it needs


# Set AzDevOps Agent to clean the machine after the end of the build
resources:
- repo: self
clean: true

jobs:
- job: rename
displayName: Name the build
condition: succeeded()
pool:
vmImage: 'windows-latest'
steps:

- template: ./templates/SetVersionVariables.yml
parameters:
ReleaseTagVar: $(ReleaseTagVar)

- powershell: Write-Host "##vso[build.updatebuildnumber]$env:BUILD_SOURCEBRANCHNAME-$env:BUILD_SOURCEVERSION-$((get-date).ToString("yyyyMMddhhss"))"
displayName: Set Build Name for Non-PR
condition: ne(variables['Build.Reason'], 'PullRequest')

- template: ./templates/vpackReleaseJob.yml
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider:

  1. Adding approvals?
  2. Execute only on build.reason manual?

Copy link
Member Author

@TravisEz13 TravisEz13 Feb 26, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did number 2

Let's leave 1 for when we integrate this into a deployment yaml.

parameters:
architecture: x64

- template: ./templates/vpackReleaseJob.yml
parameters:
architecture: x86

- template: ./templates/vpackReleaseJob.yml
parameters:
architecture: arm32

- template: ./templates/vpackReleaseJob.yml
parameters:
architecture: arm64