Skip to content

Commit

Permalink
Lock kernel minor version during image build
Browse files Browse the repository at this point in the history
  • Loading branch information
hgreebe committed Dec 13, 2024
1 parent 123590a commit 7f46eb7
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions cli/src/pcluster/resources/imagebuilder/update_and_reboot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ phases:
fi
echo ${!OS}
- name: OperatingSystemVersion
action: ExecuteBash
inputs:
commands:
- |
set -v
FILE=/etc/os-release
if [ -e ${!FILE} ]; then
. ${!FILE}
echo "${!VERSION_ID}"
else
echo "The file '${!FILE}' does not exist. Failing build."
exit {{ FailExitCode }}
fi
# Get platform name
- name: PlatformName
Expand Down Expand Up @@ -151,6 +166,11 @@ phases:
set -v
OS='{{ build.OperatingSystemName.outputs.stdout }}'
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
VERSION='{{ build.OperatingSystemVersion.outputs.stdout }}'
if [[ ${!OS} == rhel9 ]]; then
echo ${!VERSION} > /etc/yum/vars/releasever
yum clean all
fi
if [[ ${!PLATFORM} == RHEL ]]; then
yum -y install jq
Expand Down Expand Up @@ -192,7 +212,7 @@ phases:
set -v
OS='{{ build.OperatingSystemName.outputs.stdout }}'
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
DISABLE_KERNEL_UPDATE='true'
if [[ ${!DISABLE_KERNEL_UPDATE} == true ]]; then
if [[ ${!PLATFORM} == RHEL ]]; then
Expand Down Expand Up @@ -223,9 +243,9 @@ phases:
set -v
OS='{{ build.OperatingSystemName.outputs.stdout }}'
PLATFORM='{{ build.PlatformName.outputs.stdout }}'
DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
DISABLE_KERNEL_UPDATE='true'
if [[ ${!PLATFORM} == RHEL ]]; then
if [[ ${!PLATFORM} == RHEL ]] && [[ ${!DISABLE_KERNEL_UPDATE} == true ]]; then
yum -y update
if [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rhel9" ]] || [[ ${!OS} == "rocky9" ]] || [[ ${!OS} == "alinux2023" ]] ; then
Expand Down

0 comments on commit 7f46eb7

Please sign in to comment.