Skip to content

Commit

Permalink
Merge branch 'main' into mye956/fix-al1
Browse files Browse the repository at this point in the history
  • Loading branch information
chienhanlin authored Jan 26, 2024
2 parents 2c534ba + 8566a5a commit 496cc32
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 19 deletions.
1 change: 1 addition & 0 deletions al2.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ build {
environment_vars = [
"DOCKER_VERSION=${var.docker_version}",
"CONTAINERD_VERSION=${var.containerd_version}",
"RUNC_VERSION=${var.runc_version}",
"AIR_GAPPED=${var.air_gapped}"
]
}
Expand Down
1 change: 1 addition & 0 deletions al2023.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ build {
environment_vars = [
"DOCKER_VERSION=${var.docker_version_al2023}",
"CONTAINERD_VERSION=${var.containerd_version_al2023}",
"RUNC_VERSION=${var.runc_version_al2023}",
"AIR_GAPPED=${var.air_gapped}"
]
}
Expand Down
23 changes: 22 additions & 1 deletion generate-release-notes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ usage() {
al2_gpu_nvidia_version=$1
al2_gpu_cuda_version=$2
al1_containerd_version=$3 # Optional, will include AL1 in the release notes if provided
al1_runc_version=$4 # Optional, will include AL1 in the release notes if provided

if [ "$al2_gpu_nvidia_version" == "" ]; then
echo "Error: AL2 GPU NVIDIA version is empty"
Expand All @@ -31,8 +32,10 @@ fi
readonly pkrvars="release.auto.pkrvars.hcl"
readonly ami_version=$(cat $pkrvars | grep -w 'ami_version' | cut -d '"' -f2)
readonly containerd_version_al2023=$(cat $pkrvars | grep -w 'containerd_version_al2023' | cut -d '"' -f2)
readonly runc_version_al2023=$(cat $pkrvars | grep -w 'runc_version_al2023' | cut -d '"' -f2)
readonly distribution_release_al2023=$(cat $pkrvars | grep -w 'distribution_release_al2023' | cut -d '"' -f2)
readonly containerd_version=$(cat $pkrvars | grep -w 'containerd_version' | cut -d '"' -f2)
readonly runc_version=$(cat $pkrvars | grep -w 'runc_version' | cut -d '"' -f2)

if [ -z "$ami_version" ]; then
echo "Error: AMI version was not found in $pkrvars"
Expand All @@ -42,6 +45,10 @@ if [ -z "$containerd_version_al2023" ]; then
echo "Error: Containerd version was not found for AL2023 in $pkrvars"
exit 1
fi
if [ -z "$runc_version_al2023" ]; then
echo "Error: Runc version was not found for AL2023 in $pkrvars"
exit 1
fi
if [ -z "$distribution_release_al2023" ]; then
echo "Error: Distribution release version was not found for AL2023 in $pkrvars"
exit 1
Expand All @@ -50,6 +57,10 @@ if [ -z "$containerd_version" ]; then
echo "Error: Containerd version was not found in $pkrvars"
exit 1
fi
if [ -z "$runc_version" ]; then
echo "Error: Runc version was not found in $pkrvars"
exit 1
fi

# Gets ECS Optimized AMI details from SSM parameter store given the paramter name.
# Uses the default AWS credentials as the parameter is public and can be
Expand Down Expand Up @@ -98,6 +109,7 @@ https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
- ECS Agent version: [$agent_version_al2023_x86](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2023_x86)
- Docker version: $docker_version_al2023_x86
- Containerd version: $containerd_version_al2023
- Runc version: $runc_version_al2023
- Source AMI name: $source_ami_name_al2023_x86
- Distribution al2023 release: $distribution_release_al2023
Expand All @@ -106,6 +118,7 @@ https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
- ECS Agent version: [$agent_version_al2023_arm](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2023_arm)
- Docker version: $docker_version_al2023_arm
- Containerd version: $containerd_version_al2023
- Runc version: $runc_version_al2023
- Source AMI name: $source_ami_name_al2023_arm
- Distribution al2023 release: $distribution_release_al2023
Expand All @@ -114,6 +127,7 @@ https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
- ECS Agent version: [$agent_version_al2023_neuron](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2023_neuron)
- Docker version: $docker_version_al2023_neuron
- Containerd version: $containerd_version_al2023
- Runc version: $runc_version_al2023
- Source AMI name: $source_ami_name_al2023_neuron
- Distribution al2023 release: $distribution_release_al2023
Expand All @@ -124,27 +138,31 @@ https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
- ECS Agent version: [$agent_version_al2_x86](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_x86)
- Docker version: $docker_version_al2_x86
- Containerd version: $containerd_version
- Runc version: $runc_version
- Source AMI name: $source_ami_name_al2_x86
#### ARM64 (Kernel 4.14)
- AMI name: $ami_name_al2_arm
- ECS Agent version: [$agent_version_al2_arm](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_arm)
- Docker version: $docker_version_al2_arm
- Containerd version: $containerd_version
- Runc version: $runc_version
- Source AMI name: $source_ami_name_al2_arm
#### Neuron (Kernel 4.14)
- AMI name: $ami_name_al2_inf
- ECS Agent version: [$agent_version_al2_inf](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_inf)
- Docker version: $docker_version_al2_inf
- Containerd version: $containerd_version
- Runc version: $runc_version
- Source AMI name: $source_ami_name_al2_inf
#### GPU (Kernel 4.14)
- AMI name: $ami_name_al2_gpu
- ECS Agent version: [$agent_version_al2_gpu](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_gpu)
- Docker version: $docker_version_al2_gpu
- Containerd version: $containerd_version
- Runc version: $runc_version
- NVIDIA driver version: $al2_gpu_nvidia_version
- CUDA version: $al2_gpu_cuda_version
- Source AMI name: $source_ami_name_al2_gpu
Expand All @@ -154,17 +172,19 @@ https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
- ECS Agent version: [$agent_version_al2_kernel_5_10](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_kernel_5_10)
- Docker version: $docker_version_al2_kernel_5_10
- Containerd version: $containerd_version
- Runc version: $runc_version
- Source AMI name: $source_ami_name_al2_kernel_5_10
#### ARM64 (Kernel 5.10)
- AMI name: $ami_name_al2_kernel_5_10_arm
- ECS Agent version: [$agent_version_al2_kernel_5_10_arm](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al2_kernel_5_10_arm)
- Docker version: $docker_version_al2_kernel_5_10_arm
- Containerd version: $containerd_version
- Runc version: $runc_version
- Source AMI name: $source_ami_name_al2_kernel_5_10_arm"

# Include AL1 release notes if there was an AL1 release
if [ -n "$al1_containerd_version" ]; then
if [ -n "$al1_containerd_version" ] || [ -n "$al1_runc_version" ]; then
al1_release_notes="
### Amazon ECS-optimized Amazon Linux AMI
Expand All @@ -175,6 +195,7 @@ The Amazon ECS-optimized Amazon Linux AMI is deprecated as of April 15, 2021. Af
- ECS Agent version: [$agent_version_al1](https://github.com/aws/amazon-ecs-agent/releases/tag/v$agent_version_al1)
- Docker version: $docker_version_al1
- Containerd version: $al1_containerd_version
- Runc version: $al1_runc_version
- Source AMI name: $source_ami_name_al1"

release_notes="${release_notes}${al1_release_notes}"
Expand Down
32 changes: 17 additions & 15 deletions generate-release-vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,21 +72,23 @@ distribution_release_al2023=$(curl -s https://al2023-repos-us-west-2-de612dc2.s3
readonly ami_name_al2_kernel5dot10arm ami_name_al2_kernel5dot10 ami_name_al2_arm ami_name_al2_x86 ami_name_al1 ami_name_al2023_arm ami_name_al2023_x86 distribution_release_al2023

cat >|release.auto.pkrvars.hcl <<EOF
ami_version = "$ami_version"
ecs_agent_version = "$agent_version"
ecs_init_rev = "$ecs_init_rev"
docker_version = "20.10.25"
docker_version_al2023 = "20.10.25"
containerd_version = "1.6.19"
containerd_version_al2023 = "1.6.19"
source_ami_al1 = "$ami_name_al1"
source_ami_al2 = "$ami_name_al2_x86"
source_ami_al2arm = "$ami_name_al2_arm"
ami_version = "$ami_version"
ecs_agent_version = "$agent_version"
ecs_init_rev = "$ecs_init_rev"
docker_version = "20.10.25"
docker_version_al2023 = "20.10.25"
containerd_version = "1.6.19"
containerd_version_al2023 = "1.6.19"
runc_version = "1.1.7"
runc_version_al2023 = "1.1.7"
source_ami_al1 = "$ami_name_al1"
source_ami_al2 = "$ami_name_al2_x86"
source_ami_al2arm = "$ami_name_al2_arm"
source_ami_al2kernel5dot10 = "$ami_name_al2_kernel5dot10"
source_ami_al2kernel5dot10arm = "$ami_name_al2_kernel5dot10arm"
source_ami_al2023 = "$ami_name_al2023_x86"
source_ami_al2023arm = "$ami_name_al2023_arm"
kernel_version_al2023 = "$kernel_version_al2023_x86"
kernel_version_al2023arm = "$kernel_version_al2023_arm"
distribution_release_al2023 = "$distribution_release_al2023"
source_ami_al2023 = "$ami_name_al2023_x86"
source_ami_al2023arm = "$ami_name_al2023_arm"
kernel_version_al2023 = "$kernel_version_al2023_x86"
kernel_version_al2023arm = "$kernel_version_al2023_arm"
distribution_release_al2023 = "$distribution_release_al2023"
EOF
2 changes: 2 additions & 0 deletions release.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ docker_version = "20.10.25"
docker_version_al2023 = "20.10.25"
containerd_version = "1.6.19"
containerd_version_al2023 = "1.6.19"
runc_version = "1.1.7"
runc_version_al2023 = "1.1.7"
source_ami_al1 = "amzn-ami-minimal-hvm-2018.03.0.20231218.0-x86_64-ebs"
source_ami_al2 = "amzn2-ami-minimal-hvm-2.0.20240109.0-x86_64-ebs"
source_ami_al2arm = "amzn2-ami-minimal-hvm-2.0.20240109.0-arm64-ebs"
Expand Down
9 changes: 7 additions & 2 deletions scripts/enable-ecs-agent-gpu-support.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ sudo mv $tmpfile /etc/yum.repos.d/amzn2-nvidia-tmp.repo

# only install open driver for post-kepler gpus, exclude airgapped regions
if [[ $AMI_TYPE != "al2keplergpu" && -z ${AIR_GAPPED} ]]; then
sudo yum install -y yum-plugin-versionlock \
yum-utils
sudo yum install -y yum-plugin-versionlock yum-utils
sudo amazon-linux-extras install epel -y
sudo yum install -y "kernel-devel-uname-r == $(uname -r)"

Expand Down Expand Up @@ -60,6 +59,12 @@ if [[ $AMI_TYPE != "al2keplergpu" && -z ${AIR_GAPPED} ]]; then
sudo yum remove -y kmod-nvidia-open-dkms
sudo yum-config-manager --disable cuda-rhel7.repo
sudo rm /etc/yum.repos.d/cuda-rhel7.repo
# epel was used to install dkms, now delete as it points to public http endpoints which
# can cause problems for customers using isolated subnets.
sudo yum-config-manager --disable epel
sudo rm /etc/yum.repos.d/epel.repo
sudo rm /etc/yum.repos.d/epel-testing.repo
sudo amazon-linux-extras disable epel
sudo rm -rf /var/cache/yum
sudo yum-config-manager --enable amzn2-nvidia

Expand Down
2 changes: 1 addition & 1 deletion scripts/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ if command -v amazon-linux-extras; then
sudo amazon-linux-extras enable docker
fi

sudo yum install -y "docker-$DOCKER_VERSION" "containerd-$CONTAINERD_VERSION"
sudo yum install -y "docker-$DOCKER_VERSION" "containerd-$CONTAINERD_VERSION" "runc-$RUNC_VERSION"
10 changes: 10 additions & 0 deletions variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ variable "containerd_version" {
description = "Containerd version to build AMI with."
}

variable "runc_version" {
type = string
description = "Runc version to build AMI with."
}

variable "docker_version_al2023" {
type = string
description = "Docker version to build AL2023 AMI with."
Expand All @@ -71,6 +76,11 @@ variable "containerd_version_al2023" {
description = "Containerd version to build AL2023 AMI with."
}

variable "runc_version_al2023" {
type = string
description = "Runc version to build AL2023 AMI with."
}

variable "exec_ssm_version" {
type = string
default = "3.2.1630.0"
Expand Down

0 comments on commit 496cc32

Please sign in to comment.