Skip to content

Commit bd4c015

Browse files
Fix build-image failure on Rocky 9, occurring when the parent image does not ship the latest kernel version on the latest Rocky minor version
Add back the safety net to download package from vault. The overall package installation order is: 1. yum install -y ${!PACKAGE} (from the current mirrorlist of OS repo) 2. If (1) fails, enable vault repo as baseurl and retry the installation 3. If (2) fails, download package rpm from vault The previous commit 6a820d7 did fix image build on older Rocky minor versions and removed the third safety net. The third safety net could be useful as described in the comment in the code
1 parent 106ba30 commit bd4c015

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CHANGELOG
1414

1515
**BUG FIXES**
1616
- Fix an issue where Security Group validation failed when a rule contained both IPv4 ranges (IpRanges) and security group references (UserIdGroupPairs).
17+
- Fix `build-image` failure on Rocky 9, occurring when the parent image does not ship the latest kernel version on the latest Rocky minor version.
1718

1819
3.13.2
1920
------

cli/src/pcluster/resources/imagebuilder/parallelcluster.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,8 @@ phases:
8787
}
8888
8989
PACKAGE_LIST="kernel-headers-$(uname -r) kernel-devel-$(uname -r)"
90-
[[ ! $OS =~ (rocky8|rhel8) ]] && PACKAGE_LIST+=" kernel-devel-matched-$(uname -r)"
90+
Repository="BaseOS"
91+
[[ ! $OS =~ (rocky8|rhel8) ]] && PACKAGE_LIST+=" kernel-devel-matched-$(uname -r)" && Repository="AppStream"
9192
9293
if [[ $OS =~ rocky ]]; then
9394
for PACKAGE in ${!PACKAGE_LIST}
@@ -97,6 +98,14 @@ phases:
9798
sed -i 's|^#baseurl=http://dl.rockylinux.org/$contentdir|baseurl=http://dl.rockylinux.org/vault/rocky|g' /etc/yum.repos.d/*.repo
9899
sed -i 's|^#baseurl=https://dl.rockylinux.org/$contentdir|baseurl=https://dl.rockylinux.org/vault/rocky|g' /etc/yum.repos.d/*.repo
99100
yum install -y ${!PACKAGE}
101+
} || {
102+
# Download package from vault. Sometimes simply enabling vault is not enough if repodata index is not in vault
103+
# Using the hard-coded links to download rpm is the last safety net.
104+
# Although the following code only deal with individual packages, and doesn't have the global impact of enabling vault.
105+
# We will figure out a global safety net when needed (build failure happens again)
106+
yum install -y wget
107+
wget https://dl.rockylinux.org/vault/rocky/${!VERSION_ID}/${!Repository}/$(uname -m)/os/Packages/k/${!PACKAGE}.rpm
108+
yum install -y ./${!PACKAGE}.rpm
100109
}
101110
done
102111
else

0 commit comments

Comments
 (0)