ci: pin Linux build RIDs across stages and retry runtime fetches [CI]
This commit is contained in:
1 parent
806493567b
commit
a867c9f7f6
3 files changed
+17
-3
No files matched your search
@@ -24,7 +24,7 @@ esac
|
||||
download() {
|
||||
local url="$1" destination="$2"
|
||||
if [[ ! -s "$destination" ]]; then
|
||||
curl --fail --silent --show-error --retry 3 "$url" -o "$destination"
|
||||
curl --fail --silent --show-error --retry 3 --retry-all-errors "$url" -o "$destination"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ unpack_cache="$downloads/unpacked"
|
||||
mkdir -p "$package_cache" "$unpack_cache"
|
||||
|
||||
msquic_index='https://packages.microsoft.com/debian/12/prod/pool/main/libm/libmsquic/'
|
||||
msquic_file="$(curl --fail --silent --show-error --retry 3 "$msquic_index" \
|
||||
msquic_file="$(curl --fail --silent --show-error --retry 3 --retry-all-errors "$msquic_index" \
|
||||
| grep -oE "libmsquic_[0-9]+(\.[0-9]+){1,3}_${deb_arch}\.deb" \
|
||||
| sort -Vu | tail -n 1)"
|
||||
[[ -n "$msquic_file" ]] || { echo "could not find a stable MsQuic package for $deb_arch" >&2; exit 1; }
|
||||
|
||||
@@ -8,6 +8,8 @@ ARG NODE_RID=linux-musl-arm64
|
||||
ARG STATIC_MSQUIC=true
|
||||
ENV NUGET_PACKAGES=/root/.nuget/packages
|
||||
FROM restore AS managed
|
||||
ARG NODE_RID=linux-musl-arm64
|
||||
ARG STATIC_MSQUIC=true
|
||||
ARG APP_VERSION=0.0.0-dev
|
||||
ARG MOSHIRO_TAG=
|
||||
ARG MOSHIRO_COMMIT=
|
||||
@@ -15,13 +17,19 @@ ARG MOSHIRO_BUILT_AT=
|
||||
ENV MOSHIRO_TAG=$MOSHIRO_TAG MOSHIRO_COMMIT=$MOSHIRO_COMMIT MOSHIRO_BUILT_AT=$MOSHIRO_BUILT_AT
|
||||
# Build the project graph once; both native publishes reuse these managed outputs.
|
||||
RUN --mount=type=cache,id=moshiro-nuget,target=/root/.nuget/packages,ro \
|
||||
dotnet build Agent.Native.proj -m:3 -c Release -r "$NODE_RID" --no-restore \
|
||||
test -n "$NODE_RID" \
|
||||
&& echo "building managed outputs for $NODE_RID" \
|
||||
&& dotnet build Agent.Native.proj -m:3 -c Release -r "$NODE_RID" --no-restore \
|
||||
-p:PublishAot=true -p:UseAotAnywhere=true -p:SelfContained=true -p:Version="$APP_VERSION" \
|
||||
-p:RuntimeIdentifier="$NODE_RID" \
|
||||
-p:StaticMsQuic="$STATIC_MSQUIC" -p:StaticExecutable="$STATIC_MSQUIC" \
|
||||
-p:RuntimeFrameworkVersion=10.0.12 -p:InvariantGlobalization=true \
|
||||
-p:UseAppHost=true -p:StripSymbols=true -p:DebugType=none -p:DebugSymbols=false --artifacts-path /artifacts
|
||||
|
||||
FROM managed AS build-agent
|
||||
ARG NODE_RID=linux-musl-arm64
|
||||
ARG STATIC_MSQUIC=true
|
||||
ARG APP_VERSION=0.0.0-dev
|
||||
RUN --mount=type=cache,id=moshiro-nuget,target=/root/.nuget/packages,ro \
|
||||
dotnet publish agent/src/MoShiro.Agent -m:3 -c Release -r "$NODE_RID" \
|
||||
--self-contained true --no-build --no-restore -p:PublishAot=true -p:UseAotAnywhere=true \
|
||||
@@ -36,6 +44,9 @@ RUN --mount=type=cache,id=moshiro-nuget,target=/root/.nuget/packages,ro \
|
||||
fi
|
||||
|
||||
FROM managed AS build-enroll
|
||||
ARG NODE_RID=linux-musl-arm64
|
||||
ARG STATIC_MSQUIC=true
|
||||
ARG APP_VERSION=0.0.0-dev
|
||||
RUN --mount=type=cache,id=moshiro-nuget,target=/root/.nuget/packages,ro \
|
||||
dotnet publish fleet/tools/fleet-enroll -m:3 -c Release -r "$NODE_RID" \
|
||||
--self-contained true --no-build --no-restore -p:PublishAot=true -p:UseAotAnywhere=true \
|
||||
|
||||
@@ -65,6 +65,9 @@ class LinuxBuildTests(unittest.TestCase):
|
||||
self.assertIn('Targets="Restore" BuildInParallel="false"', traversal)
|
||||
self.assertIn('Targets="Build" BuildInParallel="false"', traversal)
|
||||
self.assertIn('RuntimeIdentifier=$(RuntimeIdentifier);SelfContained=$(SelfContained)', traversal)
|
||||
containerfile = (first / 'Containerfile').read_text()
|
||||
self.assertIn('test -n "$NODE_RID"', containerfile)
|
||||
self.assertIn('-p:RuntimeIdentifier="$NODE_RID"', containerfile)
|
||||
|
||||
def test_retention_removes_only_expired_layers_without_pruning_package_caches(self):
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
|
||||
Reference in new issue
Block a user