Avoid changing global state in CI runs II (#21643)
* Avoid changing global state in CI runs II
- move `dotnet` tools into `$PWD/.dotnet/tools/`
- add `dotnet` tools to `$env:PATH`
- install `jq` in `$PWD/.tools/`
- install `nginx` in `$PWD/.tools/nginx/`
nits:
- remove an extra (incorrect) `$env:JAVA_HOME` setting
- build.ps1 finds a local JDK and sets this variable (and `$env:PATH`) properly
- avoid `'$(SELENIUMPROCESSTRACKINGFOLDER)' == '\artifacts\tmp\selenium\'`
- `$(BuildDirectory)` was normally the empty string (w/o fix)
- use `$(BuildDirectory)` a bit more
* Add files. disable artifact / test results publications to avoid warnings on CI
- artifacts/log is often empty when binary logs are disabled
- no tests create *.trx files
- don't have Java test results either
- only test jobs need test results published
This commit is contained in:
parent
2989e23a29
commit
54e282003b
|
|
@ -19,8 +19,6 @@ pr:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
variables:
|
variables:
|
||||||
- name: DOTNET_CLI_HOME
|
|
||||||
value: $(Agent.BuildDirectory)
|
|
||||||
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
|
- name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE
|
||||||
value: true
|
value: true
|
||||||
- name: _TeamName
|
- name: _TeamName
|
||||||
|
|
@ -704,14 +702,16 @@ stages:
|
||||||
vmImage: 'ubuntu-16.04'
|
vmImage: 'ubuntu-16.04'
|
||||||
variables:
|
variables:
|
||||||
DotNetCoreSdkDir: $(Agent.ToolsDirectory)/dotnet
|
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
|
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: true
|
||||||
steps:
|
steps:
|
||||||
- script: |
|
- script: |
|
||||||
source eng/common/native/common-library.sh
|
source eng/common/native/common-library.sh
|
||||||
mkdir -p $HOME/bin
|
mkdir -p $(System.DefaultWorkingDirectory)/.tools
|
||||||
GetFile https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 $HOME/bin/jq
|
GetFile https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 $(System.DefaultWorkingDirectory)/.tools/jq
|
||||||
chmod +x $HOME/bin/jq
|
chmod +x $(System.DefaultWorkingDirectory)/.tools/jq
|
||||||
echo "##vso[task.prependpath]$HOME/bin"
|
echo "##vso[task.prependpath]$(System.DefaultWorkingDirectory)/.tools"
|
||||||
displayName: Install jq
|
displayName: Install jq
|
||||||
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
|
- ${{ if ne(variables['System.TeamProject'], 'public') }}:
|
||||||
- task: Bash@3
|
- task: Bash@3
|
||||||
|
|
|
||||||
|
|
@ -52,7 +52,7 @@ parameters:
|
||||||
condition: ''
|
condition: ''
|
||||||
# jobName: '' - use agentOs by default.
|
# jobName: '' - use agentOs by default.
|
||||||
# jobDisplayName: '' - use agentOs by default.
|
# jobDisplayName: '' - use agentOs by default.
|
||||||
artifacts: []
|
artifacts: []
|
||||||
buildDirectory: ''
|
buildDirectory: ''
|
||||||
buildScript: ''
|
buildScript: ''
|
||||||
installTar: true
|
installTar: true
|
||||||
|
|
@ -80,7 +80,7 @@ jobs:
|
||||||
enableMicrobuild: true
|
enableMicrobuild: true
|
||||||
enablePublishBuildAssets: true
|
enablePublishBuildAssets: true
|
||||||
enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }}
|
enablePublishUsingPipelines: ${{ variables._PublishUsingPipelines }}
|
||||||
enablePublishTestResults: true # publish test results to AzDO (populates AzDO Tests tab)
|
enablePublishTestResults: ${{ eq(parameters.isTestingJob, 'true') }} # publish test results to AzDO (populates AzDO Tests tab)
|
||||||
enableTelemetry: true
|
enableTelemetry: true
|
||||||
helixRepo: dotnet/aspnetcore
|
helixRepo: dotnet/aspnetcore
|
||||||
helixType: build.product/
|
helixType: build.product/
|
||||||
|
|
@ -116,12 +116,13 @@ jobs:
|
||||||
- BuildScriptArgs: ${{ parameters.buildArgs }}
|
- BuildScriptArgs: ${{ parameters.buildArgs }}
|
||||||
- _BuildConfig: ${{ parameters.configuration }}
|
- _BuildConfig: ${{ parameters.configuration }}
|
||||||
- BuildConfiguration: ${{ parameters.configuration }}
|
- BuildConfiguration: ${{ parameters.configuration }}
|
||||||
- BuildDirectory: ${{ parameters.buildDirectory }}
|
- ${{ if eq(parameters.buildDirectory, '') }}:
|
||||||
- DOTNET_CLI_HOME: $(Agent.BuildDirectory)
|
- BuildDirectory: $(System.DefaultWorkingDirectory)
|
||||||
|
- ${{ if ne(parameters.buildDirectory, '') }}:
|
||||||
|
- BuildDirectory: ${{ parameters.buildDirectory }}
|
||||||
|
- DOTNET_CLI_HOME: $(System.DefaultWorkingDirectory)
|
||||||
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
|
||||||
- TeamName: AspNetCore
|
- TeamName: AspNetCore
|
||||||
- ${{ if and(eq(parameters.installJdk, 'true'), eq(parameters.agentOs, 'Windows')) }}:
|
|
||||||
- JAVA_HOME: $(Agent.BuildDirectory)\.tools\jdk\win-x64
|
|
||||||
- ${{ if or(ne(parameters.codeSign, true), ne(variables['System.TeamProject'], 'internal')) }}:
|
- ${{ if or(ne(parameters.codeSign, true), ne(variables['System.TeamProject'], 'internal')) }}:
|
||||||
- _SignType: ''
|
- _SignType: ''
|
||||||
- ${{ if and(eq(parameters.codeSign, true), eq(variables['System.TeamProject'], 'internal')) }}:
|
- ${{ if and(eq(parameters.codeSign, true), eq(variables['System.TeamProject'], 'internal')) }}:
|
||||||
|
|
@ -164,6 +165,12 @@ jobs:
|
||||||
- ${{ if and(eq(parameters.installTar, 'true'), eq(parameters.agentOs, 'Windows')) }}:
|
- ${{ if and(eq(parameters.installTar, 'true'), eq(parameters.agentOs, 'Windows')) }}:
|
||||||
- powershell: ./eng/scripts/InstallTar.ps1
|
- powershell: ./eng/scripts/InstallTar.ps1
|
||||||
displayName: Find or install Tar
|
displayName: Find or install Tar
|
||||||
|
- ${{ if eq(parameters.agentOs, 'Windows') }}:
|
||||||
|
- powershell: Write-Host "##vso[task.prependpath]$(DOTNET_CLI_HOME)\.dotnet\tools"
|
||||||
|
displayName: Add dotnet tools to path
|
||||||
|
- ${{ if ne(parameters.agentOs, 'Windows') }}:
|
||||||
|
- script: echo "##vso[task.prependpath]$(DOTNET_CLI_HOME)/.dotnet/tools"
|
||||||
|
displayName: Add dotnet tools to path
|
||||||
|
|
||||||
- ${{ parameters.beforeBuild }}
|
- ${{ parameters.beforeBuild }}
|
||||||
|
|
||||||
|
|
@ -191,10 +198,10 @@ jobs:
|
||||||
- ${{ if eq(parameters.steps, '')}}:
|
- ${{ if eq(parameters.steps, '')}}:
|
||||||
- ${{ if eq(parameters.buildScript, '') }}:
|
- ${{ if eq(parameters.buildScript, '') }}:
|
||||||
- ${{ if eq(parameters.agentOs, 'Windows') }}:
|
- ${{ if eq(parameters.agentOs, 'Windows') }}:
|
||||||
- script: .\$(BuildDirectory)\build.cmd -ci -nobl -Configuration $(BuildConfiguration) $(BuildScriptArgs) /p:DotNetSignType=$(_SignType)
|
- script: $(BuildDirectory)\build.cmd -ci -nobl -Configuration $(BuildConfiguration) $(BuildScriptArgs) /p:DotNetSignType=$(_SignType)
|
||||||
displayName: Run build.cmd
|
displayName: Run build.cmd
|
||||||
- ${{ if ne(parameters.agentOs, 'Windows') }}:
|
- ${{ if ne(parameters.agentOs, 'Windows') }}:
|
||||||
- script: ./$(BuildDirectory)/build.sh --ci --nobl --configuration $(BuildConfiguration) $(BuildScriptArgs)
|
- script: $(BuildDirectory)/build.sh --ci --nobl --configuration $(BuildConfiguration) $(BuildScriptArgs)
|
||||||
displayName: Run build.sh
|
displayName: Run build.sh
|
||||||
- ${{ if ne(parameters.buildScript, '') }}:
|
- ${{ if ne(parameters.buildScript, '') }}:
|
||||||
- script: $(BuildScript) -ci -nobl -Configuration $(BuildConfiguration) $(BuildScriptArgs)
|
- script: $(BuildScript) -ci -nobl -Configuration $(BuildConfiguration) $(BuildScriptArgs)
|
||||||
|
|
@ -232,10 +239,7 @@ jobs:
|
||||||
condition: and(or(succeeded(), eq('${{ artifact.publishOnError }}', 'true')), or(eq(variables['system.pullrequest.isfork'], false), eq('${{ artifact.includeForks }}', 'true')))
|
condition: and(or(succeeded(), eq('${{ artifact.publishOnError }}', 'true')), or(eq(variables['system.pullrequest.isfork'], false), eq('${{ artifact.includeForks }}', 'true')))
|
||||||
continueOnError: true
|
continueOnError: true
|
||||||
inputs:
|
inputs:
|
||||||
${{ if eq(parameters.buildDirectory, '') }}:
|
pathtoPublish: $(BuildDirectory)/${{ artifact.path }}
|
||||||
pathtoPublish: ${{ artifact.path }}
|
|
||||||
${{ if ne(parameters.buildDirectory, '') }}:
|
|
||||||
pathtoPublish: ${{ parameters.buildDirectory }}\${{ artifact.path }}
|
|
||||||
${{ if eq(artifact.name, '') }}:
|
${{ if eq(artifact.name, '') }}:
|
||||||
artifactName: artifacts-$(AgentOsName)-$(BuildConfiguration)
|
artifactName: artifacts-$(AgentOsName)-$(BuildConfiguration)
|
||||||
${{ if ne(artifact.name, '') }}:
|
${{ if ne(artifact.name, '') }}:
|
||||||
|
|
@ -243,18 +247,7 @@ jobs:
|
||||||
artifactType: Container
|
artifactType: Container
|
||||||
parallel: true
|
parallel: true
|
||||||
|
|
||||||
- ${{ if eq(parameters.isTestingJob, true) }}:
|
- ${{ if and(eq(parameters.isTestingJob, true), ne(parameters.jobName, 'Windows_Templates_Test')) }}:
|
||||||
- task: PublishTestResults@2
|
|
||||||
displayName: Publish VSTest test results
|
|
||||||
condition: always()
|
|
||||||
continueOnError: true
|
|
||||||
inputs:
|
|
||||||
testRunTitle: $(AgentOsName)-$(BuildConfiguration)
|
|
||||||
testRunner: vstest
|
|
||||||
testResultsFiles: '**/artifacts/**/*.trx'
|
|
||||||
mergeTestResults: true
|
|
||||||
buildConfiguration: $(BuildConfiguration)
|
|
||||||
buildPlatform: $(AgentOsName)
|
|
||||||
- task: PublishTestResults@2
|
- task: PublishTestResults@2
|
||||||
displayName: Publish js test results
|
displayName: Publish js test results
|
||||||
condition: always()
|
condition: always()
|
||||||
|
|
@ -263,12 +256,3 @@ jobs:
|
||||||
testResultsFiles: '**/artifacts/log/**/*.junit.xml'
|
testResultsFiles: '**/artifacts/log/**/*.junit.xml'
|
||||||
buildConfiguration: $(BuildConfiguration)
|
buildConfiguration: $(BuildConfiguration)
|
||||||
buildPlatform: $(AgentOsName)
|
buildPlatform: $(AgentOsName)
|
||||||
- task: PublishTestResults@2
|
|
||||||
displayName: Publish Java test results
|
|
||||||
condition: always()
|
|
||||||
inputs:
|
|
||||||
testRunner: junit
|
|
||||||
testResultsFiles: '**/TEST-junit-jupiter.xml'
|
|
||||||
buildConfiguration: $(BuildConfiguration)
|
|
||||||
buildPlatform: $(AgentOsName)
|
|
||||||
mergeTestResults: true
|
|
||||||
|
|
|
||||||
|
|
@ -369,6 +369,9 @@ if ($BinaryLog) {
|
||||||
if (-not $bl) {
|
if (-not $bl) {
|
||||||
$MSBuildArguments += "/bl:" + (Join-Path $LogDir "Build.binlog")
|
$MSBuildArguments += "/bl:" + (Join-Path $LogDir "Build.binlog")
|
||||||
}
|
}
|
||||||
|
} elseif ($CI) {
|
||||||
|
# Ensure the artifacts/log directory isn't empty to avoid warnings.
|
||||||
|
New-Item (Join-Path $LogDir "empty.log") -ItemType File -ErrorAction SilentlyContinue >$null
|
||||||
}
|
}
|
||||||
|
|
||||||
# Capture MSBuild crash logs
|
# Capture MSBuild crash logs
|
||||||
|
|
|
||||||
3
build.sh
3
build.sh
|
|
@ -338,6 +338,9 @@ if [[ "$binary_log" == true ]]; then
|
||||||
if [[ "$found" == false ]]; then
|
if [[ "$found" == false ]]; then
|
||||||
msbuild_args[${#msbuild_args[*]}]="/bl:$log_dir/Build.binlog"
|
msbuild_args[${#msbuild_args[*]}]="/bl:$log_dir/Build.binlog"
|
||||||
fi
|
fi
|
||||||
|
elif [[ "$ci" == true ]]; then
|
||||||
|
# Ensure the artifacts/log directory isn't empty to avoid warnings.
|
||||||
|
touch "$log_dir/empty.log"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Capture MSBuild crash logs
|
# Capture MSBuild crash logs
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,12 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
scriptroot="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
reporoot="$(dirname "$(dirname "$scriptroot")")"
|
||||||
|
nginxinstall="$reporoot/.tools/nginx"
|
||||||
|
|
||||||
curl -sSL http://nginx.org/download/nginx-1.14.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/nginx-1.14.2/
|
curl -sSL http://nginx.org/download/nginx-1.14.2.tar.gz | tar zxfv - -C /tmp && cd /tmp/nginx-1.14.2/
|
||||||
./configure --prefix=$HOME/nginxinstall --with-http_ssl_module --without-http_rewrite_module
|
./configure --prefix=$nginxinstall --with-http_ssl_module --without-http_rewrite_module
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
echo "##vso[task.prependpath]$HOME/nginxinstall/sbin"
|
echo "##vso[task.prependpath]$nginxinstall/sbin"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue