ci: persist NuGet restore cache across Linux builds [CI]
This commit is contained in:
1 parent
f2af7950e7
commit
59c98e6d7b
6 files changed
+34
-25
No files matched your search
@@ -22,6 +22,8 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
source "$root/ci/version.sh"
|
||||
export NUGET_PACKAGES="${NUGET_PACKAGES:-/home/justme/woodpecker/cache/nuget/packages}"
|
||||
mkdir -p "$NUGET_PACKAGES"
|
||||
if [[ "$mode" == dev ]]; then
|
||||
[[ "${CI_PIPELINE_EVENT:-}" == push && "${CI_COMMIT_BRANCH:-}" == main && "${CI_COMMIT_MESSAGE:-}" == *'[CI]'* ]] || exit 2
|
||||
else
|
||||
@@ -30,7 +32,6 @@ fi
|
||||
moshiro_apply_version
|
||||
|
||||
if [[ "$mode" == dev || "$mode" == release ]]; then
|
||||
export NUGET_PACKAGES="${NUGET_PACKAGES:-/home/justme/woodpecker/cache/nuget/packages}"
|
||||
if [[ "$mode" == dev ]]; then
|
||||
backend_rids=(linux-x64)
|
||||
else
|
||||
@@ -81,12 +82,24 @@ if [[ "$mode" == dev || "$mode" == agent ]]; then
|
||||
mkdir -p "$builder_context"
|
||||
tr -d '\r' < "$root/global.json" > "$builder_context/global.json"
|
||||
touch -t 200001010000 "$builder_context/global.json"
|
||||
echo 'building the shared NativeAOT toolchain once'
|
||||
python3 "$root/ci/run-with-timeout.py" 1800 buildah bud --layers --force-rm --network host --tls-verify=true --arch amd64 \
|
||||
--build-arg "AOTANYWHERE_VERSION=$MOSHIRO_AOTANYWHERE_VERSION" \
|
||||
--build-arg "ZIG_TOOLSET_VERSION=$MOSHIRO_ZIG_TOOLSET_VERSION" \
|
||||
-f "$root/packaging/container/NativeAot.Builder.Containerfile" \
|
||||
-t "$builder_image" "$builder_context"
|
||||
echo 'building the shared NativeAOT toolchain once from the persistent NuGet cache'
|
||||
builder_ready=false
|
||||
for attempt in 1 2 3; do
|
||||
if python3 "$root/ci/run-with-timeout.py" 900 buildah bud --layers --force-rm --network host --tls-verify=true --arch amd64 \
|
||||
--volume "$NUGET_PACKAGES:/root/.nuget/packages:z" \
|
||||
--build-arg "AOTANYWHERE_VERSION=$MOSHIRO_AOTANYWHERE_VERSION" \
|
||||
--build-arg "ZIG_TOOLSET_VERSION=$MOSHIRO_ZIG_TOOLSET_VERSION" \
|
||||
-f "$root/packaging/container/NativeAot.Builder.Containerfile" \
|
||||
-t "$builder_image" "$builder_context"; then
|
||||
builder_ready=true
|
||||
break
|
||||
fi
|
||||
if [[ "$attempt" -lt 3 ]]; then
|
||||
echo "NativeAOT toolchain build attempt $attempt failed; retrying after NuGet cache updates" >&2
|
||||
sleep 5
|
||||
fi
|
||||
done
|
||||
[[ "$builder_ready" == true ]] || { echo 'could not prepare the NativeAOT toolchain' >&2; exit 1; }
|
||||
fi
|
||||
builder_image="$(buildah images --noheading --no-trunc --format '{{.ID}}' "$builder_image")"
|
||||
printf '%s\n' "$MOSHIRO_NATIVEAOT_BUILDER_KEY" > "$base_home/nativeaot-builder.key"
|
||||
|
||||
Reference in new issue
Block a user