@@ -184,6 +184,54 @@ phases:
184
184
fi
185
185
fi
186
186
187
+ - name : CreatingJsonFile
188
+ action : CreateFile
189
+ inputs :
190
+ - path : /etc/parallelcluster/image_dna.json
191
+ content : |
192
+ ${CfnParamChefDnaJson}
193
+ overwrite : true
194
+
195
+ - name : DisableKernelUpdate
196
+ action : ExecuteBash
197
+ inputs :
198
+ commands :
199
+ - |
200
+ set -v
201
+ DISABLE_KERNEL_UPDATE=$(cat /etc/parallelcluster/image_dna.json | jq -r '.cluster.disable_kernel_update.enabled')
202
+ echo "${!DISABLE_KERNEL_UPDATE}"
203
+
204
+ - name : PinKernelVersion
205
+ action : ExecuteBash
206
+ inputs :
207
+ commands :
208
+ - |
209
+ set -v
210
+ OS='{{ build.OperatingSystemName.outputs.stdout }}'
211
+ PLATFORM='{{ build.PlatformName.outputs.stdout }}'
212
+ DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
213
+
214
+ if [[ ${!DISABLE_KERNEL_UPDATE} == true ]]; then
215
+ if [[ ${!PLATFORM} == RHEL ]]; then
216
+ yum install -y yum-plugin-versionlock
217
+ # listing all the packages because wildcard does not work as expected
218
+ yum versionlock kernel kernel-core kernel-modules
219
+
220
+ if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
221
+ yum versionlock kernel-abi-whitelists
222
+ else
223
+ yum versionlock kernel-abi-stablelists
224
+ fi
225
+
226
+ if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
227
+ yum versionlock rocky-release rocky-repos
228
+ elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
229
+ yum versionlock redhat-release
230
+ fi
231
+ echo "Kernel version locked"
232
+ fi
233
+ fi
234
+
187
235
# Install prerequisite OS packages
188
236
- name : InstallPrerequisite
189
237
action : ExecuteBash
@@ -284,14 +332,6 @@ phases:
284
332
cookbook_path ['/etc/chef/cookbooks']
285
333
overwrite : true
286
334
287
- - name : CreatingJsonFile
288
- action : CreateFile
289
- inputs :
290
- - path : /etc/parallelcluster/image_dna.json
291
- content : |
292
- ${CfnParamChefDnaJson}
293
- overwrite : true
294
-
295
335
- name : InstallPClusterPackages
296
336
action : ExecuteBash
297
337
inputs :
@@ -310,6 +350,34 @@ phases:
310
350
{{ build.PClusterCookbookVersionName.outputs.stdout }}
311
351
overwrite : true
312
352
353
+ - name : RemoveKernelPin
354
+ action : ExecuteBash
355
+ inputs :
356
+ commands :
357
+ - |
358
+ set -v
359
+ OS='{{ build.OperatingSystemName.outputs.stdout }}'
360
+ PLATFORM='{{ build.PlatformName.outputs.stdout }}'
361
+ DISABLE_KERNEL_UPDATE='{{ build.DisableKernelUpdate.outputs.stdout }}'
362
+
363
+ # Remove kernel version lock
364
+ if [[ ${!DISABLE_KERNEL_UPDATE} == true ]] && [[ ${!PLATFORM} == RHEL ]]; then
365
+ yum versionlock delete kernel kernel-core kernel-modules
366
+
367
+ if [[ ${!OS} == "alinux2" ]] || [[ ${!OS} == "alinux2023" ]] ; then
368
+ yum versionlock delete kernel-abi-whitelists
369
+ else
370
+ yum versionlock delete kernel-abi-stablelists
371
+ fi
372
+
373
+ if [[ ${!OS} == "rocky8" ]] || [[ ${!OS} == "rocky9" ]] ; then
374
+ yum versionlock delete rocky-release
375
+ elif [[ ${!OS} == "rhel8" ]] || [[ ${!OS} == "rhel9" ]] ; then
376
+ yum versionlock delete redhat-release
377
+ fi
378
+ echo "Kernel version unlocked"
379
+ fi
380
+
313
381
- name : KeepSSM
314
382
action : ExecuteBash
315
383
inputs :
0 commit comments