parameters: buildConfig: '' archType: '' osGroup: '' osIdentifier: '' containerName: '' crossrootfsDir: '' timeoutInMinutes: '' ### Product build jobs: - template: xplat-job.yml parameters: buildConfig: ${{ parameters.buildConfig }} archType: ${{ parameters.archType }} osGroup: ${{ parameters.osGroup }} osIdentifier: ${{ parameters.osIdentifier }} enableMicrobuild: true # Compute job name from template parameters name: ${{ format('build_{0}_{1}_{2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }} displayName: ${{ format('Build {0} {1} {2}', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }} # FreeBSD builds are disabled in the public project because we # don't have any FreeBSD agents in the public pool. ${{ if and(eq(parameters.osGroup, 'FreeBSD'), eq(variables['System.TeamProject'], 'public')) }}: condition: false # Run all steps in the container. # Note that the containers are resources defined in azure-pipelines.yml containerName: ${{ parameters.containerName }} timeoutInMinutes: ${{ parameters.timeoutInMinutes }} crossrootfsDir: ${{ parameters.crossrootfsDir }} gatherAssetManifests: true variables: - name: osIdentifier value: ${{ parameters.osIdentifier }} - name: stripSymbolsArg value: '' # Strip symbols only on the release build - ${{ if eq(parameters.buildConfig, 'Release') }}: - name: stripSymbolsArg value: '-stripsymbols' - name: portableBuildArg value: '' # Ensure that we produce os-specific packages for the following distros: - ${{ if in(parameters.osIdentifier, 'Linux_rhel6', 'Linux_musl') }}: - name: portableBuildArg value: '-portablebuild=false' - name: clangArg value: '' # Our FreeBSD doesn't yet detect available clang versions, so pass it explicitly. - ${{ if eq(parameters.osGroup, 'FreeBSD') }}: - name: clangArg value: '-clang6.0' - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: # Variables used to publish packages to blob feed - name: dotnetfeedUrl value: https://dotnetfeed.blob.core.windows.net/dotnet-coreclr/index.json - name: dotnetfeedPAT value: $(dotnetfeed-storage-access-key-1) # Variables used by arcade to gather asset manifests - name: _DotNetPublishToBlobFeed value: true - name: _BuildConfig value: $(buildConfigUpper) steps: # Install native dependencies # Linux builds use docker images with dependencies preinstalled, # and FreeBSD builds use a build agent with dependencies # preinstalled, so we only need this step for OSX and Windows. - ${{ if eq(parameters.osGroup, 'OSX') }}: - script: sh eng/install-native-dependencies.sh $(osGroup) displayName: Install native dependencies - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # Necessary to install python - script: eng\common\init-tools-native.cmd -InstallDirectory $(Build.SourcesDirectory)\native-tools -Force displayName: Install native dependencies # Build - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - script: ./build.sh $(buildConfig) $(archType) $(crossArg) -skiptests -skipnuget $(clangArg) $(stripSymbolsArg) displayName: Build product ${{ if eq(parameters.osGroup, 'FreeBSD') }}: env: # init-tools.sh extracts an SDK from here to the Tools/dotnetcli folder instead of trying to restore it. # Once we are using Arcade, use DotNetCoreSdkDir instead, as we do below. DotNetBootstrapCliTarPath: /dotnet-sdk-freebsd-x64.tar - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # TODO: IBCOptimize? EnforcePGO? pass an OfficialBuildId? SignType? file logging parameters? - script: set __TestIntermediateDir=int&&build.cmd $(buildConfig) $(archType) -skiptests -skipbuildpackages displayName: Build product # Sign on Windows - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest'), eq(parameters.osGroup, 'Windows_NT')) }}: - script: powershell eng\common\build.ps1 -ci -sign -restore -configuration:$(buildConfig) -warnaserror:0 /p:ArcadeBuild=true /p:OfficialBuild=true /p:BuildOS=$(osGroup) /p:BuildArch=$(archType) /p:BuildType=$(buildConfigUpper) /p:DotNetSignType=%_SignType% -projects $(Build.SourcesDirectory)\eng\empty.proj displayName: Sign Binaries - task: PublishBuildArtifacts@1 displayName: Publish Signing Logs to VSTS inputs: PathtoPublish: '$(Build.SourcesDirectory)/artifacts/' PublishLocation: Container ArtifactName: $(Agent.Os)_$(Agent.JobName)_$(archType) continueOnError: true condition: always() # Upload build as pipeline artifact - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - task: PublishPipelineArtifact@0 displayName: Save product build as pipeline artifact inputs: artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }} targetPath: $(Build.SourcesDirectory)/bin/Product/$(osGroup).$(archType).$(buildConfigUpper) - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - task: PublishPipelineArtifact@0 displayName: Save product build as pipeline artifact inputs: artifactName: ${{ format('{0}_{1}_{2}_build', parameters.osIdentifier, parameters.archType, parameters.buildConfig) }} targetPath: $(Build.SourcesDirectory)\bin\Product\$(osGroup).$(archType).$(buildConfigUpper) # Get key vault secrets for publishing - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: - task: AzureKeyVault@1 inputs: azureSubscription: 'DotNet-Engineering-Services_KeyVault' KeyVaultName: EngKeyVault SecretsFilter: 'dotnetfeed-storage-access-key-1,microsoft-symbol-server-pat,symweb-symbol-server-pat' # Build packages and publish official build - ${{ if and(ne(variables['System.TeamProject'], 'public'), ne(variables['Build.Reason'], 'PullRequest')) }}: - ${{ if ne(parameters.osGroup, 'Windows_NT') }}: - script: ./build-packages.sh -BuildArch=$(archType) -BuildType=$(buildConfigUpper) $(crossPackagesArg) -OfficialBuildId=$(Build.BuildNumber) $(portableBuildArg) displayName: Build packages - script: ./eng/common/build.sh /p:DotNetPublishToBlobFeed=true --ci --restore --projects $(Build.SourcesDirectory)/eng/empty.proj displayName: Restore blob feed tasks ${{ if eq(parameters.osGroup, 'FreeBSD') }}: env: # Arcade uses this SDK instead of trying to restore one. DotNetCoreSdkDir: /usr/local/dotnet - script: ./eng/common/msbuild.sh --ci src/publishwitharcade.proj /p:__BuildType=$(buildConfigUpper) /p:__BuildArch=$(archType) /p:__BuildOS=$(osGroup) /p:OSIdentifier=$(osIdentifier) /p:AzureFeedUrl=$(dotnetfeedUrl) /p:AzureAccountKey=$(dotnetfeedPAT) displayName: Publish packages to blob feed env: # TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed NUGET_PACKAGES: $(Build.SourcesDirectory)/.packages ${{ if eq(parameters.osGroup, 'FreeBSD') }}: # Arcade uses this SDK instead of trying to restore one. DotNetCoreSdkDir: /usr/local/dotnet - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: # TODO: pass publish feed url and access token in from the internal pipeline - script: build-packages.cmd -BuildArch=$(archType) -BuildType=$(buildConfigUpper) -OfficialBuildId=$(Build.BuildNumber) displayName: Build packages - powershell: eng\common\build.ps1 /p:DotNetPublishToBlobFeed=true -ci -restore -projects $(Build.SourcesDirectory)\eng\empty.proj displayName: Restore blob feed tasks - powershell: eng\common\msbuild.ps1 -ci src\publishwitharcade.proj /p:__BuildType=$(buildConfigUpper) /p:__BuildArch=$(archType) /p:OSIdentifier=$(osIdentifier) /p:AzureFeedUrl=$(dotnetfeedUrl) /p:AzureAccountKey=$(dotnetfeedPAT) displayName: Publish packages to blob feed env: # TODO: remove NUGET_PACKAGES once https://github.com/dotnet/arcade/issues/1578 is fixed NUGET_PACKAGES: $(Build.SourcesDirectory)\.packages # Kill tasks that hold onto files on Windows. Otherwise git clean # may fail for later jobs on the same agent. - ${{ if eq(parameters.osGroup, 'Windows_NT') }}: - script: eng/kill_tasks.cmd displayName: Kill tasks that hold on to files condition: always()