Use different dotnet and artifacts folders when running in docker (on Windows)

This means docker builds won't conflict with each other or with a non-docker build
This commit is contained in:
Daniel Plaisted 2018-12-05 17:48:17 -08:00
parent adea98d49d
commit c6b78f4205
4 changed files with 21 additions and 1 deletions

View file

@ -50,6 +50,10 @@ function InitializeDotNetCli([bool]$install) {
$dotnetRoot = $env:DOTNET_INSTALL_DIR $dotnetRoot = $env:DOTNET_INSTALL_DIR
} else { } else {
$dotnetRoot = Join-Path $RepoRoot ".dotnet" $dotnetRoot = Join-Path $RepoRoot ".dotnet"
if ($env:ARCADE_DOTNET_DIR -ne $null)
{
$dotnetRoot = $env:ARCADE_DOTNET_DIR
}
$env:DOTNET_INSTALL_DIR = $dotnetRoot $env:DOTNET_INSTALL_DIR = $dotnetRoot
if (-not (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) { if (-not (Test-Path(Join-Path $env:DOTNET_INSTALL_DIR "sdk\$dotnetSdkVersion"))) {
@ -342,6 +346,11 @@ function MsBuild() {
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..") $RepoRoot = Resolve-Path (Join-Path $PSScriptRoot "..\..")
$EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..") $EngRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$ArtifactsDir = Join-Path $RepoRoot "artifacts" $ArtifactsDir = Join-Path $RepoRoot "artifacts"
if ($env:ARCADE_ARTIFACTS_DIR -ne $null)
{
$ArtifactsDir = [System.IO.Path]::GetFullPath($env:ARCADE_ARTIFACTS_DIR) + "\"
$env:ArtifactsDir = $ArtifactsDir
}
$ToolsetDir = Join-Path $ArtifactsDir "toolset" $ToolsetDir = Join-Path $ArtifactsDir "toolset"
$ToolsDir = Join-Path $RepoRoot ".tools" $ToolsDir = Join-Path $RepoRoot ".tools"
$LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration $LogDir = Join-Path (Join-Path $ArtifactsDir "log") $configuration

View file

@ -15,6 +15,11 @@ useInstalledDotNetCli=${useInstalledDotNetCli:-true}
repo_root="$scriptroot/../.." repo_root="$scriptroot/../.."
eng_root="$scriptroot/.." eng_root="$scriptroot/.."
artifacts_dir="$repo_root/artifacts" artifacts_dir="$repo_root/artifacts"
if [[ -n "${ARCADE_ARTIFACTS_DIR:-}" ]]; then
artifacts_dir="$ARCADE_ARTIFACTS_DIR"
export ArtifactsDir="$artifacts_dir"
fi
toolset_dir="$artifacts_dir/toolset" toolset_dir="$artifacts_dir/toolset"
log_dir="$artifacts_dir/log/$configuration" log_dir="$artifacts_dir/log/$configuration"
temp_dir="$artifacts_dir/tmp/$configuration" temp_dir="$artifacts_dir/tmp/$configuration"
@ -89,6 +94,10 @@ function InitializeDotNetCli {
dotnet_root="$DOTNET_INSTALL_DIR" dotnet_root="$DOTNET_INSTALL_DIR"
else else
dotnet_root="$repo_root/.dotnet" dotnet_root="$repo_root/.dotnet"
if [[ -n "${ARCADE_DOTNET_DIR:-}" ]]; then
dotnet_root="$ARCADE_DOTNET_DIR"
fi
export DOTNET_INSTALL_DIR="$dotnet_root" export DOTNET_INSTALL_DIR="$dotnet_root"
if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then if [[ ! -d "$DOTNET_INSTALL_DIR/sdk/$dotnet_sdk_version" ]]; then

View file

@ -55,5 +55,7 @@ docker run $interactiveFlag -t --rm --sig-proxy=true `
-e PB_PACKAGEVERSIONPROPSURL ` -e PB_PACKAGEVERSIONPROPSURL `
-e PB_PUBLISHBLOBFEEDURL ` -e PB_PUBLISHBLOBFEEDURL `
-e EXTERNALRESTORESOURCES ` -e EXTERNALRESTORESOURCES `
-e ARCADE_DOTNET_DIR="/opt/code/artifacts/docker/${dockerImageName}/.dotnet" `
-e ARCADE_ARTIFACTS_DIR="/opt/code/artifacts/docker/${dockerImageName}/" `
$dockerContainerTag ` $dockerContainerTag `
/opt/code/run-build.sh @additionalArgs /opt/code/run-build.sh @additionalArgs

View file

@ -236,7 +236,7 @@
Mode="u+x" />--> Mode="u+x" />-->
<!-- Build SDK Deb package --> <!-- Build SDK Deb package -->
<DotNetDebTool ToolPath="$(RepoRoot).dotnet" <DotNetDebTool ToolPath="$(_DotNetRoot)"
InputDirectory="$(LayoutDirectory)" InputDirectory="$(LayoutDirectory)"
OutputDirectory="$(DotNetDebToolOutputDirectory)" OutputDirectory="$(DotNetDebToolOutputDirectory)"
PackageName="$(SdkDebianPackageName)" PackageName="$(SdkDebianPackageName)"