diff --git a/.github/workflows/dokken-system-tests.yml b/.github/workflows/dokken-system-tests.yml index 0ab49662d..7264d4579 100644 --- a/.github/workflows/dokken-system-tests.yml +++ b/.github/workflows/dokken-system-tests.yml @@ -30,6 +30,7 @@ jobs: matrix: os: - alinux2 + - alinux-2023 - centos7 - ubuntu2004 - ubuntu2204 diff --git a/cookbooks/aws-parallelcluster-awsbatch/metadata.rb b/cookbooks/aws-parallelcluster-awsbatch/metadata.rb index 13386b7f3..e37a10d17 100644 --- a/cookbooks/aws-parallelcluster-awsbatch/metadata.rb +++ b/cookbooks/aws-parallelcluster-awsbatch/metadata.rb @@ -9,10 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '>= 2.0' -supports 'centos', '>= 7.0' -supports 'ubuntu', '>= 20.04' - depends 'apt', '~> 7.5.22' depends 'iptables', '~> 8.0.0' depends 'nfs', '~> 5.1.2' diff --git a/cookbooks/aws-parallelcluster-computefleet/metadata.rb b/cookbooks/aws-parallelcluster-computefleet/metadata.rb index aaef50be9..7b2f02b37 100644 --- a/cookbooks/aws-parallelcluster-computefleet/metadata.rb +++ b/cookbooks/aws-parallelcluster-computefleet/metadata.rb @@ -9,9 +9,4 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.7' - depends 'aws-parallelcluster-shared', '~> 3.10.0' diff --git a/cookbooks/aws-parallelcluster-entrypoints/metadata.rb b/cookbooks/aws-parallelcluster-entrypoints/metadata.rb index b3ff8535e..4c28fb84c 100644 --- a/cookbooks/aws-parallelcluster-entrypoints/metadata.rb +++ b/cookbooks/aws-parallelcluster-entrypoints/metadata.rb @@ -9,11 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.7' - depends 'aws-parallelcluster-shared', '~> 3.10.0' depends 'aws-parallelcluster-platform', '~> 3.10.0' depends 'aws-parallelcluster-environment', '~> 3.10.0' diff --git a/cookbooks/aws-parallelcluster-environment/kitchen.environment-install.yml b/cookbooks/aws-parallelcluster-environment/kitchen.environment-install.yml index 290e4dc54..b5e22c52d 100644 --- a/cookbooks/aws-parallelcluster-environment/kitchen.environment-install.yml +++ b/cookbooks/aws-parallelcluster-environment/kitchen.environment-install.yml @@ -113,16 +113,6 @@ suites: verifier: controls: - tag:install_cfnbootstrap_virtualenv_created - - name: cfnconfig_mixed - run_list: - - recipe[aws-parallelcluster-tests::setup] - - recipe[aws-parallelcluster-environment::cfnconfig_mixed] - verifier: - controls: - - /tag:install_cfnconfig/ - attributes: - dependencies: - - recipe:aws-parallelcluster-platform::directories - name: isolated run_list: - recipe[aws-parallelcluster-tests::setup] diff --git a/cookbooks/aws-parallelcluster-environment/metadata.rb b/cookbooks/aws-parallelcluster-environment/metadata.rb index a9e861a21..bc9563b1a 100644 --- a/cookbooks/aws-parallelcluster-environment/metadata.rb +++ b/cookbooks/aws-parallelcluster-environment/metadata.rb @@ -9,11 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.7' - depends 'line', '~> 4.5.13' depends 'nfs', '~> 5.1.2' diff --git a/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb b/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb index 17fdb14b0..7293a606d 100644 --- a/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb +++ b/cookbooks/aws-parallelcluster-environment/recipes/config/network_interfaces.rb @@ -12,7 +12,8 @@ # OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and # limitations under the License. -return if on_docker? +# amazon-ec2-net-utils is pre-installed in AL2023 and handles multi-nics instances properly +return if on_docker? || platform?('amazon') && node['platform_version'].to_i == 2023 def network_card_index(mac, token) uri = URI("http://169.254.169.254/latest/meta-data/network/interfaces/macs/#{mac}/network-card") diff --git a/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/cloudwatch_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/cloudwatch_alinux2023.rb new file mode 100644 index 000000000..d1bd9fc85 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/cloudwatch_alinux2023.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :cloudwatch, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_cloudwatch_common' +use 'partial/_cloudwatch_install_package_rhel' + +action :cloudwatch_prerequisite do + package "gnupg2-full" do + options '--allowerasing' + retries 3 + retry_delay 5 + end + # on alinux2023, install and enable ryslog: https://repost.aws/knowledge-center/ec2-linux-al2023-find-log-files + package "rsyslog" do + retries 3 + retry_delay 5 + end + service 'rsyslog' do + supports restart: true + action %i(enable start) + retries 5 + retry_delay 10 + end unless on_docker? +end + +action_class do + def platform_url_component + 'amazon_linux' + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb index e8ca75f3b..856ec99de 100644 --- a/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb +++ b/cookbooks/aws-parallelcluster-environment/resources/cloudwatch/partial/_cloudwatch_common.rb @@ -16,11 +16,17 @@ unified_mode true default_action :setup +action :cloudwatch_prerequisite do + # Do nothing +end + action :setup do directory node['cluster']['sources_dir'] do recursive true end + action_cloudwatch_prerequisite + public_key_local_path = "#{node['cluster']['sources_dir']}/amazon-cloudwatch-agent.gpg" remote_file public_key_local_path do source 'https://s3.amazonaws.com/amazoncloudwatch-agent/assets/amazon-cloudwatch-agent.gpg' diff --git a/cookbooks/aws-parallelcluster-environment/resources/ec2_udev_rules/ec2_udev_rules_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/ec2_udev_rules/ec2_udev_rules_alinux2023.rb new file mode 100644 index 000000000..fdae0e11b --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/ec2_udev_rules/ec2_udev_rules_alinux2023.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. +provides :ec2_udev_rules, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +unified_mode true +use 'partial/_common_udev_configuration' + +default_action :setup + +action :setup do + action_create_common_udev_files + action_start_ec2blk +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/efa/efa_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/efa/efa_alinux2023.rb new file mode 100644 index 000000000..0efb384da --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/efa/efa_alinux2023.rb @@ -0,0 +1,31 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :efa, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end +unified_mode true +default_action :setup + +use 'partial/_common' + +action_class do + def conflicting_packages + %w(openmpi-devel openmpi) + end + + def prerequisites + %w(environment-modules libibverbs-utils librdmacm-utils rdma-core-devel) + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/efs/efs_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/efs/efs_alinux2023.rb new file mode 100644 index 000000000..fbc5baa35 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/efs/efs_alinux2023.rb @@ -0,0 +1,35 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :efs, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_get_package_version_rpm' +use 'partial/_common' +use 'partial/_mount_umount' + +action :install_utils do + package_name = "amazon-efs-utils" + + # Do not install efs-utils if a same or newer version is already installed. + return if already_installed?(package_name, new_resource.efs_utils_version) + + # On Amazon Linux 2, amazon-efs-utils and stunnel are installed from OS repo. + package package_name do + retries 3 + retry_delay 5 + end + action_increase_poll_interval +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/ephemeral_drives/ephemeral_drives_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/ephemeral_drives/ephemeral_drives_alinux2023.rb new file mode 100644 index 000000000..8854b6446 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/ephemeral_drives/ephemeral_drives_alinux2023.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :ephemeral_drives, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_ephemeral_drives_common.rb' + +action_class do + def network_target + 'network.target' + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/lustre/lustre_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/lustre/lustre_alinux2023.rb new file mode 100644 index 000000000..a9e387586 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/lustre/lustre_alinux2023.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :lustre, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end +unified_mode true + +use 'partial/_mount_unmount' + +default_action :setup + +action :setup do + package 'lustre-client' do + retries 3 + retry_delay 5 + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/network_service/network_service_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/network_service/network_service_alinux2023.rb new file mode 100644 index 000000000..45cb06a60 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/network_service/network_service_alinux2023.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :network_service, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_network_service' + +def network_service_name + 'systemd-resolved' +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/nfs/nfs_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/nfs/nfs_alinux2023.rb new file mode 100644 index 000000000..b7173382f --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/nfs/nfs_alinux2023.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :nfs, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end +unified_mode true + +use 'partial/_install_nfs4_and_disable' +use 'partial/_configure' + +default_action :setup + +action :setup do + action_install_nfs4 + action_disable_start_at_boot +end + +action_class do + def override_server_template + edit_resource(:template, node['nfs']['config']['server_template']) do + cookbook 'nfs' + end + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/raid/raid_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/raid/raid_alinux2023.rb new file mode 100644 index 000000000..1b1ee5201 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/raid/raid_alinux2023.rb @@ -0,0 +1,11 @@ +provides :raid, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_raid_common' + +action_class do + def raid_superblock_version + '1.2' + end +end diff --git a/cookbooks/aws-parallelcluster-environment/resources/system_authentication/system_authentication_alinux2023.rb b/cookbooks/aws-parallelcluster-environment/resources/system_authentication/system_authentication_alinux2023.rb new file mode 100644 index 000000000..9fe9acca5 --- /dev/null +++ b/cookbooks/aws-parallelcluster-environment/resources/system_authentication/system_authentication_alinux2023.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :system_authentication, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_system_authentication_common' +use 'partial/_system_authentication_alinux_centos' + +action_class do + def required_packages + %w(sssd sssd-tools sssd-ldap authconfig) + end +end diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb index 28e8c8325..0d1f4783f 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/cloudwatch_spec.rb @@ -13,6 +13,11 @@ it { should exist } end + describe bash("gpg-agent --version") do + its('exit_status') { should eq 0 } + its('stdout') { should match /gpg-agent (GnuPG)*/ } + end + describe 'Check the presence of the cloudwatch package gpg key' # In Ubuntu >20.04 due to environment variable the keyring is placed under home of the user ubuntu with the permission of root ubuntu2004 = os_properties.ubuntu2004? diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/efs_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/efs_spec.rb index caeb33f43..4c0d90550 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/efs_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/efs_spec.rb @@ -10,7 +10,7 @@ its('owner') { should eq 'root' } its('group') { should eq 'root' } its('mode') { should cmp '0644' } - end unless os_properties.alinux2? + end unless os_properties.alinux? describe package('amazon-efs-utils') do it { should be_installed } diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/lustre_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/lustre_spec.rb index febd78005..0d1f5b707 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/lustre_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/lustre_spec.rb @@ -72,12 +72,14 @@ end end - if os_properties.alinux2? + if os_properties.alinux? describe package('lustre-client') do it { should be_installed } its('version') { should cmp >= minimal_lustre_client_version } end + end + if os_properties.alinux2? describe yum.repo('amzn2extra-lustre') do it { should exist } it { should be_enabled } @@ -87,7 +89,7 @@ control 'tag:install_lustre_lnet_kernel_module_enabled' do title "Verify that lnet kernel module is enabled" - only_if { !os_properties.on_docker? && !os_properties.alinux2? } + only_if { !os_properties.on_docker? && !os_properties.alinux? } describe kernel_module("lnet") do it { should be_loaded } it { should_not be_disabled } diff --git a/cookbooks/aws-parallelcluster-environment/test/controls/system_authentication_spec.rb b/cookbooks/aws-parallelcluster-environment/test/controls/system_authentication_spec.rb index bc2e077b0..4d2e8f4c9 100644 --- a/cookbooks/aws-parallelcluster-environment/test/controls/system_authentication_spec.rb +++ b/cookbooks/aws-parallelcluster-environment/test/controls/system_authentication_spec.rb @@ -35,7 +35,7 @@ services = %w(sssd) - if os_properties.redhat8? + if os.redhat? services.append("oddjobd") end @@ -55,8 +55,7 @@ only_if { node['cluster']['node_type'] != 'ComputeFleet' || node['cluster']['directory_service']['disabled_on_compute_nodes'] != 'true' } describe 'Check NSS and PAM to use SSSD for system authentication and identity information' - if os_properties.redhat8? - + if os_properties.redhat? describe bash("authselect current") do its('exit_status') { should eq 0 } its('stdout') { should match /Profile ID: sssd/ } diff --git a/cookbooks/aws-parallelcluster-platform/files/dcv/pcluster_dcv_connect.sh b/cookbooks/aws-parallelcluster-platform/files/dcv/pcluster_dcv_connect.sh index bf0b699bf..1b6c26999 100644 --- a/cookbooks/aws-parallelcluster-platform/files/dcv/pcluster_dcv_connect.sh +++ b/cookbooks/aws-parallelcluster-platform/files/dcv/pcluster_dcv_connect.sh @@ -112,7 +112,7 @@ main() { os=$(< /etc/chef/dna.json jq -r .cluster.base_os) _log "Input parameters: user: ${user}, OS: ${os}, shared_folder_path: ${shared_folder_path}." - if ! [[ "${os}" =~ ^(alinux2|ubuntu2004|ubuntu2204|centos[7-8]|rhel8|rocky8|rhel9|rocky9)$ ]]; then + if ! [[ "${os}" =~ ^(alinux2|alinux2023|ubuntu2004|ubuntu2204|centos[7-8]|rhel8|rocky8|rhel9|rocky9)$ ]]; then _fail "OS not supported." fi diff --git a/cookbooks/aws-parallelcluster-platform/metadata.rb b/cookbooks/aws-parallelcluster-platform/metadata.rb index d5e059bf7..0d49b4e95 100644 --- a/cookbooks/aws-parallelcluster-platform/metadata.rb +++ b/cookbooks/aws-parallelcluster-platform/metadata.rb @@ -9,11 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.7' - depends 'line', '~> 4.5.13' depends 'aws-parallelcluster-shared', '~> 3.10.0' diff --git a/cookbooks/aws-parallelcluster-platform/recipes/install.rb b/cookbooks/aws-parallelcluster-platform/recipes/install.rb index b2a43f262..58692c26b 100644 --- a/cookbooks/aws-parallelcluster-platform/recipes/install.rb +++ b/cookbooks/aws-parallelcluster-platform/recipes/install.rb @@ -19,7 +19,10 @@ install_packages 'Install OS and extra packages' include_recipe "aws-parallelcluster-platform::cookbook_virtualenv" include_recipe "aws-parallelcluster-platform::awscli" -include_recipe "openssh" +unless alinux2023_on_docker? # Running this recipe on Alinux 2023 docker generates false failure. + # Example failure https://github.com/aws/aws-parallelcluster-cookbook/actions/runs/9373643185/job/25807894209?pr=2692 + include_recipe "openssh" +end include_recipe "aws-parallelcluster-platform::disable_selinux" include_recipe "aws-parallelcluster-platform::license_readme" include_recipe "aws-parallelcluster-platform::gc_thresh_values" diff --git a/cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb b/cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb index 65c366b64..ecea9784f 100644 --- a/cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb +++ b/cookbooks/aws-parallelcluster-platform/recipes/install/cuda.rb @@ -50,7 +50,9 @@ cwd '/tmp' code <<-CUDA set -e - ./cuda.run --silent --toolkit --samples + mkdir /cuda-install + ./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install + rm -rf /cuda-install rm -f /tmp/cuda.run CUDA creates "/usr/local/cuda-#{cuda_version}" diff --git a/cookbooks/aws-parallelcluster-platform/resources/arm_pl/arm_pl_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/arm_pl/arm_pl_alinux2023.rb new file mode 100644 index 000000000..5a522ec9e --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/arm_pl/arm_pl_alinux2023.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :arm_pl, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_arm_pl_common.rb' + +action_class do + def armpl_platform + 'RHEL-9' + end + + def gcc_major_minor_version + '11.3' + end +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/build_tools/build_tools_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/build_tools/build_tools_alinux2023.rb new file mode 100644 index 000000000..84728360d --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/build_tools/build_tools_alinux2023.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :build_tools, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_build_tools_yum.rb' + +action_class do + def packages + %w(gcc gcc-c++ make) + end +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/c_states/c_states_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/c_states/c_states_alinux2023.rb new file mode 100644 index 000000000..5decb9ff2 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/c_states/c_states_alinux2023.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :c_states, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_c_states_common' +use 'partial/_c_states_redhat_based' diff --git a/cookbooks/aws-parallelcluster-platform/resources/chrony/chrony_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/chrony/chrony_alinux2023.rb new file mode 100644 index 000000000..ffa5a48eb --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/chrony/chrony_alinux2023.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :chrony, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_chrony_common.rb' + +action_class do + def chrony_conf_path + '/etc/chrony.conf' + end + + def chrony_service + 'chronyd' + end +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/dcv/dcv_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/dcv/dcv_alinux2023.rb new file mode 100644 index 000000000..86ce01a1a --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/dcv/dcv_alinux2023.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :dcv, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_dcv_common' +use 'partial/_rhel_common' + +# DCV is not supported for AL2023 +def dcv_supported? + false +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/fabric_manager/fabric_manager_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/fabric_manager/fabric_manager_alinux2023.rb new file mode 100644 index 000000000..82412454e --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/fabric_manager/fabric_manager_alinux2023.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :fabric_manager, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_fabric_manager_common.rb' +use 'partial/_fabric_manager_install_rhel.rb' + +def fabric_manager_package + 'nvidia-fabric-manager' +end + +def fabric_manager_version + _nvidia_driver_version +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/gdrcopy/gdrcopy_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/gdrcopy/gdrcopy_alinux2023.rb new file mode 100644 index 000000000..9dd6d34a3 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/gdrcopy/gdrcopy_alinux2023.rb @@ -0,0 +1,36 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :gdrcopy, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_gdrcopy_common.rb' +use 'partial/_gdrcopy_common_rhel.rb' + +def gdrcopy_enabled? + nvidia_enabled? +end + +def gdrcopy_build_dependencies + %w(dkms rpm-build make check check-devel) # Subunit is not available in Al2023 +end + +def gdrcopy_platform + 'amzn-2023' +end + +def gdrcopy_arch + arm_instance? ? 'aarch64' : 'x86_64' +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_alinux2023.rb new file mode 100644 index 000000000..229130fa3 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/install_packages/install_packages_alinux2023.rb @@ -0,0 +1,52 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :install_packages, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_install_packages_common.rb' +use 'partial/_install_packages_rhel_amazon.rb' + +action :install do + package new_resource.packages do + # TODO: Installing the full version using option + options '--allowerasing' + retries 10 + retry_delay 5 + flush_cache({ before: true }) + end +end + +def default_packages + # environment-modules required by EFA, Intel MPI and ARM PL + # Removed libssh2-devel from base_packages since is not shipped by RedHat 8 and in conflict with package libssh-0.9.6-3.el8.x86_64 + # iptables needed for IMDS setup + # Removed curl since curl-minimal-8.5.0-1.amzn2023* is already shipped and conficts. + # Or we can use full-featured curl if needed by running dnf install --allowerasing curl-full libcurl-full (https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes-2022.0.20220824.html#major-changes-20220824) + %w(ksh tcsh zsh openssl-devel ncurses-devel pam-devel net-tools + libXmu-devel hwloc-devel libdb-devel tcl-devel automake autoconf libtool + httpd boost-devel mlocate R atlas-devel + blas-devel libffi-devel dkms libedit-devel jq + libical-devel sendmail libxml2-devel libglvnd-devel + libgcrypt-devel libevent-devel glibc-static bind-utils + iproute python3 python3-pip libcurl-devel + coreutils environment-modules gcc gcc-c++ bzip2 iptables vim yum-plugin-versionlock) +end + +def unsupported_packages + # Using `sudo dnf supportinfo --pkg ` to find if packages are available + # The list here is a record of what packages are absent on Amazon Linux 2023. This list is not used in the code. + %w(openmotif-devel moreutils) +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/modules/modules_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/modules/modules_alinux2023.rb new file mode 100644 index 000000000..d69816903 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/modules/modules_alinux2023.rb @@ -0,0 +1,30 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :modules, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_modules_common.rb' +use 'partial/_modules_yum.rb' + +action_class do + def packages + %w(environment-modules) + end + + def modulepath_config_file + '/etc/environment-modules/modulespath' + end +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/nvidia_dcgm/nvidia_dcgm_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/nvidia_dcgm/nvidia_dcgm_alinux2023.rb new file mode 100644 index 000000000..7bda32b49 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/nvidia_dcgm/nvidia_dcgm_alinux2023.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :nvidia_dcgm, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_nvidia_dcgm_common.rb' + +def _nvidia_dcgm_enabled + _nvidia_enabled +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_alinux2023.rb new file mode 100644 index 000000000..81f6261aa --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_alinux2023.rb @@ -0,0 +1,37 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :nvidia_driver, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_nvidia_driver_common.rb' + +def set_compiler? + # Amazon linux 2 with Kernel 5 need to set CC to /usr/bin/gcc10-gcc using dkms override + node['kernel']['release'].split('.')[0].to_i == 6 +end + +def compiler_version + # gcc 11.4.1 is the default version installed + 'gcc' +end + +def compiler_path + 'CC=/usr/bin/gcc' +end + +def extra_packages + %w(kernel-modules-extra kernel-modules-extra-common) +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_amazon2.rb b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_amazon2.rb index 69067a8b0..b2a7a5d94 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_amazon2.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/nvidia_driver_amazon2.rb @@ -22,5 +22,13 @@ def set_compiler? end def compiler_version + 'gcc10' +end + +def compiler_path 'CC=/usr/bin/gcc10-gcc' end + +def extra_packages + %w() +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/partial/_nvidia_driver_common.rb b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/partial/_nvidia_driver_common.rb index e758d8fc2..aae0fb8bf 100644 --- a/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/partial/_nvidia_driver_common.rb +++ b/cookbooks/aws-parallelcluster-platform/resources/nvidia_driver/partial/_nvidia_driver_common.rb @@ -50,17 +50,25 @@ end if set_compiler? - package "gcc10" do + package compiler_version do retries 10 retry_delay 5 end - cookbook_file 'dkms/nvidia.conf' do - source 'dkms/nvidia.conf' + package extra_packages do + only_if { extra_packages.any? } + retries 10 + retry_delay 5 + end + + template '/etc/dkms/nvidia.conf' do + source 'nvidia/amazon/dkms/nvidia.conf.erb' cookbook 'aws-parallelcluster-platform' - path '/etc/dkms/nvidia.conf' owner 'root' group 'root' mode '0644' + variables( + compiler_path: compiler_path + ) end end @@ -72,7 +80,7 @@ cwd '/tmp' code <<-NVIDIA set -e - #{compiler_version} ./nvidia.run --silent --dkms --disable-nouveau --no-cc-version-check -m=#{nvidia_kernel_module} + #{compiler_path} ./nvidia.run --silent --dkms --disable-nouveau --no-cc-version-check -m=#{nvidia_kernel_module} rm -f /tmp/nvidia.run NVIDIA creates '/usr/bin/nvidia-smi' @@ -108,7 +116,7 @@ def set_compiler? false end -def compiler_version +def compiler_path "" end diff --git a/cookbooks/aws-parallelcluster-platform/resources/nvidia_repo/nvidia_repo_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/nvidia_repo/nvidia_repo_alinux2023.rb new file mode 100644 index 000000000..8553b3a85 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/nvidia_repo/nvidia_repo_alinux2023.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :nvidia_repo, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_nvidia_repo_common.rb' + +def platform + 'rhel9' +end + +def repository_key + 'D42D0685.pub' +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/stunnel/stunnel_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/stunnel/stunnel_alinux2023.rb new file mode 100644 index 000000000..d82f410b7 --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/stunnel/stunnel_alinux2023.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true +# +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :stunnel, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_common' +use 'partial/_setup' + +action_class do + def dependencies + # tcp_wrappers-devel has been deprecated in RHEL7 and deleted in RHEL8, however it is + # an optional requirement not strictly necessary for either stunnel or efs-utils + %w(openssl-devel) + end +end diff --git a/cookbooks/aws-parallelcluster-platform/resources/sudo_access/sudo_access_alinux2023.rb b/cookbooks/aws-parallelcluster-platform/resources/sudo_access/sudo_access_alinux2023.rb new file mode 100644 index 000000000..af6649f0a --- /dev/null +++ b/cookbooks/aws-parallelcluster-platform/resources/sudo_access/sudo_access_alinux2023.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :sudo_access, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_sudo_access_common.rb' diff --git a/cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cuda_spec.rb b/cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cuda_spec.rb index 9796698d4..add4ced88 100644 --- a/cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cuda_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/spec/unit/recipes/cuda_spec.rb @@ -55,7 +55,9 @@ group: 'root', cwd: '/tmp', creates: "/usr/local/cuda-#{cuda_version}") - .with_code(%r{./cuda.run --silent --toolkit --samples}) + .with_code(%r{mkdir /cuda-install}) + .with_code(%r{./cuda.run --silent --toolkit --samples --tmpdir=/cuda-install}) + .with_code(%r{rm -rf /cuda-install}) .with_code(%r{rm -f /tmp/cuda.run}) end diff --git a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb index 431518576..b852ef496 100644 --- a/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/spec/unit/resources/nvidia_driver_spec.rb @@ -219,17 +219,19 @@ def self.setup(chef_run, nvidia_driver_version: nil) end if platform == 'amazon' + compiler_path = version == 2023 ? 'CC=/usr/bin/gcc' : 'CC=/usr/bin/gcc10-gcc' it 'installs gcc10' do is_expected.to install_package('gcc10').with_retries(10).with_retry_delay(5) end it 'creates dkms/nvidia.conf' do - is_expected.to create_cookbook_file('dkms/nvidia.conf').with( - source: 'dkms/nvidia.conf', - path: '/etc/dkms/nvidia.conf', + is_expected.to create_template('/etc/dkms/nvidia.conf').with( + source: 'nvidia/amazon/dkms/nvidia.conf.erb', + cookbook: 'aws-parallelcluster-platform', owner: 'root', group: 'root', - mode: '0644' + mode: '0644', + variables: { compiler_path: compiler_path } ) end it 'installs nvidia driver' do diff --git a/cookbooks/aws-parallelcluster-platform/files/amazon/dkms/nvidia.conf b/cookbooks/aws-parallelcluster-platform/templates/nvidia/amazon/dkms/nvidia.conf.erb similarity index 60% rename from cookbooks/aws-parallelcluster-platform/files/amazon/dkms/nvidia.conf rename to cookbooks/aws-parallelcluster-platform/templates/nvidia/amazon/dkms/nvidia.conf.erb index b6c5db0eb..37c3af16d 100644 --- a/cookbooks/aws-parallelcluster-platform/files/amazon/dkms/nvidia.conf +++ b/cookbooks/aws-parallelcluster-platform/templates/nvidia/amazon/dkms/nvidia.conf.erb @@ -1 +1 @@ -MAKE[0]="'make' -j2 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=${kernelver} modules CC=/usr/bin/gcc10-gcc" \ No newline at end of file +MAKE[0]="'make' -j2 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=${kernelver} modules <%= @compiler_path %>" diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb index 7ec512075..6d53be66f 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/dcv_spec.rb @@ -23,7 +23,7 @@ control 'tag:install_dcv_authenticator_user_and_group_set_up' do title 'Check that dcv authenticator user and group have been set up' - only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) } + only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? } describe group(node['cluster']['dcv']['authenticator']['group']) do it { should exist } @@ -39,7 +39,7 @@ control 'tag:install_dcv_disabled_lock_screen' do title 'Check that the lock screen has been disabled' - only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) } + only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? } describe bash('gsettings get org.gnome.desktop.lockdown disable-lock-screen') do its('exit_status') { should eq 0 } @@ -54,7 +54,7 @@ control 'tag:install_dcv_installed' do title 'Check dcv is installed' - only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) } + only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? } pkgs = %W(nice-dcv-server nice-xdcv nice-dcv-web-viewer) pkgs.each do |pkg| @@ -66,7 +66,7 @@ control 'tag:install_dcv_external_authenticator_virtualenv_created' do title 'Check dcv external authenticator virtual environment is created' - only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) } + only_if { !os_properties.redhat_on_docker? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? } describe file("#{node['cluster']['dcv']['authenticator']['virtualenv_path']}/bin/activate") do it { should be_file } @@ -76,7 +76,7 @@ control 'tag:install_dcv_debian_specific_setup' do title 'Check debian specific setup' - only_if { os_properties.debian_family? && !(os_properties.ubuntu? && os_properties.arm?) } + only_if { os_properties.debian_family? && !(os_properties.ubuntu? && os_properties.arm?) && !os_properties.alinux2023? } pkgs = %W(whoopsie ubuntu-desktop mesa-utils) pkgs.each do |pkg| @@ -98,6 +98,7 @@ control 'tag:install_dcv_rhel_and_centos_specific_setup' do title 'Check rhel and centos specific setup' only_if { !os_properties.on_docker? } + only_if { !os_properties.alinux2023? } only_if { os_properties.centos? || os_properties.redhat? } describe command('gnome-shell --version') do @@ -160,6 +161,7 @@ control 'tag:install_dcv_switch_runlevel_to_multiuser_target' do title 'Check that runlevel is switched to multi-user.target' only_if { !os_properties.on_docker? } + only_if { !os_properties.alinux2023? } describe bash('systemctl get-default') do its('exit_status') { should eq 0 } diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/disable_selinux_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/disable_selinux_spec.rb index 8e46b0f4e..6ac7ad1f3 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/disable_selinux_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/disable_selinux_spec.rb @@ -14,7 +14,7 @@ describe selinux do it { should be_disabled } it { should_not be_enforcing } - end unless os_properties.redhat? || os_properties.rocky? || os_properties.centos? # Because it requires reboot of the instance + end unless os_properties.alinux2023? || os_properties.redhat? || os_properties.rocky? || os_properties.centos? # Because it requires reboot of the instance end control 'tag:testami_selinux_disabled' do diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/install_packages_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/install_packages_spec.rb index 6da5058b6..647580b98 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/install_packages_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/install_packages_spec.rb @@ -7,7 +7,7 @@ # verify package with a common name is installed describe package('moreutils') do it { should be_installed } - end + end unless os_properties.alinux2023? # verify dns-domain package describe package('hostname') do @@ -17,7 +17,8 @@ # Verify jq version is updated enough to accept 2 argfile parameters describe bash("jq --argfile") do its('stderr') { should match /jq: --argfile takes two parameters/ } - end unless instance.custom_ami? + end unless instance.custom_ami? || os_properties.alinux2023? + # Need to change the jq --argfile commands as its deprecated in 1.7( latest) unless os_properties.centos7? # Verify fftw package is not installed diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/intel_mpi_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/intel_mpi_spec.rb index 68de89588..79bd213f0 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/intel_mpi_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/intel_mpi_spec.rb @@ -17,7 +17,7 @@ only_if { node['conditions']['intel_mpi_supported'] && instance.head_node? } modules_home = os_properties.ubuntu? ? "/usr/share/modules" : "/usr/share/Modules" - modulepath_config_file = os_properties.redhat? ? '/etc/environment-modules/modulespath' : "#{modules_home}/init/.modulespath" + modulepath_config_file = (os_properties.redhat? || os_properties.alinux2023?) ? '/etc/environment-modules/modulespath' : "#{modules_home}/init/.modulespath" describe file(modulepath_config_file) do it { should exist } diff --git a/cookbooks/aws-parallelcluster-platform/test/controls/openssh_spec.rb b/cookbooks/aws-parallelcluster-platform/test/controls/openssh_spec.rb index c0038e2b8..fc884a36a 100644 --- a/cookbooks/aws-parallelcluster-platform/test/controls/openssh_spec.rb +++ b/cookbooks/aws-parallelcluster-platform/test/controls/openssh_spec.rb @@ -11,6 +11,7 @@ control 'tag:install_openssh_installed' do title 'Check that openssh packages are installed and ssh/sshd config file exist' + only_if { !os_properties.alinux2023_on_docker? } files = %w(/etc/ssh/ssh_config) files.each do |file| diff --git a/cookbooks/aws-parallelcluster-shared/attributes/users_alinux2023.rb b/cookbooks/aws-parallelcluster-shared/attributes/users_alinux2023.rb new file mode 100644 index 000000000..1628980a7 --- /dev/null +++ b/cookbooks/aws-parallelcluster-shared/attributes/users_alinux2023.rb @@ -0,0 +1,5 @@ +return unless platform?('amazon') && node['platform_version'].to_i == 2023 + +default['cluster']['cluster_user'] = 'ec2-user' +default['cluster']['cluster_user_home'] = "/home/#{node['cluster']['cluster_user']}" +default['cluster']['cluster_user_local_home'] = "/local#{node['cluster']['cluster_user_home']}" diff --git a/cookbooks/aws-parallelcluster-shared/libraries/test.rb b/cookbooks/aws-parallelcluster-shared/libraries/test.rb index e5a4aba85..2a3c422f6 100644 --- a/cookbooks/aws-parallelcluster-shared/libraries/test.rb +++ b/cookbooks/aws-parallelcluster-shared/libraries/test.rb @@ -10,3 +10,7 @@ def redhat_on_docker? def rocky_on_docker? on_docker? && platform?('rocky') end + +def alinux2023_on_docker? + on_docker? && platform?('amazon') && node['platform_version'].to_i == 2023 +end diff --git a/cookbooks/aws-parallelcluster-shared/metadata.rb b/cookbooks/aws-parallelcluster-shared/metadata.rb index 72ede66db..29a9daa30 100644 --- a/cookbooks/aws-parallelcluster-shared/metadata.rb +++ b/cookbooks/aws-parallelcluster-shared/metadata.rb @@ -9,11 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.7' - depends 'pyenv', '~> 4.2.3' depends 'yum', '~> 7.4.13' depends 'yum-epel', '~> 5.0.2' diff --git a/cookbooks/aws-parallelcluster-shared/resources/os_type/os_type_alinux2023.rb b/cookbooks/aws-parallelcluster-shared/resources/os_type/os_type_alinux2023.rb new file mode 100644 index 000000000..51d1f281d --- /dev/null +++ b/cookbooks/aws-parallelcluster-shared/resources/os_type/os_type_alinux2023.rb @@ -0,0 +1,23 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :os_type, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_os_type_common.rb' + +def current_os + "alinux#{node['platform_version'].to_i}" +end diff --git a/cookbooks/aws-parallelcluster-shared/resources/package_repos/package_repos_alinux2023.rb b/cookbooks/aws-parallelcluster-shared/resources/package_repos/package_repos_alinux2023.rb new file mode 100644 index 000000000..f868c0446 --- /dev/null +++ b/cookbooks/aws-parallelcluster-shared/resources/package_repos/package_repos_alinux2023.rb @@ -0,0 +1,45 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :package_repos, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end +unified_mode true + +use 'partial/_package_repos_rpm.rb' + +default_action :setup + +action :setup do + include_recipe 'yum' + # include_recipe "yum-epel" + + # package 'yum-utils' do + # retries 3 + # retry_delay 5 + # end + + # execute 'yum-config-manager-rhel' do + # # Needed by hwloc-devel blas-devel libedit-devel and glibc-static packages + # command "yum-config-manager --enable codeready-builder-for-rhel-8-rhui-rpms" + # end unless on_docker? + # + # execute 'yum-config-manager_skip_if_unavail' do + # command "yum-config-manager --setopt=\*.skip_if_unavailable=1 --save" + # end +end + +action :update do + # Do nothing +end diff --git a/cookbooks/aws-parallelcluster-shared/test/controls/package_repos_spec.rb b/cookbooks/aws-parallelcluster-shared/test/controls/package_repos_spec.rb index 4bc694003..39eb3da62 100644 --- a/cookbooks/aws-parallelcluster-shared/test/controls/package_repos_spec.rb +++ b/cookbooks/aws-parallelcluster-shared/test/controls/package_repos_spec.rb @@ -3,6 +3,7 @@ # describe the resource title 'Configure package manager repository' + only_if { !os_properties.alinux2023? } # in this case, different OSes produce different outcomes, to be tested differently if os.redhat? # redhat includes amazon diff --git a/cookbooks/aws-parallelcluster-shared/test/libraries/os_properties.rb b/cookbooks/aws-parallelcluster-shared/test/libraries/os_properties.rb index 22c951c5e..13d57ace1 100644 --- a/cookbooks/aws-parallelcluster-shared/test/libraries/os_properties.rb +++ b/cookbooks/aws-parallelcluster-shared/test/libraries/os_properties.rb @@ -48,8 +48,20 @@ def centos7? centos? && inspec.os.release.to_i == 7 end + def alinux? + inspec.os.name == 'amazon' + end + def alinux2? - inspec.os.name == 'amazon' && inspec.os.release.to_i == 2 + alinux? && inspec.os.release.to_i == 2 + end + + def alinux2023? + alinux? && inspec.os.release.to_i == 2023 + end + + def alinux2023_on_docker? + on_docker? && alinux2023? end def ubuntu2004? diff --git a/cookbooks/aws-parallelcluster-slurm/metadata.rb b/cookbooks/aws-parallelcluster-slurm/metadata.rb index df233033f..94a303312 100644 --- a/cookbooks/aws-parallelcluster-slurm/metadata.rb +++ b/cookbooks/aws-parallelcluster-slurm/metadata.rb @@ -9,10 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '>= 2.0' -supports 'centos', '>= 7.0' -supports 'ubuntu', '>= 20.04' - depends 'apt', '~> 7.5.22' depends 'iptables', '~> 8.0.0' depends 'line', '~> 4.5.13' diff --git a/cookbooks/aws-parallelcluster-slurm/resources/dns_domain/dns_domain_alinux2023.rb b/cookbooks/aws-parallelcluster-slurm/resources/dns_domain/dns_domain_alinux2023.rb new file mode 100644 index 000000000..a680ae1c8 --- /dev/null +++ b/cookbooks/aws-parallelcluster-slurm/resources/dns_domain/dns_domain_alinux2023.rb @@ -0,0 +1,29 @@ +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :dns_domain, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_dns_domain_common' + +def search_domain_config_path + # Configure resolved to automatically append Route53 search domain in resolv.conf. + # On Amazon Linux 2023 resolv.conf is managed by systemd-resolved. + '/etc/systemd/resolved.conf' +end + +def append_pattern + 'Domains=*' +end + +def append_line + "Domains=#{node['cluster']['dns_domain']}" +end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/jwt_dependencies/jwt_dependencies_alinux2023.rb b/cookbooks/aws-parallelcluster-slurm/resources/jwt_dependencies/jwt_dependencies_alinux2023.rb new file mode 100644 index 000000000..f5076e954 --- /dev/null +++ b/cookbooks/aws-parallelcluster-slurm/resources/jwt_dependencies/jwt_dependencies_alinux2023.rb @@ -0,0 +1,15 @@ +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :jwt_dependencies, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_jwt_dependencies_common' diff --git a/cookbooks/aws-parallelcluster-slurm/resources/munge/munge_alinux2023.rb b/cookbooks/aws-parallelcluster-slurm/resources/munge/munge_alinux2023.rb new file mode 100644 index 000000000..fd2bb908c --- /dev/null +++ b/cookbooks/aws-parallelcluster-slurm/resources/munge/munge_alinux2023.rb @@ -0,0 +1,16 @@ +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :munge, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_munge_actions' +use 'partial/_munge_rhel' diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/mysql_client_alinux2023.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/mysql_client_alinux2023.rb new file mode 100644 index 000000000..e5c4f6556 --- /dev/null +++ b/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/mysql_client_alinux2023.rb @@ -0,0 +1,20 @@ +# frozen_string_literal: true + +# Copyright:: 2024 Amazon.com, Inc. or its affiliates. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :mysql_client, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_common' +use 'partial/_setup_rhel_based' diff --git a/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/partial/_setup_rhel_based.rb b/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/partial/_setup_rhel_based.rb index 472f5bfc2..38310a9a5 100644 --- a/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/partial/_setup_rhel_based.rb +++ b/cookbooks/aws-parallelcluster-slurm/resources/mysql_client/partial/_setup_rhel_based.rb @@ -49,6 +49,8 @@ def package_platform platform_version = node['platform_version'].to_i if platform_version == 2 platform_version = 7 + elsif platform_version == 2023 + platform_version = 9 end arm_instance? ? "el/#{platform_version}/aarch64" : "el/#{platform_version}/x86_64" end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/partial/_slurm_dependencies_common.rb b/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/partial/_slurm_dependencies_common.rb index 9651e141c..7aa74dc33 100644 --- a/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/partial/_slurm_dependencies_common.rb +++ b/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/partial/_slurm_dependencies_common.rb @@ -18,4 +18,10 @@ packages dependencies action :install end unless redhat_on_docker? + + action_install_extra_dependencies +end + +action :install_extra_dependencies do + # Do Nothing end diff --git a/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/slurm_dependencies_alinux2023.rb b/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/slurm_dependencies_alinux2023.rb new file mode 100644 index 000000000..1d5a679bb --- /dev/null +++ b/cookbooks/aws-parallelcluster-slurm/resources/slurm_dependencies/slurm_dependencies_alinux2023.rb @@ -0,0 +1,34 @@ +# Licensed under the Apache License, Version 2.0 (the "License"). +# You may not use this file except in compliance with the License. +# A copy of the License is located at +# +# http://aws.amazon.com/apache2.0/ +# +# or in the "LICENSE.txt" file accompanying this file. +# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied. +# See the License for the specific language governing permissions and limitations under the License. + +provides :slurm_dependencies, platform: 'amazon' do |node| + node['platform_version'].to_i == 2023 +end + +use 'partial/_slurm_dependencies_common' + +def dependencies + %w(json-c-devel perl perl-Switch lua-devel dbus-devel) +end + +action :install_extra_dependencies do + # http parser is no longer maintained, therefore Amazon Linux 2023 does have have the package in OS repos + # https://docs.aws.amazon.com/linux/al2023/release-notes/removed-AL2023.4-AL2.html + # Following https://slurm.schedmd.com/related_software.html#jwt for Installing Http-parser + bash 'Install http-parser' do + code <<-HTTP_PARSER + set -e + git clone --depth 1 --single-branch -b v2.9.4 https://github.com/nodejs/http-parser.git http_parser + cd http_parser + make + make install + HTTP_PARSER + end +end diff --git a/cookbooks/aws-parallelcluster-slurm/test/controls/slurm_dependencies_spec.rb b/cookbooks/aws-parallelcluster-slurm/test/controls/slurm_dependencies_spec.rb index e531ebcfe..23750b107 100644 --- a/cookbooks/aws-parallelcluster-slurm/test/controls/slurm_dependencies_spec.rb +++ b/cookbooks/aws-parallelcluster-slurm/test/controls/slurm_dependencies_spec.rb @@ -27,6 +27,8 @@ def lua_devel_package if os_properties.alinux2? || os_properties.centos7? # Skipping redhat on docker since ubi-appstream repo is not aligned with the main repo packages.concat %w(json-c-devel http-parser-devel perl-Switch) unless os_properties.redhat_on_docker? + elsif os_properties.alinux2023? + packages.concat %w(json-c-devel perl-Switch perl dbus-devel) unless os_properties.redhat_on_docker? else packages.concat %w(json-c-devel http-parser-devel perl dbus-devel) unless os_properties.redhat_on_docker? end diff --git a/cookbooks/aws-parallelcluster-tests/metadata.rb b/cookbooks/aws-parallelcluster-tests/metadata.rb index 24204ddcf..068bf8e41 100644 --- a/cookbooks/aws-parallelcluster-tests/metadata.rb +++ b/cookbooks/aws-parallelcluster-tests/metadata.rb @@ -9,11 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '= 2.0' -supports 'centos', '= 7.0' -supports 'ubuntu', '>= 20.04' -supports 'redhat', '= 8.0' - depends 'aws-parallelcluster-shared', '~> 3.10.0' depends 'aws-parallelcluster-platform', '~> 3.10.0' depends 'aws-parallelcluster-environment', '~> 3.10.0' diff --git a/cookbooks/aws-parallelcluster-tests/recipes/docker_mock.rb b/cookbooks/aws-parallelcluster-tests/recipes/docker_mock.rb index ae7f8bc39..bb2a5e65a 100644 --- a/cookbooks/aws-parallelcluster-tests/recipes/docker_mock.rb +++ b/cookbooks/aws-parallelcluster-tests/recipes/docker_mock.rb @@ -46,6 +46,7 @@ directory '/etc/cron.weekly' directory '/etc/chef' +directory '/etc/parallelcluster' if platform_family?('debian') %w(nfs-common nfs-kernel-server).each do |nfspkg| diff --git a/kitchen.docker.yml b/kitchen.docker.yml index 078946dda..f1808e2c4 100644 --- a/kitchen.docker.yml +++ b/kitchen.docker.yml @@ -38,6 +38,12 @@ platforms: attributes: cluster: base_os: alinux2 + - name: alinux-2023 + driver: + image: <% if ENV['KITCHEN_ALINUX2023_IMAGE'] %> <%= ENV['KITCHEN_ALINUX2023_IMAGE'] %> <% else %> dokken/amazonlinux-2023 <% end %> + attributes: + cluster: + base_os: alinux2023 - name: centos7 driver: image: <% if ENV['KITCHEN_CENTOS7_IMAGE'] %> <%= ENV['KITCHEN_CENTOS7_IMAGE'] %> <% else %> dokken/centos-7 <% end %> diff --git a/kitchen.ec2.yml b/kitchen.ec2.yml index f41e1bfec..f59d709e0 100644 --- a/kitchen.ec2.yml +++ b/kitchen.ec2.yml @@ -48,6 +48,11 @@ lifecycle: TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id ') + + echo "Install libxcrypt-compat dmidecode package by using SSH key: ${KITCHEN_SSH_KEY_PATH}" + + ssh -o StrictHostKeyChecking=no -i "${KITCHEN_SSH_KEY_PATH}" \ + "${KITCHEN_EC2_USER}@${KITCHEN_INSTANCE_HOSTNAME}" 'sudo yum install -y libxcrypt-compat dmidecode' echo "EC2 instance id: ${KITCHEN_EC2_INSTANCE_ID}" @@ -102,6 +107,32 @@ platforms: attributes: cluster: base_os: alinux2 + - name: alinux-2023 # We are adding a "-" in the name to avoid having alinux2 as prefix of alinux2023 and be able to distinguish them on Inspec + driver_plugin: ec2 + driver: + <% if ENV['KITCHEN_ALINUX2023_AMI'] %> + # Use the Alinux 2023 AMI most similar to the base AMI used to build the ParallelCluster image + image_id: <%= ENV['KITCHEN_ALINUX2023_AMI'] %> + <% else %> + image_search: + name: <% if ENV['KITCHEN_PHASE']=='install' %>al2023-ami-2023*<% else %><%= pcluster_prefix %>-alinux2023-hvm-*<% end %> + architecture: <%= ENV['KITCHEN_ARCHITECTURE'] %> + <% end %> + block_device_mappings: + - device_name: /dev/xvda + ebs: + volume_size: <% if (ENV['KITCHEN_VOLUME_SIZE'] || '') == '' %> 40 <% else %> <%= ENV['KITCHEN_VOLUME_SIZE'] %> <% end %> + volume_type: gp3 + delete_on_termination: true + <% %w(a b c d e f g h i j k l m n o p q r s t u v w x).each_with_index do | c, i | %> + - device_name: /dev/xvdb<%= c %> + virtual_name: ephemeral<%= i %> + <% end %> + transport: + username: ec2-user + attributes: + cluster: + base_os: alinux2023 - name: rhel8 driver_plugin: ec2 driver: diff --git a/kitchen/kitchen.run-hook.sh b/kitchen/kitchen.run-hook.sh index bdc68055e..09fbcb164 100644 --- a/kitchen/kitchen.run-hook.sh +++ b/kitchen/kitchen.run-hook.sh @@ -37,6 +37,10 @@ if [ -e "${SCRIPT}" ]; then TOKEN=$(curl -X PUT "http://169.254.169.254/latest/api/token" -H "X-aws-ec2-metadata-token-ttl-seconds: 21600") \ && curl -H "X-aws-ec2-metadata-token: $TOKEN" -v http://169.254.169.254/latest/meta-data/instance-id ') + echo "Install libxcrypt-compat dmidecode package by using SSH key: ${KITCHEN_SSH_KEY_PATH}" + + ssh -o StrictHostKeyChecking=no -i "${KITCHEN_SSH_KEY_PATH}" \ + "${KITCHEN_EC2_USER}@${KITCHEN_INSTANCE_HOSTNAME}" 'sudo yum install -y libxcrypt-compat dmidecode' [ -n "${KITCHEN_EC2_INSTANCE_ID}" ] && echo "EC2 instance id: ${KITCHEN_EC2_INSTANCE_ID}" || echo "Unable to retrieve instance id." export KITCHEN_EC2_INSTANCE_ID diff --git a/metadata.rb b/metadata.rb index 2faf7ac91..6ab700df9 100644 --- a/metadata.rb +++ b/metadata.rb @@ -9,10 +9,6 @@ chef_version '>= 18' version '3.10.0' -supports 'amazon', '>= 2.0' -supports 'centos', '>= 7.0' -supports 'ubuntu', '>= 20.04' - depends 'apt', '~> 7.5.22' depends 'iptables', '~> 8.0.0' depends 'line', '~> 4.5.13'