Skip to content

Commit 0b6cc1c

Browse files
fix(vhd): remove bundled overlaybd packages after artifact streaming install (#8651)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b899e7a commit 0b6cc1c

2 files changed

Lines changed: 24 additions & 0 deletions

File tree

vhdbuilder/packer/install-dependencies.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,8 @@ installAndConfigureArtifactStreaming() {
646646
/opt/acr/tools/overlaybd/config.sh exporterConfig.enable true
647647
/opt/acr/tools/overlaybd/config.sh exporterConfig.port 9863
648648
systemctl link /opt/overlaybd/overlaybd-tcmu.service /opt/overlaybd/snapshotter/overlaybd-snapshotter.service
649+
# Remove the bundled overlaybd installer packages (~55-58 MB); install.sh already installed them and they're unused at runtime.
650+
rm -f /opt/acr/tools/overlaybd/bin/*.deb /opt/acr/tools/overlaybd/bin/*.rpm
649651
echo " - acr-mirror version ${version}" >> ${VHD_LOGS_FILEPATH}
650652
}
651653

vhdbuilder/packer/test/linux-vhd-content-test.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,27 @@ testAuditDNotPresent() {
538538
echo "$test:Finish"
539539
}
540540

541+
testArtifactStreamingPackagesCleanedUp() {
542+
local test="testArtifactStreamingPackagesCleanedUp"
543+
echo "$test:Start"
544+
local overlaybdBinDir="/opt/acr/tools/overlaybd/bin"
545+
# Skip if artifact streaming (acr-mirror) isn't installed on this VHD.
546+
if [ ! -d "$overlaybdBinDir" ]; then
547+
echo "$overlaybdBinDir not present; artifact streaming not installed on this VHD, skipping"
548+
echo "$test:Finish"
549+
return
550+
fi
551+
# The bundled overlaybd installer packages are unused at runtime and must be removed after install.
552+
local leftovers
553+
leftovers=$(find "$overlaybdBinDir" -maxdepth 1 -type f \( -name '*.deb' -o -name '*.rpm' \) 2>/dev/null)
554+
if [ -n "$leftovers" ]; then
555+
err $test "Leftover overlaybd install packages found (should be removed after install): ${leftovers}"
556+
else
557+
echo "No leftover overlaybd .deb/.rpm packages found, as expected"
558+
fi
559+
echo "$test:Finish"
560+
}
561+
541562
testChrony() {
542563
os_sku=$1
543564
local test="testChrony"
@@ -2512,3 +2533,4 @@ testPackageDownloadURLFallbackLogic
25122533
testFileOwnership $OS_SKU
25132534
testDiskQueueServiceIsActive
25142535
testVulnerableKernelModulesDisabled $OS_SKU $OS_VERSION
2536+
testArtifactStreamingPackagesCleanedUp

0 commit comments

Comments
 (0)