diff --git a/.azure/pipelines/ci.yml b/.azure/pipelines/ci.yml index 3b987a83011b..b01d9f2640fa 100644 --- a/.azure/pipelines/ci.yml +++ b/.azure/pipelines/ci.yml @@ -766,56 +766,12 @@ stages: includeForks: true # Source build - - job: Source_Build - displayName: 'Test: Linux Source Build' - container: centos:7 - pool: - vmImage: 'ubuntu-18.04' - variables: - LC_ALL: 'en_US.UTF-8' - LANG: 'en_US.UTF-8' - LANGUAGE: 'en_US.UTF-8' - DotNetCoreSdkDir: $(Agent.ToolsDirectory)/dotnet - # This isn't needed in the path because build does not need to _use_ global tools. - DOTNET_CLI_HOME: $(System.DefaultWorkingDirectory) - DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true - steps: - - script: | - source eng/common/native/common-library.sh - mkdir -p $(System.DefaultWorkingDirectory)/.tools - GetFile https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 $(System.DefaultWorkingDirectory)/.tools/jq - chmod +x $(System.DefaultWorkingDirectory)/.tools/jq - echo "##vso[task.prependpath]$(System.DefaultWorkingDirectory)/.tools" - displayName: Install jq - - ${{ if ne(variables['System.TeamProject'], 'public') }}: - - task: Bash@3 - displayName: Setup Private Feeds Credentials - inputs: - filePath: $(Build.SourcesDirectory)/eng/common/SetupNugetSources.sh - arguments: $(Build.SourcesDirectory)/NuGet.config $Token - env: - Token: $(dn-bot-dnceng-artifact-feeds-rw) - - script: ./eng/scripts/ci-source-build.sh --ci --nobl --configuration Release /p:BuildManaged=true /p:BuildNodeJs=false $(_InternalRuntimeDownloadArgs) - displayName: Run ci-source-build.sh - - task: PublishBuildArtifacts@1 - displayName: Upload logs - condition: always() - continueOnError: true - inputs: - pathtoPublish: artifacts/log/ - artifactName: Source_Build_Logs - artifactType: Container - parallel: true - - task: PublishBuildArtifacts@1 - displayName: Upload package artifacts - # Only capture source build artifacts in PRs for the sake of inspecting - # changes that impact source-build. The artifacts from this build pipeline are never actually used. - condition: and(succeeded(), in(variables['Build.Reason'], 'PullRequest')) - inputs: - pathtoPublish: artifacts/packages/ - artifactName: Source_Build_Packages - artifactType: Container - parallel: true + - template: /eng/common/templates/job/source-build.yml + parameters: + platform: + name: 'Managed' + container: 'mcr.microsoft.com/dotnet-buildtools/prereqs:centos-7-f39df28-20191023143754' + buildScript: './eng/build.sh' # Publish to the BAR - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: @@ -844,7 +800,7 @@ stages: - Linux_musl_arm_build - Linux_musl_arm64_build # In addition to the dependencies above, ensure the build was successful overall. - - Source_Build + - Source_Build_Managed pool: vmImage: vs2017-win2016 publishUsingPipelines: ${{ variables._PublishUsingPipelines }} diff --git a/eng/scripts/ci-source-build.sh b/eng/scripts/ci-source-build.sh deleted file mode 100755 index 96516d187a60..000000000000 --- a/eng/scripts/ci-source-build.sh +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env bash - - # -# This script is meant for testing source build by imitating some of the input parameters and conditions. -# - -set -euo pipefail - -scriptroot="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -reporoot="$(dirname "$(dirname "$scriptroot")")" - -# -# This commented out section is used for servicing branches -# -# For local development, make a backup copy of this file first -# if [ ! -f "$reporoot/global.bak.json" ]; then -# mv "$reporoot/global.json" "$reporoot/global.bak.json" -# fi - -# Detect the current version of .NET Core installed -# export SDK_VERSION=$(dotnet --version) -# echo "The ambient version of .NET Core SDK version = $SDK_VERSION" - -# Update the global.json file to match the current .NET environment -# cat "$reporoot/global.bak.json" | \ -# jq '.sdk.version=env.SDK_VERSION' | \ -# jq '.tools.dotnet=env.SDK_VERSION' | \ -# jq 'del(.tools.runtimes)' \ -# > "$reporoot/global.json" - -# Restore the original global.json file -#trap "{ -# mv "$reporoot/global.bak.json" "$reporoot/global.json" -#}" EXIT - -runtime_source_feed='' -runtime_source_feed_key='' -other_args=() - -# -# Functions -# -__usage() { - echo "Usage: $(basename "${BASH_SOURCE[0]}") [options] [[--] ...] - -Arguments: - ... Arguments passed to the command. Variable number of arguments allowed. - - --runtime-source-feed Additional feed that can be used when downloading .NET runtimes and SDKs - --runtime-source-feed-key Key for feed that can be used when downloading .NET runtimes and SDKs - -Description: - This script is meant for testing source build by imitating some of the input parameters and conditions. -" - - if [[ "${1:-}" != '--no-exit' ]]; then - exit 2 - fi -} - -__error() { - echo -e "${RED}error: $*${RESET}" 1>&2 -} - -# -# main -# - -while [[ $# -gt 0 ]]; do - opt="$(echo "${1/#--/-}" | awk '{print tolower($0)}')" - case "$opt" in - -\?|-h|-help) - __usage --no-exit - exit 0 - ;; - -dotnet-runtime-source-feed|-dotnetruntimesourcefeed|-runtime_source_feed|-runtimesourcefeed) - shift - [ -z "${1:-}" ] && __error "Missing value for parameter --runtime-source-feed" && __usage - runtime_source_feed="${1:-}" - ;; - -dotnet-runtime-source-feed-key|-dotnetruntimesourcefeedkey|-runtime_source_feed_key|-runtimesourcefeedkey) - shift - [ -z "${1:-}" ] && __error "Missing value for parameter --runtime-source-feed-key" && __usage - runtime_source_feed_key="${1:-}" - ;; - *) - other_args[${#other_args[*]}]="$1" - ;; - esac - shift -done - -# Set up additional runtime args -runtime_feed_args=() -if [ ! -z "$runtime_source_feed$runtime_source_feed_key" ]; then - runtime_feed_args[${#runtime_feed_args[*]}]="-runtimesourcefeed" - runtime_feed_args[${#runtime_feed_args[*]}]="$runtime_source_feed" - runtime_feed_args[${#runtime_feed_args[*]}]="-runtimesourcefeedKey" - runtime_feed_args[${#runtime_feed_args[*]}]="$runtime_source_feed_key" - - runtimeFeedArg="/p:DotNetRuntimeSourceFeed=$runtime_source_feed" - runtimeFeedKeyArg="/p:DotNetRuntimeSourceFeedKey=$runtime_source_feed_key" - runtime_feed_args[${#runtime_feed_args[*]}]=$runtimeFeedArg - runtime_feed_args[${#runtime_feed_args[*]}]=$runtimeFeedKeyArg -fi - -# Build repo tasks -"$reporoot/eng/common/build.sh" --restore --build --ci --configuration Release /p:ProjectToBuild=$reporoot/eng/tools/RepoTasks/RepoTasks.csproj ${runtime_feed_args[@]+"${runtime_feed_args[@]}"} - -export DotNetBuildFromSource='true' - -# Build projects -"$reporoot/eng/common/build.sh" --restore --build --ci --pack ${other_args[@]+"${other_args[@]}"} ${runtime_feed_args[@]+"${runtime_feed_args[@]}"}