From: Mike McLaughlin Date: Thu, 28 Jun 2018 05:05:54 +0000 (-0700) Subject: Fix internal yaml build. (#29) X-Git-Tag: submit/tizen/20190813.035844~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=56d2dafbd4be303b0ce27ce5fb733d078cc8679d;p=platform%2Fcore%2Fdotnet%2Fdiagnostics.git Fix internal yaml build. (#29) Update common eng scripts and files from arcade. Add missing is-vsts.* ones. --- diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index d384909bf..ac57defbd 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -88,6 +88,7 @@ if /i "%1" == "-rebuild" (set processedArgs=!processedArgs! %1&shift if /i "%1" == "-sign" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-restore" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-pack" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-publish" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if /i "%1" == "-preparemachine" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) if [!processedArgs!]==[] ( diff --git a/eng/build-native.sh b/eng/build-native.sh index c6e571c74..70f208ac9 100755 --- a/eng/build-native.sh +++ b/eng/build-native.sh @@ -192,7 +192,7 @@ while :; do ;; # Ignored for a native build - --rebuild|--sign|--restore|--pack|--preparemachine) + --rebuild|--sign|--restore|--pack|--publish|--preparemachine) ;; --configuration) diff --git a/eng/build.yml b/eng/build.yml index 94befe55c..959c4fe19 100644 --- a/eng/build.yml +++ b/eng/build.yml @@ -19,27 +19,30 @@ parameters: phases: - template: /eng/common/templates/phases/base.yml parameters: - phaseName: ${{ parameters.phaseName }} agentOs: ${{ parameters.agentOs }} buildReason: ${{ parameters.buildReason }} + buildConfig: $(_BuildConfig) + phaseName: ${{ parameters.phaseName }} enableTelemetry: ${{ parameters.enableTelemetry }} + fetchDepth: 5 + helixType: build/product + ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + helixSource: official/dotnet/arcade/$(Build.SourceBranch) + ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: + helixSource: pr/dotnet/arcade/$(Build.SourceBranch) phase: queue: ${{ parameters.queue }} variables: - _HelixType: build/product _DockerImageName: ${{ parameters.dockerImage }} - ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-tools-internal/index.json _TeamName: DotNetCore _UseEsrpSigning: ${{ parameters.useEsrpSigning }} - _HelixSource: official/dotnet/arcade/$(Build.SourceBranch) + ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: _PublishArgs: /p:PB_PublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) /p:PB_PublishBlobFeedUrl=$(_PublishBlobFeedUrl) /p:PB_PublishType=$(_PublishType) - ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - _HelixSource: pr/dotnet/arcade/$(Build.SourceBranch) _PublishArgs: '' steps: @@ -68,6 +71,7 @@ phases: -architecture $(_BuildArch) -prepareMachine /p:SignType=$(_SignType) + $(_PublishArgs) displayName: Build / Test env: OfficialBuildId: $(BUILD.BUILDNUMBER) @@ -83,6 +87,7 @@ phases: --architecture $(_BuildArch) --prepareMachine /p:SignType=$(_SignType) + $(_PublishArgs) displayName: Docker Build / Test env: OfficialBuildId: $(BUILD.BUILDNUMBER) @@ -95,6 +100,7 @@ phases: --architecture $(_BuildArch) --prepareMachine /p:SignType=$(_SignType) + $(_PublishArgs) displayName: Build / Test env: OfficialBuildId: $(BUILD.BUILDNUMBER) @@ -114,8 +120,12 @@ phases: displayName: Publish Logs to VSTS inputs: PathtoPublish: '$(Build.StagingDirectory)/BuildLogs' - ArtifactName: $(parameters.agentOs)_$(Agent.JobName) PublishLocation: Container + # Should be able to use a single definition of ArtifactName here instead of conditioned on + # agentOs once variables are available in the template evaluation context. + ${{ if eq(parameters.agentOs, 'Windows_NT') }}: + ArtifactName: Windows_NT_$(Agent.JobName) + ${{ if ne(parameters.agentOs, 'Windows_NT') }}: + ArtifactName: Linux_$(Agent.JobName) continueOnError: true condition: succeededOrFailed() - diff --git a/eng/common/CIBuild.cmd b/eng/common/CIBuild.cmd index 42bb58ba2..6544b0cd5 100644 --- a/eng/common/CIBuild.cmd +++ b/eng/common/CIBuild.cmd @@ -1,3 +1,3 @@ @echo off -powershell -ExecutionPolicy ByPass -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -ci %*" +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0Build.ps1""" -restore -build -test -sign -pack -publish -ci %*" exit /b %ErrorLevel% diff --git a/eng/common/build.ps1 b/eng/common/build.ps1 index a30255639..c6bebef2f 100644 --- a/eng/common/build.ps1 +++ b/eng/common/build.ps1 @@ -2,7 +2,7 @@ Param( [string] $architecture = "", [string] $configuration = "Debug", - [string] $solution = "", + [string] $projects = "", [string] $verbosity = "minimal", [switch] $restore, [switch] $deployDeps, @@ -11,8 +11,10 @@ Param( [switch] $deploy, [switch] $test, [switch] $integrationTest, + [switch] $performanceTest, [switch] $sign, [switch] $pack, + [switch] $publish, [switch] $ci, [switch] $prepareMachine, [switch] $help, @@ -26,6 +28,7 @@ $ErrorActionPreference = "Stop" function Print-Usage() { Write-Host "Common settings:" Write-Host " -configuration Build configuration Debug, Release" + Write-Host " -architecture Build architecture x64, x86, arm, arm64" Write-Host " -verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" Write-Host " -help Print help and exit" Write-Host "" @@ -37,13 +40,15 @@ function Print-Usage() { Write-Host " -deploy Deploy built VSIXes" Write-Host " -deployDeps Deploy dependencies (e.g. VSIXes for integration tests)" Write-Host " -test Run all unit tests in the solution" + Write-Host " -pack Package build outputs into NuGet packages and Willow components" Write-Host " -integrationTest Run all integration tests in the solution" + Write-Host " -performanceTest Run all performance tests in the solution" Write-Host " -sign Sign build outputs" - Write-Host " -pack Package build outputs into NuGet packages and Willow components" + Write-Host " -publish Publish artifacts (e.g. symbols)" Write-Host "" Write-Host "Advanced settings:" - Write-Host " -solution Path to solution to build" + Write-Host " -projects Semi-colon delimited list of sln/proj's to build. Globbing is supported (*.sln)" Write-Host " -ci Set when running on CI server" Write-Host " -prepareMachine Prepare machine for CI run" Write-Host "" @@ -71,7 +76,7 @@ function InitializeDotNetCli { # Source Build uses DotNetCoreSdkDir variable if ($env:DotNetCoreSdkDir -ne $null) { - $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir + $env:DOTNET_INSTALL_DIR = $env:DotNetCoreSdkDir } # Use dotnet installation specified in DOTNET_INSTALL_DIR if it contains the required SDK version, @@ -83,22 +88,27 @@ function InitializeDotNetCli { $env:DOTNET_INSTALL_DIR = $dotnetRoot if ($restore) { - InstallDotNetCli $dotnetRoot + InstallDotNetSdk $dotnetRoot $GlobalJson.sdk.version } } - $global:BuildDriver = Join-Path $dotnetRoot "dotnet.exe" - $global:BuildArgs = "msbuild" + return $dotnetRoot } -function InstallDotNetCli([string] $dotnetRoot) { +function GetDotNetInstallScript([string] $dotnetRoot) { $installScript = "$dotnetRoot\dotnet-install.ps1" if (!(Test-Path $installScript)) { Create-Directory $dotnetRoot Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile $installScript } + + return $installScript +} + +function InstallDotNetSdk([string] $dotnetRoot, [string] $version) { + $installScript = GetDotNetInstallScript $dotnetRoot - & $installScript -Version $GlobalJson.sdk.version -InstallDir $dotnetRoot -Architecture $architecture + & $installScript -Version $version -InstallDir $dotnetRoot -Architecture $architecture if ($lastExitCode -ne 0) { Write-Host "Failed to install dotnet cli (exit code '$lastExitCode')." -ForegroundColor Red exit $lastExitCode @@ -118,8 +128,7 @@ function InitializeVisualStudioBuild { $env:VSSDKInstall = Join-Path $vsInstallDir "VSSDK\" } - $global:BuildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" - $global:BuildArgs = "/nodeReuse:$(!$ci)" + return $vsInstallDir; } function LocateVisualStudio { @@ -144,12 +153,41 @@ function LocateVisualStudio { return $vsInstallDir } -function InitializeToolset { +function GetBuildCommand() { + if ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) { + $dotnetRoot = InitializeDotNetCli + + # by default build with dotnet cli: + $buildDriver = Join-Path $dotnetRoot "dotnet.exe" + $buildArgs = "msbuild" + } + + if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) { + $vsInstallDir = InitializeVisualStudioBuild + + # Presence of vswhere.version indicates the repo needs to build using VS msbuild: + $buildDriver = Join-Path $vsInstallDir "MSBuild\15.0\Bin\msbuild.exe" + $buildArgs = "/nodeReuse:$(!$ci)" + } + + if ($buildDriver -eq $null) { + Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red + exit 1 + } + + if ($ci) { + Write-Host "Using $buildDriver" + } + + return $buildDriver, $buildArgs +} + +function InitializeToolset([string] $buildDriver, [string]$buildArgs) { $toolsetVersion = $GlobalJson.'msbuild-sdks'.'RoslynTools.RepoToolset' $toolsetLocationFile = Join-Path $ToolsetDir "$toolsetVersion.txt" if (Test-Path $toolsetLocationFile) { - $path = Get-Content $toolsetLocationFile + $path = Get-Content $toolsetLocationFile -TotalCount 1 if (Test-Path $path) { $global:ToolsetBuildProj = $path return @@ -164,21 +202,58 @@ function InitializeToolset { $proj = Join-Path $ToolsetDir "restore.proj" '' | Set-Content $proj - & $BuildDriver $BuildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile + & $buildDriver $buildArgs $proj /t:__WriteToolsetLocation /m /nologo /clp:None /warnaserror /bl:$ToolsetRestoreLog /v:$verbosity /p:__ToolsetLocationOutputFile=$toolsetLocationFile if ($lastExitCode -ne 0) { - Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -Color Red + Write-Host "Failed to restore toolset (exit code '$lastExitCode')." -ForegroundColor Red Write-Host "Build log: $ToolsetRestoreLog" -ForegroundColor DarkGray exit $lastExitCode } - $global:ToolsetBuildProj = Get-Content $toolsetLocationFile + $path = Get-Content $toolsetLocationFile -TotalCount 1 + if (!(Test-Path $path)) { + throw "Invalid toolset path: $path" + } + + $global:ToolsetBuildProj = $path } -function Build { - & $BuildDriver $BuildArgs $ToolsetBuildProj /m /nologo /clp:Summary /warnaserror /v:$verbosity /bl:$Log /p:Configuration=$configuration /p:Projects=$solution /p:RepoRoot=$RepoRoot /p:Restore=$restore /p:DeployDeps=$deployDeps /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:IntegrationTest=$integrationTest /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci $properties +function InitializeCustomToolset { + if (-not $restore) { + return + } + + $script = Join-Path $EngRoot "RestoreToolset.ps1" + + if (Test-Path $script) { + . $script + } +} + +function Build([string] $buildDriver, [string]$buildArgs) { + & $buildDriver $buildArgs $ToolsetBuildProj ` + /m /nologo /clp:Summary /warnaserror ` + /v:$verbosity ` + /bl:$BuildLog ` + /p:Configuration=$configuration ` + /p:Projects=$projects ` + /p:RepoRoot=$RepoRoot ` + /p:Restore=$restore ` + /p:DeployDeps=$deployDeps ` + /p:Build=$build ` + /p:Rebuild=$rebuild ` + /p:Deploy=$deploy ` + /p:Test=$test ` + /p:Pack=$pack ` + /p:IntegrationTest=$integrationTest ` + /p:PerformanceTest=$performanceTest ` + /p:Sign=$sign ` + /p:Publish=$publish ` + /p:CIBuild=$ci ` + $properties + if ($lastExitCode -ne 0) { - Write-Host "Build log: $Log" -ForegroundColor DarkGray + Write-Host "Build log: $BuildLog" -ForegroundColor DarkGray exit $lastExitCode } } @@ -192,16 +267,17 @@ function Stop-Processes() { try { $RepoRoot = Join-Path $PSScriptRoot "..\.." + $EngRoot = Join-Path $PSScriptRoot ".." $ArtifactsDir = Join-Path $RepoRoot "artifacts" $ToolsetDir = Join-Path $ArtifactsDir "toolset" $LogDir = Join-Path (Join-Path $ArtifactsDir $configuration) "log" - $Log = Join-Path $LogDir "Build.binlog" + $BuildLog = Join-Path $LogDir "Build.binlog" $ToolsetRestoreLog = Join-Path $LogDir "ToolsetRestore.binlog" $TempDir = Join-Path (Join-Path $ArtifactsDir $configuration) "tmp" - $GlobalJson = Get-Content(Join-Path $RepoRoot "global.json") | ConvertFrom-Json + $GlobalJson = Get-Content -Raw -Path (Join-Path $RepoRoot "global.json") | ConvertFrom-Json - if ($solution -eq "") { - $solution = Join-Path $RepoRoot "*.sln" + if ($projects -eq "") { + $projects = Join-Path $RepoRoot "*.sln" } if ($env:NUGET_PACKAGES -eq $null) { @@ -219,24 +295,11 @@ try { $env:TEMP = $TempDir $env:TMP = $TempDir } - - # Presence of vswhere.version indicates the repo needs to build using VS msbuild - if ((Get-Member -InputObject $GlobalJson -Name "vswhere") -ne $null) { - InitializeVisualStudioBuild - } elseif ((Get-Member -InputObject $GlobalJson -Name "sdk") -ne $null) { - InitializeDotNetCli - } else { - Write-Host "/global.json must either specify 'sdk.version' or 'vswhere.version'." -ForegroundColor Red - exit 1 - } - - if ($ci) { - Write-Host "Using $BuildDriver" - } - - InitializeToolset - Build + $driver, $args = GetBuildCommand + InitializeToolset $driver $args + InitializeCustomToolset + Build $driver $args } catch { Write-Host $_ diff --git a/eng/common/build.sh b/eng/common/build.sh index af7f7e18b..de864bd93 100755 --- a/eng/common/build.sh +++ b/eng/common/build.sh @@ -12,18 +12,21 @@ while [[ -h "$source" ]]; do done repo_root="$( cd -P "$( dirname "$source" )/../.." && pwd )" +help=false +restore=false build=false +rebuild=false +test=false +pack=false +integration_test=false +performance_test=false +sign=false +public=false ci=false + +projects='' configuration='Debug' -architecture='' -help=false -pack=false prepare_machine=false -rebuild=false -restore=false -sign=false -solution='' -test=false verbosity='minimal' properties='' @@ -49,6 +52,7 @@ while (($# > 0)); do --help) echo "Common settings:" echo " --configuration Build configuration Debug, Release" + echo " --architecture Build architecture x64, x86, arm, arm64" echo " --verbosity Msbuild verbosity (q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic])" echo " --help Print help and exit" echo "" @@ -96,6 +100,18 @@ while (($# > 0)); do test=true shift 1 ;; + --integrationtest) + integration_test=true + shift 1 + ;; + --performancetest) + performance_test=true + shift 1 + ;; + --publish) + publish=true + shift 1 + ;; --verbosity) verbosity=$2 shift 2 @@ -107,11 +123,12 @@ while (($# > 0)); do esac done +eng_root="$repo_root/eng" artifacts_dir="$repo_root/artifacts" artifacts_configuration_dir="$artifacts_dir/$configuration" toolset_dir="$artifacts_dir/toolset" log_dir="$artifacts_configuration_dir/log" -log="$log_dir/Build.binlog" +build_log="$log_dir/Build.binlog" toolset_restore_log="$log_dir/ToolsetRestore.binlog" temp_dir="$artifacts_configuration_dir/tmp" @@ -165,36 +182,46 @@ function InitializeDotNetCli { export DOTNET_INSTALL_DIR="$dotnet_root" if [[ "$restore" == true ]]; then - InstallDotNetCli $dotnet_root $dotnet_sdk_version + InstallDotNetSdk $dotnet_root $dotnet_sdk_version $architecture fi fi build_driver="$dotnet_root/dotnet" } -function InstallDotNetCli { - local dotnet_root=$1 - local dotnet_sdk_version=$2 - local dotnet_install_script="$dotnet_root/dotnet-install.sh" +function InstallDotNetSdk { + local root=$1 + local version=$2 + local arch=$3 - if [[ ! -a "$dotnet_install_script" ]]; then - mkdir -p "$dotnet_root" + local install_script=`GetDotNetInstallScript $root` + + bash "$install_script" --version $version --install-dir $root --architecture $arch + local lastexitcode=$? + + if [[ $lastexitcode != 0 ]]; then + echo "Failed to install dotnet SDK (exit code '$lastexitcode')." + ExitWithExitCode $lastexitcode + fi +} + +function GetDotNetInstallScript { + local root=$1 + local install_script="$root/dotnet-install.sh" + + if [[ ! -a "$install_script" ]]; then + mkdir -p "$root" # Use curl if available, otherwise use wget if command -v curl > /dev/null; then - curl "https://raw.githubusercontent.com/dotnet/cli/release/2.1.4xx/scripts/obtain/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$dotnet_install_script" + curl "https://dot.net/v1/dotnet-install.sh" -sSL --retry 10 --create-dirs -o "$install_script" else - wget -q -O "$dotnet_install_script" "https://raw.githubusercontent.com/dotnet/cli/release/2.1.4xx/scripts/obtain/dotnet-install.sh" + wget -q -O "$install_script" "https://dot.net/v1/dotnet-install.sh" fi fi - bash "$dotnet_install_script" --version $dotnet_sdk_version --install-dir $dotnet_root --architecture $architecture - local lastexitcode=$? - - if [[ $lastexitcode != 0 ]]; then - echo "Failed to install dotnet cli (exit code '$lastexitcode')." - ExitWithExitCode $lastexitcode - fi + # return value + echo "$install_script" } function InitializeToolset { @@ -227,12 +254,40 @@ function InitializeToolset { fi toolset_build_proj=`cat $toolset_location_file` + + if [[ ! -a "$toolset_build_proj" ]]; then + echo "Invalid toolset path: $toolset_build_proj" + ExitWithExitCode 3 + fi +} + +function InitializeCustomToolset { + local script="$eng_root/RestoreToolset.sh" + + if [[ -a "$script" ]]; then + . "$script" + fi } function Build { - "$build_driver" msbuild $toolset_build_proj /m /nologo /clp:Summary /warnaserror \ - /v:$verbosity /bl:$log /p:Configuration=$configuration /p:Projects=$solution /p:RepoRoot="$repo_root" \ - /p:Restore=$restore /p:Build=$build /p:Rebuild=$rebuild /p:Deploy=$deploy /p:Test=$test /p:Sign=$sign /p:Pack=$pack /p:CIBuild=$ci \ + "$build_driver" msbuild $toolset_build_proj \ + /m /nologo /clp:Summary /warnaserror \ + /v:$verbosity \ + /bl:$build_log \ + /p:Configuration=$configuration \ + /p:Projects=$projects \ + /p:RepoRoot="$repo_root" \ + /p:Restore=$restore \ + /p:Build=$build \ + /p:Rebuild=$rebuild \ + /p:Deploy=$deploy \ + /p:Test=$test \ + /p:Pack=$pack \ + /p:IntegrationTest=$integration_test \ + /p:PerformanceTest=$performance_test \ + /p:Sign=$sign \ + /p:Publish=$publish \ + /p:CIBuild=$ci \ $properties local lastexitcode=$? @@ -262,8 +317,8 @@ function Main { mkdir -p "$HOME" fi - if [[ -z $solution ]]; then - solution="$repo_root/*.sln" + if [[ -z $projects ]]; then + projects="$repo_root/*.sln" fi if [[ -z $NUGET_PACKAGES ]]; then @@ -285,6 +340,7 @@ function Main { InitializeDotNetCli InitializeToolset + InitializeCustomToolset Build ExitWithExitCode $? diff --git a/eng/common/cibuild.sh b/eng/common/cibuild.sh index b5112539e..66e3b0ac6 100755 --- a/eng/common/cibuild.sh +++ b/eng/common/cibuild.sh @@ -13,4 +13,4 @@ while [[ -h $source ]]; do done scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" -. "$scriptroot/build.sh" --restore --build --test --ci $@ \ No newline at end of file +. "$scriptroot/build.sh" --restore --build --test --pack --publish --ci $@ diff --git a/eng/common/is-vsts.ps1 b/eng/common/is-vsts.ps1 new file mode 100644 index 000000000..f88472955 --- /dev/null +++ b/eng/common/is-vsts.ps1 @@ -0,0 +1,6 @@ +if ($env:Build_BuildNumber) { + return $true +} +else { + return $false +} diff --git a/eng/common/is-vsts.sh b/eng/common/is-vsts.sh new file mode 100644 index 000000000..f7086fae0 --- /dev/null +++ b/eng/common/is-vsts.sh @@ -0,0 +1,5 @@ +if [ ! -z $BUILD_BUILDNUMBER ]; then + exit 0 +else + exit 1 +fi diff --git a/eng/common/templates/phases/base.yml b/eng/common/templates/phases/base.yml index 783dcb9e1..de9c31995 100644 --- a/eng/common/templates/phases/base.yml +++ b/eng/common/templates/phases/base.yml @@ -2,16 +2,24 @@ # Description: Expands a phase object, applying telemetry, docker info, etc... # Parameters: # agentOs: [Windows_NT (default), Linux, OSX] Used in templates to define variables which are OS specific +# buildConfig: buildConfiguration property provided to telemetry # dockerImage: If defined, specifies docker image to run build steps in # enableTelemetry: send telemetry if build is not a PR or CI build +# fetchDepth: Limit fetching to the specified number of commits from the tip of each remote branch history +# helixSource: telemetry source to report +# helixType: telemetry type to report # phaseName: name of phase # phase: defined phase object parameters: agentOs: Windows_NT buildReason: IndividualCI + buildConfig: '' dockerImage: '' enableTelemetry: '' + fetchDepth: '' + helixSource: 'undefined_defaulted_in_base.yml' + helixType: 'undefined_defaulted_in_base.yml' phaseName: '' phase: {} @@ -27,14 +35,18 @@ phases: steps: - checkout: self clean: true - fetchDepth: 5 + ${{ if ne(parameters.fetchDepth, '') }}: + fetchDepth: ${{ parameters.fetchDepth }} - ${{ if notIn(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - ${{ if eq(parameters.enableTelemetry, 'true') }}: - template: /eng/common/templates/steps/telemetry.yml parameters: agentOs: ${{ parameters.agentOs }} + buildConfig: ${{ parameters.buildConfig }} + helixSource: ${{ parameters.helixSource }} + helixType: ${{ parameters.helixType }} steps: ${{ parameters.phase.steps }} - ${{ if not(eq(parameters.enableTelemetry, 'true')) }}: - - ${{ parameters.phase.steps }} + - ${{ parameters.phase.steps }} - ${{ if in(parameters.buildReason, 'IndividualCI', 'BatchedCI', 'PullRequest') }}: - - ${{ parameters.phase.steps }} + - ${{ parameters.phase.steps }} diff --git a/eng/common/templates/steps/telemetry.yml b/eng/common/templates/steps/telemetry.yml index d258a216b..e3de7bc5a 100644 --- a/eng/common/templates/steps/telemetry.yml +++ b/eng/common/templates/steps/telemetry.yml @@ -1,6 +1,9 @@ parameters: agentOs: Windows_NT + helixSource: 'undefined_defaulted_in_telemetry.yml' + helixType: 'undefined_defaulted_in_telemetry.yml' + buildConfig: '' steps: [] steps: @@ -20,20 +23,21 @@ steps: displayName: Send Job Start Telemetry env: HelixApiAccessToken: $(HelixApiAccessToken) - Source: $(_HelixSource) - Type: $(_HelixType) + Source: ${{ parameters.helixSource }} + Type: ${{ parameters.helixType }} Build: $(Build.BuildNumber) - QueueId: $(Agent.OS) + QueueId: ${{ parameters.agentOs }} Attempt: 1 - OperatingSystem: $(Agent.OS) - Configuration: $(_BuildConfig) + OperatingSystem: ${{ parameters.agentOs }} + Configuration: ${{ parameters.buildConfig }} condition: always() - bash: | /bin/bash ./telemetry/build/start.sh --build-uri "$BuildUri" workingDirectory: $(Build.SourcesDirectory)/eng/common displayName: Send Build Start Telemetry env: - BuildUri: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=$(Build.BuildId)&_a=summary + BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary + # defined via VSTS variables in start-job.sh Helix_JobToken: $(Helix_JobToken) condition: always() @@ -44,6 +48,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/eng/common displayName: Send Build End Telemetry env: + # defined via VSTS variables in start-job.sh Helix_JobToken: $(Helix_JobToken) Helix_WorkItemId: $(Helix_WorkItemId) condition: always() @@ -66,13 +71,13 @@ steps: displayName: Send Job Start Telemetry env: HelixApiAccessToken: $(HelixApiAccessToken) - Source: $(HelixSource) - Type: $(HelixType) + Source: ${{ parameters.helixSource }} + Type: ${{ parameters.helixType }} Build: $(Build.BuildNumber) - QueueId: $(Agent.OS) + QueueId: ${{ parameters.agentOs }} Attempt: 1 - OperatingSystem: $(Agent.OS) - Configuration: $(_BuildConfig) + OperatingSystem: ${{ parameters.agentOs }} + Configuration: ${{ parameters.buildConfig }} condition: always() - powershell: | ./telemetry/build/start.ps1 -BuildUri $env:BuildUri @@ -82,7 +87,8 @@ steps: workingDirectory: $(Build.SourcesDirectory)/eng/common displayName: Send Build Start Telemetry env: - BuildUri: https://devdiv.visualstudio.com/DevDiv/_build/index?buildId=$(Build.BuildId)&_a=summary + BuildUri: $(System.TaskDefinitionsUri)$(System.TeamProject)/_build/index?buildId=$(Build.BuildId)&_a=summary + # defined via VSTS variables in start-job.ps1 Helix_JobToken: $(Helix_JobToken) condition: always() @@ -96,6 +102,7 @@ steps: workingDirectory: $(Build.SourcesDirectory)/eng/common displayName: Send Build End Telemetry env: + # defined via VSTS variables in start-job.ps1 Helix_JobToken: $(Helix_JobToken) Helix_WorkItemId: $(Helix_WorkItemId) condition: always() diff --git a/src/Directory.Build.targets b/src/Directory.Build.targets deleted file mode 100644 index c709187cf..000000000 --- a/src/Directory.Build.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - -