|
| 1 | +trigger: none |
| 2 | + |
| 3 | +parameters: |
| 4 | + - name: OfficialBuild |
| 5 | + type: boolean |
| 6 | + default: false |
| 7 | + - name: disableNetworkIsolation |
| 8 | + type: boolean |
| 9 | + default: false |
| 10 | + |
| 11 | +variables: |
| 12 | + - name: ob_outputDirectory |
| 13 | + value: '$(Build.ArtifactStagingDirectory)/ONEBRANCH_ARTIFACT' |
| 14 | + - name: LinuxContainerImage |
| 15 | + value: mcr.microsoft.com/onebranch/azurelinux/build:3.0 |
| 16 | + - name: WindowsContainerImage |
| 17 | + value: onebranch.azurecr.io/windows/ltsc2022/vse2022:latest |
| 18 | + - name: templateFile |
| 19 | + value: ${{ iif ( parameters.OfficialBuild, 'v2/OneBranch.Official.CrossPlat.yml@templates', 'v2/OneBranch.NonOfficial.CrossPlat.yml@templates' ) }} |
| 20 | + - name: disableNetworkIsolation |
| 21 | + value: ${{ parameters.disableNetworkIsolation }} |
| 22 | + |
| 23 | +resources: |
| 24 | + repositories: |
| 25 | + - repository: templates |
| 26 | + type: git |
| 27 | + name: OneBranch.Pipelines/GovernedTemplates |
| 28 | + ref: refs/heads/main |
| 29 | + |
| 30 | +extends: |
| 31 | + template: ${{ variables.templateFile }} # The Official template may only be used by Production-classified pipelines |
| 32 | + |
| 33 | + parameters: |
| 34 | + release: |
| 35 | + category: NonAzure |
| 36 | + featureFlags: |
| 37 | + WindowsHostVersion: |
| 38 | + Disk: Large |
| 39 | + Version: 2022 |
| 40 | + Network: KS1 |
| 41 | + incrementalSDLBinaryAnalysis: true |
| 42 | + needExceptionForUbuntuUsage: true |
| 43 | + disableNetworkIsolation: ${{ variables.disableNetworkIsolation }} |
| 44 | + cloudvault: |
| 45 | + enabled: false |
| 46 | + globalSdl: |
| 47 | + isNativeCode: true |
| 48 | + prefast: |
| 49 | + enabled: true |
| 50 | + tsa: |
| 51 | + useDynamicRouting: true |
| 52 | + enabled: true |
| 53 | + sbom: |
| 54 | + enabled: true |
| 55 | + packageName: Microsoft.PowerShell.Native |
| 56 | + codeql: |
| 57 | + tsaEnabled: true |
| 58 | + compiled: |
| 59 | + enabled: true |
| 60 | + armory: |
| 61 | + enabled: false |
| 62 | + credscan: |
| 63 | + enabled: true |
| 64 | + scanFolder: $(Build.SourcesDirectory) |
| 65 | + binskim: |
| 66 | + enabled: true |
| 67 | + exactToolVersion: 4.4.2 |
| 68 | + apiscan: |
| 69 | + enabled: false |
| 70 | + tsaOptionsFile: .config\tsaoptions.json |
| 71 | + |
| 72 | + stages: |
| 73 | + - stage: WinBuildAndSign |
| 74 | + displayName: Windows Build and Sign |
| 75 | + jobs: |
| 76 | + - template: .pipelines/templates/build-sign-windows.yml@self |
| 77 | + parameters: |
| 78 | + ARCHITECTURE: 'x64' |
| 79 | + |
| 80 | + - template: .pipelines/templates/build-sign-windows.yml@self |
| 81 | + parameters: |
| 82 | + ARCHITECTURE: 'x86' |
| 83 | + |
| 84 | + - template: .pipelines/templates/build-sign-windows.yml@self |
| 85 | + parameters: |
| 86 | + ARCHITECTURE: 'x64_arm64' |
| 87 | + |
| 88 | + - stage: LinuxBuild |
| 89 | + displayName: Linux Build |
| 90 | + jobs: |
| 91 | + - template: .pipelines/templates/build-linux.yml@self |
| 92 | + parameters: |
| 93 | + ARCHITECTURE: 'linux-x64' |
| 94 | + Name: 'Build_Linux_x64' |
| 95 | + |
| 96 | + - template: .pipelines/templates/build-linux.yml@self |
| 97 | + parameters: |
| 98 | + ARCHITECTURE: 'linux-arm64' |
| 99 | + Name: 'Build_Linux_arm64' |
| 100 | + hostArchitecture: 'arm64' |
| 101 | + |
| 102 | + - template: .pipelines/templates/build-linux.yml@self |
| 103 | + parameters: |
| 104 | + ARCHITECTURE: 'linux-musl-x64' |
| 105 | + Name: 'Build_Linux_musl_x64' |
| 106 | + |
| 107 | + - template: .pipelines/templates/build-linux.yml@self |
| 108 | + parameters: |
| 109 | + ARCHITECTURE: 'osx' |
| 110 | + Name: 'Build_osx' |
| 111 | + |
| 112 | + - stage: LinuxBuildARM |
| 113 | + displayName: Linux ARM Build |
| 114 | + variables: |
| 115 | + - name: LinuxContainerImage |
| 116 | + value: onebranch.azurecr.io/linux/ubuntu-2204:latest |
| 117 | + |
| 118 | + jobs: |
| 119 | + - template: .pipelines/templates/build-linux.yml@self |
| 120 | + parameters: |
| 121 | + ARCHITECTURE: 'linux-arm' |
| 122 | + Name: 'Build_Linux_arm' |
| 123 | + |
| 124 | + - stage: Build_Nuget |
| 125 | + dependsOn: [WinBuildAndSign, LinuxBuild, LinuxBuildARM] |
| 126 | + displayName: Build NuGet |
| 127 | + jobs: |
| 128 | + - template: .pipelines/templates/build-nuget.yml@self |
| 129 | + |
| 130 | + - stage: Release_NuGet |
| 131 | + displayName: Release NuGet |
| 132 | + dependsOn: [Build_Nuget] |
| 133 | + variables: |
| 134 | + - name: Version |
| 135 | + value: $[ stageDependencies.Build_Nuget.Build_Nuget_Job.outputs['SetVersion.NugetPackageVersion'] ] |
| 136 | + - name: ob_release_environment |
| 137 | + value: ${{ iif ( parameters.OfficialBuild, 'Production', 'Test' ) }} |
| 138 | + jobs: |
| 139 | + - job: NuGetPublish |
| 140 | + displayName: Publish to NuGet |
| 141 | + condition: succeeded() |
| 142 | + pool: |
| 143 | + type: release |
| 144 | + os: windows |
| 145 | + templateContext: |
| 146 | + inputs: |
| 147 | + - input: pipelineArtifact |
| 148 | + artifactName: drop_Build_Nuget_Build_Nuget_Job |
| 149 | + steps: |
| 150 | + - task: PowerShell@2 |
| 151 | + inputs: |
| 152 | + targetType: inline |
| 153 | + script: | |
| 154 | + Write-Verbose -Verbose "Version: $(Version)" |
| 155 | + Get-ChildItem Env:\ |
| 156 | + displayName: 'Capture Environment Variables' |
| 157 | + |
| 158 | + - task: PowerShell@2 |
| 159 | + inputs: |
| 160 | + targetType: inline |
| 161 | + script: | |
| 162 | + $DestPath = New-Item -ItemType Directory -Path "$(Pipeline.Workspace)\release" |
| 163 | + $nupkgFile = Get-ChildItem "$(Pipeline.Workspace)\Microsoft.PowerShell.Native.*.nupkg" -Recurse |
| 164 | + if (-not $nupkgFile) { |
| 165 | + throw "No nupkg files found in '$(Pipeline.Workspace)'" |
| 166 | + } |
| 167 | +
|
| 168 | + Copy-Item $nupkgFile -Destination $DestPath -Recurse -Force -Verbose |
| 169 | + Write-Verbose -Verbose "The .nupkgs below will be pushed:" |
| 170 | + Get-ChildItem "$(Pipeline.Workspace)/release" -recurse |
| 171 | + displayName: Download and capture nupkgs |
| 172 | + |
| 173 | + - task: NuGetCommand@2 |
| 174 | + displayName: 'NuGet push' |
| 175 | + condition: and(eq('${{ parameters.OfficialBuild }}', 'true'), succeeded()) |
| 176 | + inputs: |
| 177 | + command: push |
| 178 | + packagesToPush: '$(Pipeline.Workspace)\release\*.nupkg' |
| 179 | + nuGetFeedType: external |
| 180 | + publishFeedCredentials: PowerShellNuGetOrgPush |
| 181 | + |
0 commit comments