mirror of
https://github.com/EttusResearch/uhd.git
synced 2026-10-25 17:36:10 +00:00
ci: docker: Improve build success rate for windows containers
Resolve common transitive docker build failures on Windows,
which forced commit 4d0c9c8dfd
Author: Marian Koop <marian.koop@emerson.com>
Date: Tue Aug 11 17:01:53 2026 +0200
ci: docker: Revert docker build improvements
- Abstract vcpkg triplet port creation in ps script to
implement error trapping and inspect logs prior to failing
- Move vs_buildtools install to front, to fail fast
- Abstract vs_buildtools install in ps script to
- implement error trapping and inspect logs prior to failing
- reduce docker layers
- eliminate incl. temporary installer data into docker layers
- Switch to using powershell script to trap choco install errors
and expose error logs during docker build. Script also
- combines all choco installs into single container layers
- attempt (by default) 2 retry attempts per package install
(workaround for temporary URL download/access failues)
- Combine some python commands into single RUN statement
to reduce docker layers
- Implement docker build step retry attempts (3) to address
other temporary failures like ability to create layer.
This commit is contained in:
parent
9015e01d3c
commit
b9f346664a
107
.ci/docker/scripts/install-choco-package.ps1
Normal file
107
.ci/docker/scripts/install-choco-package.ps1
Normal file
@ -0,0 +1,107 @@
|
||||
param(
|
||||
[string]$PackageName,
|
||||
|
||||
[string]$Version = "",
|
||||
|
||||
[string]$InstallArgs = "",
|
||||
|
||||
[ValidateRange(0, 20)]
|
||||
[int]$RetryCount = 2,
|
||||
|
||||
[ValidateRange(1, 3600)]
|
||||
[int]$RetryDelaySeconds = 30,
|
||||
|
||||
[ValidateRange(0, 100000)]
|
||||
[int]$LogTailLines = 300,
|
||||
|
||||
[Alias('h')]
|
||||
[switch]$Help,
|
||||
|
||||
[Parameter(ValueFromRemainingArguments = $true)]
|
||||
[string[]]$ExtraArgs
|
||||
)
|
||||
|
||||
function Show-Usage {
|
||||
Write-Host "Usage:"
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File install-choco-package.ps1 -PackageName <name> [-Version <version>] [-InstallArgs <args>] [-RetryCount <n>] [-RetryDelaySeconds <sec>]"
|
||||
Write-Host ""
|
||||
Write-Host "Options:"
|
||||
Write-Host " -PackageName Chocolatey package ID (required)."
|
||||
Write-Host " -Version Optional package version passed as --version."
|
||||
Write-Host " -InstallArgs Optional installer args passed as --installargs."
|
||||
Write-Host " -RetryCount Number of retries after the first failed attempt (default: 2)."
|
||||
Write-Host " -RetryDelaySeconds Wait time between retries in seconds (default: 30)."
|
||||
Write-Host " -LogTailLines Number of log lines to show on final failure (default: 300, use 0 to disable)."
|
||||
Write-Host " -Help, --help Show this help text."
|
||||
Write-Host ""
|
||||
Write-Host "Examples:"
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 -PackageName doxygen.install -Version 1.9.8"
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 -PackageName cmake.install -Version 3.22.3 -InstallArgs \"ADD_CMAKE_TO_PATH=System\""
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 -PackageName git"
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 -PackageName doxygen.install -Version 1.9.8 -RetryCount 3 -RetryDelaySeconds 30"
|
||||
Write-Host " powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 -PackageName doxygen.install -Version 1.9.8 -LogTailLines 1000"
|
||||
}
|
||||
|
||||
if ($Help -or ($ExtraArgs -contains '--help')) {
|
||||
Show-Usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
if (-not $PackageName) {
|
||||
Write-Host "Error: -PackageName is required."
|
||||
Write-Host "Run with --help to see usage."
|
||||
exit 2
|
||||
}
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$chocoRoot = if ($env:ChocolateyInstall) { $env:ChocolateyInstall } else { 'C:\ProgramData\chocolatey' }
|
||||
$logPath = Join-Path $chocoRoot 'logs\chocolatey.log'
|
||||
$packageLibPath = Join-Path (Join-Path $chocoRoot 'lib') $PackageName
|
||||
$maxAttempts = $RetryCount + 1
|
||||
|
||||
$chocoArgs = @('install', '-y', $PackageName)
|
||||
if ($Version) {
|
||||
$chocoArgs += @('--version', $Version)
|
||||
}
|
||||
if ($InstallArgs) {
|
||||
$chocoArgs += @('--installargs', $InstallArgs)
|
||||
}
|
||||
|
||||
for ($attempt = 1; $attempt -le $maxAttempts; $attempt++) {
|
||||
Write-Host "Installing Chocolatey package: $PackageName (attempt $attempt of $maxAttempts)"
|
||||
& choco @chocoArgs
|
||||
$exitCode = $LASTEXITCODE
|
||||
|
||||
if ($exitCode -eq 0) {
|
||||
Write-Host "Successfully installed Chocolatey package: $PackageName"
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "Chocolatey install failed for package '$PackageName' (exit code $exitCode)."
|
||||
|
||||
if ($attempt -lt $maxAttempts) {
|
||||
Write-Host "Retrying in $RetryDelaySeconds seconds..."
|
||||
Start-Sleep -Seconds $RetryDelaySeconds
|
||||
}
|
||||
}
|
||||
|
||||
if ($LogTailLines -gt 0) {
|
||||
if (Test-Path $logPath) {
|
||||
Write-Host "Showing last $LogTailLines lines from $logPath"
|
||||
Get-Content $logPath -Tail $LogTailLines
|
||||
}
|
||||
else {
|
||||
Write-Host "Chocolatey log not found at $logPath"
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Skipping Chocolatey log output because -LogTailLines is set to 0"
|
||||
}
|
||||
|
||||
if (Test-Path $packageLibPath) {
|
||||
Write-Host "Contents of $packageLibPath"
|
||||
Get-ChildItem -Path $packageLibPath -Force
|
||||
}
|
||||
|
||||
exit $exitCode
|
||||
176
.ci/docker/scripts/install-vcpkg-triplet.ps1
Normal file
176
.ci/docker/scripts/install-vcpkg-triplet.ps1
Normal file
@ -0,0 +1,176 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ManifestDir,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Triplet,
|
||||
|
||||
[string]$VcpkgRoot = 'C:\vcpkg'
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
$vcpkgExe = Join-Path $VcpkgRoot 'vcpkg.exe'
|
||||
if (-not (Test-Path -LiteralPath $vcpkgExe)) {
|
||||
Write-Error "vcpkg executable not found at: $vcpkgExe"
|
||||
exit 2
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $ManifestDir)) {
|
||||
Write-Error "Manifest directory not found: $ManifestDir"
|
||||
exit 2
|
||||
}
|
||||
|
||||
Write-Host "Running vcpkg install in: $ManifestDir"
|
||||
Write-Host "Triplet: $Triplet"
|
||||
|
||||
Push-Location $ManifestDir
|
||||
try {
|
||||
& $vcpkgExe install --triplet $Triplet --clean-after-build
|
||||
$vcpkgExitCode = $LASTEXITCODE
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
}
|
||||
|
||||
if ($vcpkgExitCode -eq 0) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
Write-Host "##[error]vcpkg install failed with exit code: $vcpkgExitCode"
|
||||
|
||||
$buildtreesRoot = Join-Path $VcpkgRoot 'buildtrees'
|
||||
if (-not (Test-Path -LiteralPath $buildtreesRoot)) {
|
||||
Write-Host "No buildtrees directory found at $buildtreesRoot"
|
||||
exit $vcpkgExitCode
|
||||
}
|
||||
|
||||
function Write-LogIfExists {
|
||||
param([string]$Path)
|
||||
if (Test-Path -LiteralPath $Path) {
|
||||
$logInfo = Get-Item -LiteralPath $Path
|
||||
Write-Host "===== BEGIN LOG: $Path ($([int64]$logInfo.Length) bytes) ====="
|
||||
Get-Content -LiteralPath $Path -Raw
|
||||
Write-Host "===== END LOG: $Path ====="
|
||||
return $true
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
function Write-LogFiles {
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Directory,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Triplet
|
||||
)
|
||||
|
||||
if (-not (Test-Path -LiteralPath $Directory)) {
|
||||
return
|
||||
}
|
||||
|
||||
function Get-LogPriority {
|
||||
param([System.IO.FileInfo]$File)
|
||||
|
||||
if ($File.Name -match '^config-') {
|
||||
return 0
|
||||
}
|
||||
if ($File.Name -match '^stdout-') {
|
||||
return 1
|
||||
}
|
||||
if ($File.Name -match '^stderr-') {
|
||||
return 2
|
||||
}
|
||||
return 3
|
||||
}
|
||||
|
||||
$priorityLogs = Get-ChildItem -LiteralPath $Directory -File -Filter "*${Triplet}*.log" -ErrorAction SilentlyContinue |
|
||||
Sort-Object @{ Expression = { Get-LogPriority -File $_ } },
|
||||
@{ Expression = { $_.LastWriteTimeUtc }; Descending = $true },
|
||||
Name
|
||||
|
||||
if (-not $priorityLogs) {
|
||||
$priorityLogs = Get-ChildItem -LiteralPath $Directory -File -Filter '*.log' -ErrorAction SilentlyContinue |
|
||||
Sort-Object @{ Expression = { Get-LogPriority -File $_ } },
|
||||
@{ Expression = { $_.LastWriteTimeUtc }; Descending = $true },
|
||||
Name
|
||||
}
|
||||
|
||||
if (-not $priorityLogs) {
|
||||
Write-Host "No log files found in $Directory"
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "Dumping log files from $Directory"
|
||||
foreach ($log in $priorityLogs) {
|
||||
if ($log.Length -eq 0) {
|
||||
Write-Host "===== SKIP EMPTY LOG: $($log.FullName) ====="
|
||||
continue
|
||||
}
|
||||
|
||||
Write-Host "===== BEGIN LOG: $($log.FullName) ($([int64]$log.Length) bytes) ====="
|
||||
Get-Content -LiteralPath $log.FullName -Raw
|
||||
Write-Host "===== END LOG: $($log.FullName) ====="
|
||||
}
|
||||
}
|
||||
|
||||
# Use the most recently modified log of any type to identify the failing port.
|
||||
# This catches failures that occur before configure (fetch/extract/patch stage)
|
||||
# where no config-*-out.log is ever created.
|
||||
$candidate = Get-ChildItem -LiteralPath $buildtreesRoot -Recurse -File -Filter '*.log' -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTimeUtc -Descending |
|
||||
Select-Object -First 1
|
||||
|
||||
# If the most recent log is not a config-*-out.log, also try to find the newest
|
||||
# config-*-out.log in the same port directory to seed the related-log dump,
|
||||
# since config logs contain the most actionable CMake failure details.
|
||||
if ($candidate) {
|
||||
$portDirFromRecent = $candidate.DirectoryName
|
||||
$configInSamePort = Get-ChildItem -LiteralPath $portDirFromRecent -File -Filter "config-$Triplet-*-out.log" -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTimeUtc -Descending |
|
||||
Select-Object -First 1
|
||||
if ($configInSamePort) {
|
||||
$candidate = $configInSamePort
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $candidate) {
|
||||
Write-Host "No log files found under $buildtreesRoot"
|
||||
exit $vcpkgExitCode
|
||||
}
|
||||
|
||||
$portDir = $candidate.DirectoryName
|
||||
$portName = Split-Path -Leaf $portDir
|
||||
|
||||
Write-Host "Most recent failing dependency candidate: $portName"
|
||||
Write-Host "Selected log seed: $($candidate.FullName)"
|
||||
|
||||
$seedName = [System.IO.Path]::GetFileNameWithoutExtension($candidate.Name)
|
||||
if ($seedName.EndsWith('-out', [System.StringComparison]::OrdinalIgnoreCase)) {
|
||||
$seedPrefix = $seedName.Substring(0, $seedName.Length - 4)
|
||||
$relatedLogs = @(
|
||||
(Join-Path $portDir ($seedPrefix + '-CMakeCache.txt.log')),
|
||||
(Join-Path $portDir ($seedPrefix + '-CMakeConfigureLog.yaml.log')),
|
||||
(Join-Path $portDir ($seedPrefix + '-out.log'))
|
||||
)
|
||||
|
||||
foreach ($log in $relatedLogs) {
|
||||
[void](Write-LogIfExists -Path $log)
|
||||
}
|
||||
} else {
|
||||
[void](Write-LogIfExists -Path $candidate.FullName)
|
||||
}
|
||||
|
||||
Write-LogFiles -Directory $portDir -Triplet $Triplet
|
||||
|
||||
Write-Host 'Recent buildtrees logs (top 20 by timestamp):'
|
||||
Get-ChildItem -LiteralPath $buildtreesRoot -Recurse -File -Filter '*.log' -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTimeUtc -Descending |
|
||||
Select-Object -First 20 FullName, LastWriteTimeUtc |
|
||||
Format-Table -AutoSize |
|
||||
Out-String |
|
||||
Write-Host
|
||||
|
||||
exit $vcpkgExitCode
|
||||
101
.ci/docker/scripts/install-vs-buildtools.ps1
Normal file
101
.ci/docker/scripts/install-vs-buildtools.ps1
Normal file
@ -0,0 +1,101 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$Url,
|
||||
|
||||
# Optional base temp directory for download and installer extraction.
|
||||
# A random subfolder is always created under this base path and cleaned up unless -PreserveTemp is set.
|
||||
[string]$TempDir = '',
|
||||
|
||||
# Preserve the generated temp working directory for debugging.
|
||||
[switch]$PreserveTemp,
|
||||
|
||||
# All remaining arguments are passed directly to vs_buildtools.exe.
|
||||
# Example: -InstallerArgs '--quiet','--wait','--norestart','--installPath','C:\VS','--add','Microsoft.VisualStudio.Workload.VCTools','--includeRecommended'
|
||||
[string[]]$InstallerArgs = @('--quiet', '--wait', '--norestart', '--add', 'Microsoft.VisualStudio.Workload.VCTools', '--includeRecommended')
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = 'Stop'
|
||||
|
||||
# --- URL validation (mirrors check-url.ps1 logic) ---
|
||||
if ([string]::IsNullOrWhiteSpace($Url)) {
|
||||
throw "VS_BUILD_TOOLS_URL is empty. Provide a valid download URL."
|
||||
}
|
||||
|
||||
Write-Host "Validating VS Build Tools URL: $Url"
|
||||
$resp = Invoke-WebRequest -Uri $Url -UseBasicParsing -Method Head
|
||||
if ($resp.StatusCode -ne 200) {
|
||||
throw "URL check failed: StatusCode=$($resp.StatusCode)"
|
||||
}
|
||||
$ct = $resp.Headers['Content-Type']
|
||||
if ($ct -and $ct -match 'text/html') {
|
||||
throw "URL check failed: Content-Type=$ct (expected binary)"
|
||||
}
|
||||
$cl = [int64]($resp.Headers['Content-Length'] | Select-Object -First 1)
|
||||
if ($cl -and $cl -lt 1048576) {
|
||||
throw "URL check failed: Content-Length=$cl (suspiciously small)"
|
||||
}
|
||||
Write-Host "URL validation passed (Content-Type: $ct, Content-Length: $cl bytes)."
|
||||
|
||||
# --- Setup temp directory ---
|
||||
if (-not [string]::IsNullOrWhiteSpace($TempDir)) {
|
||||
$temp = Join-Path $TempDir ([System.IO.Path]::GetRandomFileName())
|
||||
} else {
|
||||
$temp = Join-Path $env:TEMP ([System.IO.Path]::GetRandomFileName())
|
||||
}
|
||||
Write-Host "Using temp directory: $temp"
|
||||
New-Item -ItemType Directory -Path $temp -Force | Out-Null
|
||||
$env:TEMP = $temp
|
||||
$env:TMP = $temp
|
||||
|
||||
# --- Download ---
|
||||
$exe = Join-Path $temp 'vs_buildtools.exe'
|
||||
Write-Host "Downloading VS Build Tools to $exe ..."
|
||||
Invoke-WebRequest $Url -OutFile $exe -UseBasicParsing
|
||||
Write-Host "Download complete: $exe"
|
||||
|
||||
# --- Install ---
|
||||
Push-Location $temp
|
||||
try {
|
||||
$fullCmd = ".\vs_buildtools.exe " + ($InstallerArgs -join ' ')
|
||||
Write-Host "Install command: $fullCmd"
|
||||
$p = Start-Process -FilePath '.\vs_buildtools.exe' -ArgumentList $InstallerArgs -Wait -PassThru
|
||||
$code = $p.ExitCode
|
||||
Write-Host "VS installer exit code: $code"
|
||||
|
||||
if ($code -ne 0 -and $code -ne 3010) {
|
||||
# Dump installer logs to stdout before cleanup
|
||||
Get-ChildItem -Path $env:TEMP -Recurse -File -Include 'dd_*', '*.log' -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTime -Descending |
|
||||
Select-Object -First 20 -ExpandProperty FullName |
|
||||
ForEach-Object { Write-Host ('==== ' + $_ + ' ===='); Get-Content $_ -Tail 250 }
|
||||
|
||||
$b1 = Join-Path $env:ProgramData 'Microsoft\VisualStudio\Packages\_bootstrapper'
|
||||
if (Test-Path $b1) {
|
||||
Get-ChildItem -Path $b1 -Recurse -File -Filter '*.log' -ErrorAction SilentlyContinue |
|
||||
Sort-Object LastWriteTime -Descending |
|
||||
Select-Object -First 20 -ExpandProperty FullName |
|
||||
ForEach-Object { Write-Host ('==== ' + $_ + ' ===='); Get-Content $_ -Tail 250 }
|
||||
}
|
||||
|
||||
throw "Installer failed with exit code: $code"
|
||||
}
|
||||
}
|
||||
finally {
|
||||
Pop-Location
|
||||
if ($PreserveTemp) {
|
||||
Write-Host "Preserving temp directory: $temp"
|
||||
} else {
|
||||
Remove-Item -LiteralPath $temp -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
# Give Windows time to flush pending filesystem writes (e.g. msiexec deferred
|
||||
# operations) before Docker captures the layer. Without this, hcsshim::ImportLayer
|
||||
# can fail with ERROR_PATH_NOT_FOUND (0x3) due to a race condition between
|
||||
# NTFS lazy-write completion and the layer snapshot.
|
||||
# Runs unconditionally: even a failed install may have partial writes pending.
|
||||
Write-Host "Waiting 10 seconds for filesystem writes to flush..."
|
||||
Start-Sleep -Seconds 10
|
||||
Write-Host "Filesystem flush wait complete."
|
||||
}
|
||||
|
||||
Write-Host "VS Build Tools installed successfully."
|
||||
@ -21,6 +21,15 @@ ENV VCPKG_DISABLE_METRICS=1
|
||||
# Enable long file paths (>260 characters)
|
||||
RUN reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
|
||||
|
||||
# Install vs build tools
|
||||
COPY .ci/docker/scripts/install-vs-buildtools.ps1 C:/Temp/install-vs-buildtools.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
"& 'C:\Temp\install-vs-buildtools.ps1' \
|
||||
-Url '%VS_BUILD_TOOLS_URL%' \
|
||||
-InstallerArgs '--quiet','--wait','--norestart','--nocache', \
|
||||
'--add','Microsoft.VisualStudio.Workload.VCTools', \
|
||||
'--includeRecommended'"
|
||||
|
||||
RUN setx chocolateyVersion 1.4.0 /m
|
||||
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
|
||||
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
|
||||
@ -28,23 +37,19 @@ RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
|
||||
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" && \
|
||||
choco config set webRequestTimeoutSeconds 600
|
||||
RUN choco install -y doxygen.install --version=1.9.8
|
||||
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=3.22.3
|
||||
RUN choco install -y git
|
||||
RUN choco install -y NSIS --version=3.06.1
|
||||
RUN choco install -y vim
|
||||
RUN choco install -y python3 --version=%PYTHON_VERSION%
|
||||
|
||||
# Install vs build tools
|
||||
COPY .ci/docker/scripts/check-url.ps1 C:/Temp/check-url.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\check-url.ps1 \
|
||||
-Url "%VS_BUILD_TOOLS_URL%"
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
Invoke-WebRequest "%VS_BUILD_TOOLS_URL%" \
|
||||
-OutFile "%TEMP%\vs_buildtools.exe" -UseBasicParsing
|
||||
RUN "%TEMP%\vs_buildtools.exe" --quiet --wait --norestart --noUpdateInstaller \
|
||||
--add Microsoft.VisualStudio.Workload.VCTools \
|
||||
--includeRecommended
|
||||
COPY .ci/docker/scripts/install-choco-package.ps1 C:/Temp/install-choco-package.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName doxygen.install -Version 1.9.8 && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName cmake.install -Version 3.22.3 -InstallArgs ADD_CMAKE_TO_PATH=System && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName git && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName NSIS -Version 3.06.1 && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName vim && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName python3 -Version %PYTHON_VERSION%
|
||||
|
||||
# Optionally use cached index.
|
||||
RUN if defined PIP_INDEX_URL ( \
|
||||
@ -53,9 +58,9 @@ RUN if defined PIP_INDEX_URL ( \
|
||||
)
|
||||
|
||||
COPY host/python/requirements.txt C:/Temp/requirements.txt
|
||||
RUN pip config list
|
||||
RUN python -m pip install --upgrade pip
|
||||
RUN pip install -r C:/Temp/requirements.txt
|
||||
RUN pip config list && \
|
||||
python -m pip install --upgrade pip && \
|
||||
python -m pip install -r C:/Temp/requirements.txt
|
||||
|
||||
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
|
||||
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
|
||||
@ -64,8 +69,11 @@ RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
|
||||
# Add custom UHD vcpkg triplet
|
||||
COPY host/cmake/vcpkg/* c:/vcpkg/triplets/
|
||||
|
||||
RUN mkdir c:\\uhd-vcpkg
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
"New-Item -ItemType Directory -Path 'c:\uhd-vcpkg' -Force | Out-Null"
|
||||
COPY .ci/docker/vcpkg/${VCPKG_MANIFEST_FILE} c:/uhd-vcpkg/vcpkg.json
|
||||
RUN cd c:\\uhd-vcpkg && %VCPKG_INSTALL_DIR%\vcpkg.exe install \
|
||||
--triplet uhd-x64-windows-static-md \
|
||||
--clean-after-build
|
||||
COPY .ci/docker/scripts/install-vcpkg-triplet.ps1 C:/Temp/install-vcpkg-triplet.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-vcpkg-triplet.ps1 \
|
||||
-ManifestDir C:\uhd-vcpkg \
|
||||
-Triplet %VCPKG_TARGET_TRIPLET% \
|
||||
-VcpkgRoot %VCPKG_INSTALL_DIR%
|
||||
|
||||
@ -21,6 +21,15 @@ ENV VCPKG_DISABLE_METRICS=1
|
||||
# Enable long file paths (>260 characters)
|
||||
RUN reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f
|
||||
|
||||
# Install vs build tools
|
||||
COPY .ci/docker/scripts/install-vs-buildtools.ps1 C:/Temp/install-vs-buildtools.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
"& 'C:\Temp\install-vs-buildtools.ps1' \
|
||||
-Url '%VS_BUILD_TOOLS_URL%' \
|
||||
-InstallerArgs '--quiet','--wait','--norestart','--nocache', \
|
||||
'--add','Microsoft.VisualStudio.Workload.VCTools', \
|
||||
'--includeRecommended'"
|
||||
|
||||
RUN setx chocolateyVersion 2.5.1 /m
|
||||
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
|
||||
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
|
||||
@ -28,23 +37,19 @@ RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
|
||||
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
|
||||
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" && \
|
||||
choco config set webRequestTimeoutSeconds 600
|
||||
RUN choco install -y doxygen.install --version=1.9.8
|
||||
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=4.2.1
|
||||
RUN choco install -y git
|
||||
RUN choco install -y NSIS --version=3.11.0
|
||||
RUN choco install -y vim
|
||||
RUN choco install -y python3 --version=%PYTHON_VERSION%
|
||||
|
||||
# Install vs build tools
|
||||
COPY .ci/docker/scripts/check-url.ps1 C:/Temp/check-url.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\check-url.ps1 \
|
||||
-Url "%VS_BUILD_TOOLS_URL%"
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
Invoke-WebRequest "%VS_BUILD_TOOLS_URL%" \
|
||||
-OutFile "%TEMP%\vs_buildtools.exe" -UseBasicParsing
|
||||
RUN "%TEMP%\vs_buildtools.exe" --quiet --wait --norestart --noUpdateInstaller \
|
||||
--add Microsoft.VisualStudio.Workload.VCTools \
|
||||
--includeRecommended
|
||||
COPY .ci/docker/scripts/install-choco-package.ps1 C:/Temp/install-choco-package.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName doxygen.install -Version 1.9.8 && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName cmake.install -Version 4.2.1 -InstallArgs ADD_CMAKE_TO_PATH=System && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName git && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName NSIS -Version 3.11.0 && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName vim && \
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-choco-package.ps1 \
|
||||
-PackageName python3 -Version %PYTHON_VERSION%
|
||||
|
||||
# Optionally use cached index.
|
||||
RUN if defined PIP_INDEX_URL ( \
|
||||
@ -53,9 +58,9 @@ RUN if defined PIP_INDEX_URL ( \
|
||||
)
|
||||
|
||||
COPY host/python/requirements.txt C:/Temp/requirements.txt
|
||||
RUN pip config list
|
||||
RUN python -m pip install --upgrade pip
|
||||
RUN pip install -r C:/Temp/requirements.txt
|
||||
RUN pip config list && \
|
||||
python -m pip install --upgrade pip && \
|
||||
python -m pip install -r C:/Temp/requirements.txt
|
||||
|
||||
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
|
||||
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
|
||||
@ -64,8 +69,11 @@ RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
|
||||
# Add custom UHD vcpkg triplet
|
||||
COPY host/cmake/vcpkg/* c:/vcpkg/triplets/
|
||||
|
||||
RUN mkdir c:\\uhd-vcpkg
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
|
||||
"New-Item -ItemType Directory -Path 'c:\uhd-vcpkg' -Force | Out-Null"
|
||||
COPY .ci/docker/vcpkg/${VCPKG_MANIFEST_FILE} c:/uhd-vcpkg/vcpkg.json
|
||||
RUN cd c:\\uhd-vcpkg && %VCPKG_INSTALL_DIR%\vcpkg.exe install \
|
||||
--triplet uhd-x64-windows-static-md \
|
||||
--clean-after-build
|
||||
COPY .ci/docker/scripts/install-vcpkg-triplet.ps1 C:/Temp/install-vcpkg-triplet.ps1
|
||||
RUN powershell -NoProfile -ExecutionPolicy Bypass -File C:\Temp\install-vcpkg-triplet.ps1 \
|
||||
-ManifestDir C:\uhd-vcpkg \
|
||||
-Triplet %VCPKG_TARGET_TRIPLET% \
|
||||
-VcpkgRoot %VCPKG_INSTALL_DIR%
|
||||
|
||||
@ -266,6 +266,7 @@ jobs:
|
||||
displayName: Verify expected VS Tools Installer URL
|
||||
- task: Docker@2
|
||||
displayName: Build Image
|
||||
retryCountOnTaskFailure: 3
|
||||
inputs:
|
||||
command: 'build'
|
||||
Dockerfile: '$(Build.SourcesDirectory)/.ci/docker/$(DOCKER_CONFIG).Dockerfile'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user