Skip to content

Commit 1d3e28c

Browse files
Merge pull request #253 from UIUCLibrary/fix-ci
Fix ci
2 parents 9c5d03b + 21c7dca commit 1d3e28c

9 files changed

Lines changed: 455 additions & 358 deletions

File tree

Jenkinsfile

Lines changed: 346 additions & 272 deletions
Large diffs are not rendered by default.

ci/docker/linux/jenkins/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ RUN --mount=type=cache,target=${PIP_DOWNLOAD_CACHE} \
9292
fi && \
9393
uv run --only-group conan conan install /tmp -pr:b=default --build missing -pr:b=default && \
9494
uv run --only-group conan conan cache clean "*" -b --source --build --temp && \
95-
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
95+
if [ -f "/tmp/remotes.json" ]; then \
9696
mv -f /tmp/remotes.json ${CONAN_HOME}/remotes.json; \
9797
fi && \
9898
mv -f /tmp/global.conf.original ${CONAN_HOME}/global.conf

ci/docker/linux/tox/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ RUN --mount=type=cache,target=${PIP_DOWNLOAD_CACHE} \
7979
uv run --only-group conan conan install /tmp -pr:b=default --build missing && \
8080
uv run --only-group conan conan cache clean "*" -b --source --build --temp && \
8181
rm -rf venv && \
82-
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
82+
if [ -f "/tmp/remotes.json" ]; then \
8383
mv -f /tmp/remotes.json ${CONAN_HOME}/remotes.json; \
8484
fi && \
8585
mv -f /tmp/global.conf.original ${CONAN_HOME}/global.conf

scripts/build_linux_wheels.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,13 @@ generate_wheel(){
5959
exit 1
6060
esac
6161

62+
dockerPurposeLabel='build-wheel'
63+
if [[ -v ci ]]; then
64+
dockerPurposeLabel='ci'
65+
fi
66+
6267
docker build \
68+
--label="purpose=$dockerPurposeLabel" \
6369
-t $docker_image_name_to_use \
6470
--platform=$platform \
6571
-f "$DOCKERFILE" \
@@ -115,6 +121,7 @@ generate_wheel(){
115121
echo 'Done'
116122
"
117123
docker run --rm \
124+
--label="purpose=$dockerPurposeLabel" \
118125
--platform=$platform \
119126
-v "$PROJECT_ROOT":/project:ro \
120127
-v $OUTPUT_PATH:/dist \

scripts/build_windows.ps1

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,14 @@ function Build-DockerImage {
1212
[string]$DockerExec = "docker.exe",
1313
[string]$DockerIsolation = "process"
1414
)
15-
15+
$dockerPurpose = "build-wheel"
16+
if ($env:CI) {
17+
$dockerPurpose = "ci"
18+
}
1619
$projectRootDirectory = (Get-Item $PSScriptRoot).Parent.FullName
1720
$dockerArgsList = @(
1821
"build",
22+
"--label=purpose=$dockerPurpose",
1923
"--isolation", $DockerIsolation,
2024
"--platform windows/amd64",
2125
"-f", $DockerfilePath,
@@ -55,8 +59,13 @@ function Build-Wheel {
5559
$UV_TOOL_DIR = "${containerCacheDir}\uvtools"
5660
$UV_PYTHON_CACHE_DIR = "${containerCacheDir}\uvpython"
5761

62+
$dockerPurpose = "build-wheel"
63+
if ($env:CI) {
64+
$dockerPurpose = "ci"
65+
}
5866
$dockerArgsList = @(
5967
"run",
68+
"--label=purpose=$dockerPurpose",
6069
"--isolation", $DockerIsolation,
6170
"--platform windows/amd64",
6271
"--rm",

scripts/resources/package_for_linux/Dockerfile

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ARG CONAN_CENTER_PROXY_V2_URL=https://center2.conan.io
1111
# If you want to use a diffrent remote for Conan, such as a proxy. Set the CONAN_CENTER_PROXY_V2_URL
1212
# Not this is only for building the image. The actual conan center proxy URL is set in the remotes.json file.
1313

14-
ARG manylinux_image=quay.io/pypa/manylinux2014_x86_64
14+
ARG manylinux_image=quay.io/pypa/manylinux2014
1515
# Base image to use, this should be of the manylinux family. More info at: https://github.com/pypa/manylinux
1616

1717
ARG UV_CACHE_DIR=/.cache/uv
@@ -33,7 +33,21 @@ RUN --mount=type=cache,target=/path/to/pipx/cache \
3333
# ==============================================================================
3434
FROM base AS conan_builder
3535
RUN --mount=type=cache,target=/var/cache/yum \
36-
yum install -y jq
36+
case $(uname -m) in \
37+
x86_64) yum install -y jq ;; \
38+
aarch64) yum install -y wget gawk; \
39+
DOWNLOAD_URL='https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux-arm64' && \
40+
EXPECTED_HASH='4dd2d8a0661df0b22f1bb9a1f9830f06b6f3b8f7d91211a1ef5d7c4f06a8b4a5' && \
41+
wget $DOWNLOAD_URL -P /tmp && \
42+
CALCULATED_HASH=$(sha256sum /tmp/jq-linux-arm64 | awk '{print $1}') && \
43+
if [ "$CALCULATED_HASH" != "$EXPECTED_HASH" ]; then \
44+
echo "Hash does not match. Expected: $EXPECTED_HASH. Got: $CALCULATED_HASH." && exit 1; \
45+
fi && \
46+
mv /tmp/jq-linux-arm64 /usr/local/bin/jq && \
47+
chmod +x /usr/local/bin/jq ;; \
48+
esac; \
49+
jq --version && \
50+
yum install -y perl-IPC-Cmd perl-Digest-SHA perl-Time-Piece
3751

3852
ARG CONAN_USER_HOME
3953
ARG CONAN_HOME
@@ -66,7 +80,7 @@ RUN --mount=type=bind,source=pyproject.toml,target=pyproject.toml \
6680
uv run --only-group conan conan install /tmp --build missing && \
6781
uv run --only-group conan conan cache clean "*" -b --source --build --temp && \
6882
uv cache prune && \
69-
if [ "$(jq -r '.remotes[0].url' ${CONAN_HOME}/remotes.json )" != "${CONAN_CENTER_PROXY_V2_URL}" ]; then \
83+
if [ -f "/tmp/remotes.json" ]; then \
7084
mv -f /tmp/remotes.json ${CONAN_HOME}/remotes.json; \
7185
fi && \
7286
mv -f /tmp/global.conf.original ${CONAN_HOME}/global.conf

scripts/resources/windows/tox/Dockerfile

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,20 +73,20 @@ COPY pyproject.toml uv.lock ${UV_PROJECT}/
7373
#SHELL ["cmd", "/S", "/C" ]
7474
ENV CONAN_CMAKE_GENERATOR=Ninja
7575
ARG CONAN_CENTER_PROXY_V2_URL
76-
RUN uv run --only-group conan conan profile detect --exist-ok ; `
76+
RUN uv run --only-group=conan conan profile detect --exist-ok ; `
7777
if (${env:CONAN_CENTER_PROXY_V2_URL} -ne $(Get-Content -Raw -Path ${Env:CONAN_HOME}\remotes.json)) { `
7878
Copy-Item -Path "${Env:CONAN_HOME}\remotes.json" -Destination "c:\remotes.json" ; `
79-
uv run --only-group conan conan remote update conan-center --url ${env:CONAN_CENTER_PROXY_V2_URL}; `
79+
uv run --only-group=conan conan remote update conan-center --url ${env:CONAN_CENTER_PROXY_V2_URL}; `
8080
}; `
81-
uv run --only-group conan conan install c:/temp/ -pr:h=default -pr:b=python -of c:/temp/delme; `
81+
uv run --only-group=conan conan install c:/temp/ -pr:h=default -pr:b=python -of c:/temp/delme -c tools.graph:skip_test=True; `
8282
if ($LASTEXITCODE -ne 0) { `
8383
throw \"Command 'conan install' failed with exit code: $LASTEXITCODE\"`
8484
} ;`
8585
Remove-Item -Path "c:\temp\delme" -Recurse -Force ; `
86-
uv run --only-group conan conan cache clean "*" -b --source --build --temp ; `
86+
uv run --only-group=conan conan cache clean "*" -b --source --build --temp -vdebug; `
8787
Remove-Item -Path "${env:UV_PROJECT}\.venv" -Recurse -Force ; `
8888
uv cache clean --no-progress ; `
89-
if (${env:CONAN_CENTER_PROXY_V2_URL} -ne $(Get-Content -Raw -Path ${Env:CONAN_HOME}\remotes.json)) { `
89+
if (Test-Path -Path "c:\remotes.json" ) { `
9090
Move-Item -Path "c:\remotes.json" -Destination "${Env:CONAN_HOME}\remotes.json" -Force ;`
9191
}
9292

@@ -114,5 +114,3 @@ WORKDIR C:/src
114114
ENV DISTUTILS_USE_SDK=1
115115

116116
COPY ["scripts/resources/windows/tox/powershell_modules", "c:/Program Files/WindowsPowerShell/Modules/"]
117-
# To help mark the image as a CI image so it can be cleaned up more easily
118-
LABEL purpose=ci

scripts/resources/windows/tox/msvc/install_msvc.ps1

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,25 @@ function InstallMSVC{
239239
}
240240
Write-Host "Cleaning up Package Cache - Done"
241241

242-
242+
# ======== Wait for Windows Update to finish ========
243+
# It seems that installing MSVC build tools triggers Windows
244+
# update. This generates a lot of extra unneeded files for
245+
# the docker layer and bloats the image significantly.
246+
# Waiting for the update to finish and then cleaning up the
247+
# generated files seems to be the best solution to keep the
248+
# layor size down.
249+
250+
$timeout = New-TimeSpan -Hours 1
251+
$stopwatch = [System.Diagnostics.Stopwatch]::StartNew()
252+
$installer = New-Object -ComObject Microsoft.Update.Installer
253+
while ($installer.IsBusy) {
254+
Write-Host "Windows Update is currently busy installing updates. Waiting..."
255+
if ($stopwatch.Elapsed -gt $timeout) {
256+
$stopwatch.Stop()
257+
throw "Timeout exceeded: Operation took longer than 1 hour."
258+
}
259+
Start-Sleep -Seconds 30
260+
}
243261
# ======== Cleanup SoftwareDistribution folder ========
244262
$SoftwareDistributionDownloadPath = "C:\Windows\SoftwareDistribution\Download"
245263
if (Test-Path "$SoftwareDistributionDownloadPath"){

0 commit comments

Comments
 (0)