|
| 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_metadata:'$(Build.SourceVersion)' |
| 95 | +ob_createvpack_versionAs:string |
| 96 | +ob_createvpack_version:'$(version)' |
| 97 | +ob_createvpack_verbose:true |
| 98 | + |
| 99 | +steps: |
| 100 | + -template:.pipelines/templates/SetVersionVariables.yml@self |
| 101 | +parameters: |
| 102 | +ReleaseTagVar:$(ReleaseTagVar) |
| 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 | + $payloadDir = '$(Pipeline.Workspace)\PSPackagesOfficial\drop_msixbundle_CreateMSIXBundle' |
| 118 | + Get-ChildItem $payloadDir -Recurse | Out-String -Width 150 |
| 119 | + $vstsCommandString = "vso[task.setvariable variable=PayloadDir]$payloadDir" |
| 120 | + Write-Host "sending " + $vstsCommandString |
| 121 | + Write-Host "##$vstsCommandString" |
| 122 | + displayName: 'Capture Artifact Listing' |
| 123 | +
|
| 124 | + -pwsh:| |
| 125 | + $bundlePackage = Get-ChildItem '$(PayloadDir)\*.msixbundle' |
| 126 | + Write-Verbose -Verbose ("MSIX bundle package: " + $bundlePackage.FullName -join ', ') |
| 127 | + if ($bundlePackage.Count -ne 1) { |
| 128 | + throw "Expected to find 1 MSIX bundle package, but found $($bundlePackage.Count)" |
| 129 | + } |
| 130 | +
|
| 131 | + if (-not (Test-Path '$(ob_outputDirectory)' -PathType Container)) { |
| 132 | + $null = New-Item '$(ob_outputDirectory)' -ItemType Directory -ErrorAction Stop |
| 133 | + } |
| 134 | +
|
| 135 | + $targetPath = Join-Path '$(ob_outputDirectory)' 'Microsoft.PowerShell_8wekyb3d8bbwe.msixbundle' |
| 136 | + Copy-Item -Verbose -Path $bundlePackage.FullName -Destination $targetPath |
| 137 | + displayName: 'Stage msixbundle for vpack' |
| 138 | +
|
| 139 | + -pwsh:| |
| 140 | + Write-Verbose "VPack Version: $(ob_createvpack_version)" -Verbose |
| 141 | + $vpackFiles = Get-ChildItem -Path $(ob_outputDirectory)\* -Recurse |
| 142 | + if($vpackFiles.Count -eq 0) { |
| 143 | + throw "No files found in $(ob_outputDirectory)" |
| 144 | + } |
| 145 | + $vpackFiles | Out-String -Width 150 |
| 146 | + displayName: Debug Output Directory and Version |
| 147 | + condition: succeededOrFailed() |