|
| 1 | +trigger: none |
| 2 | + |
| 3 | +parameters: # parameters are shown up in ADO UI in a build queue time |
| 4 | +- name: 'createVPack' |
| 5 | + displayName: 'Create and Submit VPack' |
| 6 | + type: boolean |
| 7 | + default: true |
| 8 | +- name: 'debug' |
| 9 | + displayName: 'Enable debug output' |
| 10 | + type: boolean |
| 11 | + default: false |
| 12 | +- name: 'ReleaseTagVar' |
| 13 | + type: string |
| 14 | + displayName: 'Release Tag Var:' |
| 15 | + default: 'fromBranch' |
| 16 | + |
| 17 | +name: msixbundle_vPack_$(date:yyMM).$(date:dd)$(rev:rrr) |
| 18 | + |
| 19 | +variables: |
| 20 | + CDP_DEFINITION_BUILD_COUNT: $[counter('', 0)] |
| 21 | + system.debug: ${{ parameters.debug }} |
| 22 | + BuildSolution: $(Build.SourcesDirectory)\dirs.proj |
| 23 | + ReleaseTagVar: ${{ parameters.ReleaseTagVar }} |
| 24 | + BuildConfiguration: Release |
| 25 | + WindowsContainerImage: 'onebranch.azurecr.io/windows/ltsc2019/vse2022:latest' |
| 26 | + Codeql.Enabled: false # pipeline is not building artifacts; it repackages existing artifacts into a vpack |
| 27 | + DOTNET_CLI_TELEMETRY_OPTOUT: 1 |
| 28 | + POWERSHELL_TELEMETRY_OPTOUT: 1 |
| 29 | + |
| 30 | +resources: |
| 31 | + repositories: |
| 32 | + - repository: templates |
| 33 | + type: git |
| 34 | + name: OneBranch.Pipelines/GovernedTemplates |
| 35 | + ref: refs/heads/main |
| 36 | + |
| 37 | + pipelines: |
| 38 | + - pipeline: PSPackagesOfficial |
| 39 | + source: 'PowerShell-Packages-Official' |
| 40 | + trigger: |
| 41 | + branches: |
| 42 | + include: |
| 43 | + - master |
| 44 | + - releases/* |
| 45 | + |
| 46 | +extends: |
| 47 | + template: v2/Microsoft.Official.yml@templates |
| 48 | + parameters: |
| 49 | + platform: |
| 50 | + name: 'windows_undocked' # windows undocked |
| 51 | + |
| 52 | + cloudvault: |
| 53 | + enabled: false |
| 54 | + |
| 55 | + globalSdl: |
| 56 | + useCustomPolicy: true # for signing code |
| 57 | + disableLegacyManifest: true |
| 58 | + # disabled Armory as we dont have any ARM templates to scan. It fails on some sample ARM templates. |
| 59 | + armory: |
| 60 | + enabled: false |
| 61 | + sbom: |
| 62 | + enabled: true |
| 63 | + compiled: |
| 64 | + enabled: false |
| 65 | + credscan: |
| 66 | + enabled: true |
| 67 | + scanFolder: $(Build.SourcesDirectory) |
| 68 | + suppressionsFile: $(Build.SourcesDirectory)\.config\suppress.json |
| 69 | + binskim: |
| 70 | + enabled: false |
| 71 | + # APIScan requires a non-Ready-To-Run build |
| 72 | + apiscan: |
| 73 | + enabled: false |
| 74 | + asyncSDL: |
| 75 | + enabled: false |
| 76 | + tsaOptionsFile: .config/tsaoptions.json |
| 77 | + |
| 78 | + stages: |
| 79 | + - stage: build |
| 80 | + jobs: |
| 81 | + - job: main |
| 82 | + pool: |
| 83 | + type: windows |
| 84 | + |
| 85 | + variables: |
| 86 | + ob_outputDirectory: '$(BUILD.SOURCESDIRECTORY)\out' |
| 87 | + ob_createvpack_enabled: ${{ parameters.createVPack }} |
| 88 | + ob_createvpack_packagename: 'PowerShell.app' |
| 89 | + ob_createvpack_owneralias: 'dongbow' |
| 90 | + ob_createvpack_description: 'VPack for the PowerShell Application' |
| 91 | + ob_createvpack_targetDestinationDirectory: '$(Destination)' |
| 92 | + ob_createvpack_propsFile: false |
| 93 | + ob_createvpack_provData: true |
| 94 | + ob_createvpack_versionAs: string |
| 95 | + ob_createvpack_version: '$(version)' |
| 96 | + ob_createvpack_verbose: true |
| 97 | + |
| 98 | + steps: |
| 99 | + - template: .pipelines/templates/SetVersionVariables.yml@self |
| 100 | + parameters: |
| 101 | + ReleaseTagVar: $(ReleaseTagVar) |
| 102 | + CreateJson: yes |
| 103 | + UseJson: no |
| 104 | + |
| 105 | + - pwsh: | |
| 106 | + Write-Verbose -Verbose 'PowerShell Version: $(version)' |
| 107 | + if('$(version)' -match '-') { |
| 108 | + throw "Don't release a preview build msixbundle package" |
| 109 | + } |
| 110 | + displayName: Stop any preview release |
| 111 | +
|
| 112 | + - download: PSPackagesOfficial |
| 113 | + artifact: 'drop_msixbundle_CreateMSIXBundle' |
| 114 | + displayName: Download package |
| 115 | + |
| 116 | + - pwsh: | |
| 117 | + Get-ChildItem '$(Pipeline.Workspace)\PSPackagesOfficial' -Recurse | Out-String -Width 150 |
| 118 | + displayName: 'Capture Artifact Listing' |
| 119 | +
|
| 120 | + - pwsh: | |
| 121 | + $bundlePackage = Get-ChildItem '$(Pipeline.Workspace)\PSPackagesOfficial\*.msixbundle' |
| 122 | + $targetPath = Join-Path '$(ob_outputDirectory)' 'Microsoft.PowerShell_8wekyb3d8bbwe.msixbundle' |
| 123 | + Copy-Item -Verbose -Path $bundlePackage.FullName -Destination $targetPath |
| 124 | + displayName: 'Stage msixbundle for vpack' |
| 125 | +
|
| 126 | + - pwsh: | |
| 127 | + Write-Verbose "VPack Version: $(ob_createvpack_version)" -Verbose |
| 128 | + $vpackFiles = Get-ChildItem -Path $(ob_outputDirectory)\* -Recurse |
| 129 | + if($vpackFiles.Count -eq 0) { |
| 130 | + throw "No files found in $(ob_outputDirectory)" |
| 131 | + } |
| 132 | + $vpackFiles | Out-String -Width 150 |
| 133 | + displayName: Debug Output Directory and Version |
| 134 | + condition: succeededOrFailed() |
0 commit comments