From b83107e0630849aa3a59d1eebe6de9efd294d5ca Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Tue, 2 Jul 2024 17:14:32 -0500 Subject: [PATCH 1/3] CentOS 7 boot hotfix This hotfix applies changes to the yum repository configuration that are necessary after the EOL of CentOS 7. --- .../files/early_run_hotfixes.sh | 32 +++++++++++++++++++ modules/scripts/startup-script/main.tf | 7 ++++ 2 files changed, 39 insertions(+) create mode 100644 modules/scripts/startup-script/files/early_run_hotfixes.sh diff --git a/modules/scripts/startup-script/files/early_run_hotfixes.sh b/modules/scripts/startup-script/files/early_run_hotfixes.sh new file mode 100644 index 0000000000..682e1352a1 --- /dev/null +++ b/modules/scripts/startup-script/files/early_run_hotfixes.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# Copyright 2024 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This script applies fixes to VMs that must occur early in boot. For example, +# when yum or apt repositories are misconfigured, preventing most package +# operations from completing successfully. + +source /etc/os-release + +if [[ "$PRETTY_NAME" == "CentOS Linux 7 (Core)" ]]; then + echo "Applying hotfixes for CentOS 7" + if grep -q '^mirrorlist' /etc/yum.repos.d/CentOS-Base.repo; then + echo "Removing mirrorlist from default CentOS 7 repositories" + sed -i '/^mirrorlist/d' /etc/yum.repos.d/CentOS-Base.repo + fi + if grep -q '^#baseurl=http://mirror.centos.org' /etc/yum.repos.d/CentOS-Base.repo; then + echo "Reconfiguring default CentOS 7 repositories to use CentOS Vault" + sed -i 's,^#baseurl=http://mirror.centos.org/,baseurl=http://vault.centos.org/,' /etc/yum.repos.d/CentOS-Base.repo + fi +fi diff --git a/modules/scripts/startup-script/main.tf b/modules/scripts/startup-script/main.tf index b9d9163da7..0486d78533 100644 --- a/modules/scripts/startup-script/main.tf +++ b/modules/scripts/startup-script/main.tf @@ -108,8 +108,15 @@ locals { args = var.ansible_virtualenv_path }] : [] + hotfix_runner = [{ + type = "shell" + source = "${path.module}/files/early_run_hotfixes.sh" + destination = "early_run_hotfixes.sh" + }] + runners = concat( local.warnings, + local.hotfix_runner, local.proxy_runner, local.monitoring_agent_installer, local.ansible_installer, From 419968aaaf96556c2da68ca8e4cd830af3a26b28 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Tue, 2 Jul 2024 17:14:32 -0500 Subject: [PATCH 2/3] Adopt CentOS 7 boot fix commit in startup-script module --- modules/compute/vm-instance/README.md | 2 +- modules/compute/vm-instance/startup_from_network_storage.tf | 2 +- modules/scheduler/batch-job-template/README.md | 2 +- .../batch-job-template/startup_from_network_storage.tf | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/compute/vm-instance/README.md b/modules/compute/vm-instance/README.md index 159019dc0c..01ec6f6bd1 100644 --- a/modules/compute/vm-instance/README.md +++ b/modules/compute/vm-instance/README.md @@ -185,7 +185,7 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| -| [netstorage\_startup\_script](#module\_netstorage\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | v1.35.0&depth=1 | +| [netstorage\_startup\_script](#module\_netstorage\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | b83107e0 | ## Resources diff --git a/modules/compute/vm-instance/startup_from_network_storage.tf b/modules/compute/vm-instance/startup_from_network_storage.tf index 17dbd97bd2..993952ad20 100644 --- a/modules/compute/vm-instance/startup_from_network_storage.tf +++ b/modules/compute/vm-instance/startup_from_network_storage.tf @@ -55,7 +55,7 @@ locals { } module "netstorage_startup_script" { - source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.35.0&depth=1" + source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=b83107e0" labels = local.labels project_id = var.project_id diff --git a/modules/scheduler/batch-job-template/README.md b/modules/scheduler/batch-job-template/README.md index ef9b816346..2ac9dafc81 100644 --- a/modules/scheduler/batch-job-template/README.md +++ b/modules/scheduler/batch-job-template/README.md @@ -139,7 +139,7 @@ limitations under the License. | Name | Source | Version | |------|--------|---------| | [instance\_template](#module\_instance\_template) | terraform-google-modules/vm/google//modules/instance_template | ~> 10.1.1 | -| [netstorage\_startup\_script](#module\_netstorage\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | v1.35.0&depth=1 | +| [netstorage\_startup\_script](#module\_netstorage\_startup\_script) | github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script | b83107e0 | ## Resources diff --git a/modules/scheduler/batch-job-template/startup_from_network_storage.tf b/modules/scheduler/batch-job-template/startup_from_network_storage.tf index 17dbd97bd2..993952ad20 100644 --- a/modules/scheduler/batch-job-template/startup_from_network_storage.tf +++ b/modules/scheduler/batch-job-template/startup_from_network_storage.tf @@ -55,7 +55,7 @@ locals { } module "netstorage_startup_script" { - source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=v1.35.0&depth=1" + source = "github.com/GoogleCloudPlatform/hpc-toolkit//modules/scripts/startup-script?ref=b83107e0" labels = local.labels project_id = var.project_id From 07d2061d87d113dd4b8a72c9a202d49090f2ab98 Mon Sep 17 00:00:00 2001 From: Tom Downes Date: Tue, 2 Jul 2024 17:14:32 -0500 Subject: [PATCH 3/3] Address centos-7 image family deprecation The centos-7 family has been entirely deprecated. This change uses the final image from the family in integration tests until we elect to remove CentOS 7 testing entirely from the Toolkit. --- tools/cloud-build/daily-tests/blueprints/lustre-vm.yaml | 2 +- tools/validate_configs/os_compatibility_tests/vm-filestore.yaml | 2 +- tools/validate_configs/os_compatibility_tests/vm-lustre.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/cloud-build/daily-tests/blueprints/lustre-vm.yaml b/tools/cloud-build/daily-tests/blueprints/lustre-vm.yaml index 63cda04503..8da170c5b2 100644 --- a/tools/cloud-build/daily-tests/blueprints/lustre-vm.yaml +++ b/tools/cloud-build/daily-tests/blueprints/lustre-vm.yaml @@ -98,7 +98,7 @@ deployment_groups: name_prefix: centos add_deployment_name_before_prefix: true instance_image: - family: centos-7 + name: centos-7-v20240611 project: centos-cloud - id: wait-centos source: community/modules/scripts/wait-for-startup diff --git a/tools/validate_configs/os_compatibility_tests/vm-filestore.yaml b/tools/validate_configs/os_compatibility_tests/vm-filestore.yaml index 34557f50ad..feb20de9e9 100644 --- a/tools/validate_configs/os_compatibility_tests/vm-filestore.yaml +++ b/tools/validate_configs/os_compatibility_tests/vm-filestore.yaml @@ -71,7 +71,7 @@ deployment_groups: - homefs settings: instance_image: - family: centos-7 + name: centos-7-v20240611 project: centos-cloud name_prefix: workstation-centos instance_count: 1 diff --git a/tools/validate_configs/os_compatibility_tests/vm-lustre.yaml b/tools/validate_configs/os_compatibility_tests/vm-lustre.yaml index 4ad6c51b77..2263c7f1af 100644 --- a/tools/validate_configs/os_compatibility_tests/vm-lustre.yaml +++ b/tools/validate_configs/os_compatibility_tests/vm-lustre.yaml @@ -79,7 +79,7 @@ deployment_groups: name_prefix: centos instance_count: 1 instance_image: - family: centos-7 + name: centos-7-v20240611 project: centos-cloud - id: wait-centos source: community/modules/scripts/wait-for-startup