|
| 1 | +parameters: |
| 2 | +- name: versionNumberOverride |
| 3 | + type: string |
| 4 | + default: 'default' |
| 5 | +- name: isOfficial |
| 6 | + type: boolean |
| 7 | +- name: dotnetVersion |
| 8 | + type: string |
| 9 | +- name: channel |
| 10 | + values: |
| 11 | + - release |
| 12 | + - prerelease |
| 13 | + - auto |
| 14 | + default: auto |
| 15 | +- name: signType |
| 16 | + values: |
| 17 | + - test |
| 18 | + - real |
| 19 | + - auto |
| 20 | + default: auto |
| 21 | + |
| 22 | +stages: |
| 23 | +- stage: BuildVSIX |
| 24 | + displayName: 'Build VSIXs' |
| 25 | + dependsOn: [] |
| 26 | + jobs: |
| 27 | + - job: SetRunVariables |
| 28 | + displayName: 'Set Run Variables' |
| 29 | + pool: |
| 30 | + ${{ if eq(parameters.isOfficial, true) }}: |
| 31 | + name: netcore1espool-internal |
| 32 | + image: 1es-ubuntu-2204 |
| 33 | + ${{ else }}: |
| 34 | + name: Azure Pipelines |
| 35 | + vmImage: ubuntu-latest |
| 36 | + os: linux |
| 37 | + steps: |
| 38 | + - pwsh: | |
| 39 | + $isPrerelease = $true |
| 40 | + if ("${{ parameters.channel }}" -eq "release") { |
| 41 | + Write-Host "Channel override set to release, using release channel." |
| 42 | + $isPrerelease = $false |
| 43 | + } elseif ("${{ parameters.channel }}" -eq "prerelease") { |
| 44 | + Write-Host "Channel override set to prerelease, using prerelease channel." |
| 45 | + $isPrerelease = $true |
| 46 | + } else { |
| 47 | + Write-Host "Channel override is ${{ parameters.channel }}, using branch configuration to determine release channel." |
| 48 | + Write-Host "Detected branch $(Build.SourceBranchName)" |
| 49 | + if ("$(Build.SourceBranchName)" -eq "release") { |
| 50 | + Write-Host "Branch is release, using release channel." |
| 51 | + $isPrerelease = $false |
| 52 | + } else { |
| 53 | + Write-Host "Branch is not release, using prerelease channel." |
| 54 | + $isPrerelease = $true |
| 55 | + } |
| 56 | + } |
| 57 | +
|
| 58 | + if ( $isPrerelease ) { |
| 59 | + Write-Host "Setting pipeline channel variable to Prerelease." |
| 60 | + Write-Host "##vso[task.setvariable variable=channel;isoutput=true]Prerelease" |
| 61 | + } else { |
| 62 | + Write-Host "Setting pipeline channel variable to Release." |
| 63 | + Write-Host "##vso[task.setvariable variable=channel;isoutput=true]Release" |
| 64 | + } |
| 65 | + name: passChannel |
| 66 | + displayName: Set Channel Variable |
| 67 | +
|
| 68 | + - pwsh: | |
| 69 | + $signType = "test" |
| 70 | + if ("${{ parameters.isOfficial }}" -ne "true") { |
| 71 | + Write-Host "Not an official build, test signing" |
| 72 | + $signType = "test" |
| 73 | + } elseif ("${{ parameters.signType }}" -eq "test") { |
| 74 | + Write-Host "Sign type override set to ${{ parameters.signType }}" |
| 75 | + $signType = "test" |
| 76 | + } elseif ("${{ parameters.signType }}" -eq "real") { |
| 77 | + Write-Host "Sign type override set to ${{ parameters.signType }}" |
| 78 | + $signType = "real" |
| 79 | + } else { |
| 80 | + Write-Host "Sign type override is ${{ parameters.signType }}, using branch configuration to determine sign type" |
| 81 | + Write-Host "Detected branch $(Build.SourceBranchName)" |
| 82 | + if ( ("$(Build.SourceBranchName)" -eq "release") -or ("$(Build.SourceBranchName)" -eq "prerelease")) { |
| 83 | + Write-Host "Branch is a release branch, using real sign type." |
| 84 | + $signType = 'real' |
| 85 | + } else { |
| 86 | + Write-Host "Branch is test branch, using test sign type." |
| 87 | + $signType = 'test' |
| 88 | + } |
| 89 | + } |
| 90 | +
|
| 91 | + Write-Host "Setting pipeline signType variable to " $signType |
| 92 | + Write-Host "##vso[task.setvariable variable=signType;isoutput=true]$signType" |
| 93 | + name: passSignType |
| 94 | + displayName: Set Sign Type |
| 95 | +
|
| 96 | + - job: 'Build_vsixs' |
| 97 | + displayName: 'Build VSIXs' |
| 98 | + pool: |
| 99 | + ${{ if eq(parameters.isOfficial, true) }}: |
| 100 | + name: netcore1espool-internal |
| 101 | + image: 1es-ubuntu-2204 |
| 102 | + ${{ else }}: |
| 103 | + name: Azure Pipelines |
| 104 | + vmImage: ubuntu-latest |
| 105 | + os: linux |
| 106 | + dependsOn: SetRunVariables |
| 107 | + variables: |
| 108 | + channel: $[ dependencies.SetRunVariables.outputs['passChannel.channel'] ] |
| 109 | + signType: $[ dependencies.SetRunVariables.outputs['passSignType.signType'] ] |
| 110 | + teamName: DotNetCore |
| 111 | + ${{ if eq(parameters.isOfficial, true) }}: |
| 112 | + templateContext: |
| 113 | + outputs: |
| 114 | + - output: pipelineArtifact |
| 115 | + path: $(Build.SourcesDirectory)/Packages |
| 116 | + artifact: Packages |
| 117 | + - output: pipelineArtifact |
| 118 | + path: $(Build.SourcesDirectory)/out/logs |
| 119 | + artifact: SigningLogs |
| 120 | + steps: |
| 121 | + - checkout: self |
| 122 | + clean: true |
| 123 | + submodules: true |
| 124 | + fetchTags: false |
| 125 | + fetchDepth: 0 |
| 126 | + - template: /azure-pipelines/prereqs.yml@self |
| 127 | + parameters: |
| 128 | + versionNumberOverride: ${{ parameters.versionNumberOverride }} |
| 129 | + dotnetVersion: ${{ parameters.dotnetVersion}} |
| 130 | + |
| 131 | + - task: UsePythonVersion@0 |
| 132 | + displayName: 'Use Python 3.11' |
| 133 | + inputs: |
| 134 | + versionSpec: 3.11 |
| 135 | + |
| 136 | + # Non-windows signing requires .NET 8 installed on the machine. |
| 137 | + - task: UseDotNet@2 |
| 138 | + displayName: Use .NET Core sdk 8.0.x |
| 139 | + inputs: |
| 140 | + version: 8.0.x |
| 141 | + |
| 142 | + # If we're in an official build, install the signing plugin |
| 143 | + - ${{ if eq(parameters.isOfficial, true) }}: |
| 144 | + - task: MicroBuildSigningPlugin@4 |
| 145 | + displayName: 🔧 Install MicroBuild Signing Plugin |
| 146 | + inputs: |
| 147 | + signType: $(signType) |
| 148 | + zipSources: false |
| 149 | + feedSource: https://dnceng.pkgs.visualstudio.com/_packaging/MicroBuildToolset/nuget/v3/index.json |
| 150 | + azureSubscription: 'MicroBuild Signing Task (DevDiv)' |
| 151 | + # ConnectedPMEServiceName is only required for CI builds. This service name is dependent on the AzDo org as well. |
| 152 | + ${{ if eq(variables['Build.Reason'], 'IndividualCI') }}: |
| 153 | + ConnectedPMEServiceName: c24de2a5-cc7a-493d-95e4-8e5ff5cad2bc |
| 154 | + env: |
| 155 | + SignType: $(signType) |
| 156 | + TeamName: $(teamName) |
| 157 | + |
| 158 | + - pwsh: | |
| 159 | + Write-Host "Building VSIXs for channel $(channel)" |
| 160 | + if ("$(channel)" -eq "Release") { |
| 161 | + gulp vsix:release:package |
| 162 | + } else { |
| 163 | + gulp vsix:release:package --prerelease |
| 164 | + } |
| 165 | + displayName: 'Build VSIXs' |
| 166 | + env: |
| 167 | + SignType: $(signType) |
| 168 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 169 | +
|
| 170 | + - ${{ if eq(parameters.isOfficial, true) }}: |
| 171 | + - script: gulp signVsix |
| 172 | + condition: succeeded() |
| 173 | + displayName: 'Sign VSIXs' |
| 174 | + env: |
| 175 | + # Non-windows signing requires this token to be passed with signing step. |
| 176 | + SignType: $(signType) |
| 177 | + SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
| 178 | + |
| 179 | + - task: CopyFiles@2 |
| 180 | + inputs: |
| 181 | + SourceFolder: '$(Build.SourcesDirectory)/vsix' |
| 182 | + TargetFolder: '$(Build.SourcesDirectory)/Packages/VSIX_$(channel)' |
| 183 | + |
| 184 | + - ${{ if ne(parameters.isOfficial, true) }}: |
| 185 | + - task: PublishPipelineArtifact@1 |
| 186 | + condition: succeeded() |
| 187 | + displayName: 'Publish VSIXs' |
| 188 | + inputs: |
| 189 | + targetPath: '$(Build.SourcesDirectory)/Packages' |
| 190 | + artifact: 'Packages' |
| 191 | + |
| 192 | + - script: npm run test:artifacts |
| 193 | + displayName: 'Run artifacts tests' |
0 commit comments