forked from aws/amazon-ecs-ami
-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate-release-notes.sh
executable file
·183 lines (157 loc) · 8.73 KB
/
generate-release-notes.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#!/bin/bash
set -eo pipefail
usage() {
echo "Usage:"
echo " $0 AL2_GPU_NVIDIA_VERSION AL2_GPU_CUDA_VERSION [AL1_CONTAINERD_VERSION]"
echo " AL1_CONTAINERD_VERSION should not be provided if there is no AL1 AMI release"
echo "Example:"
echo " $0 470.182.03 11.4 1.4.13 # AL1 release included"
echo " $0 470.182.03 11.4 # No AL1 release"
}
# Parameters
al2_gpu_nvidia_version=$1
al2_gpu_cuda_version=$2
al1_containerd_version=$3 # Optional, will include AL1 in the release notes if provided
if [ "$al2_gpu_nvidia_version" == "" ]; then
echo "Error: AL2 GPU NVIDIA version is empty"
usage
exit 1
fi
if [ "$al2_gpu_cuda_version" == "" ]; then
echo "Error: AL2 GPU CUDA version is empty"
usage
exit 1
fi
# Read some information from pkrvars file
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 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)
if [ -z "$ami_version" ]; then
echo "Error: AMI version was not found in $pkrvars"
exit 1
fi
if [ -z "$containerd_version_al2023" ]; then
echo "Error: Containerd 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
fi
if [ -z "$containerd_version" ]; then
echo "Error: Containerd 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
# fetched from a standard region (us-west-2 is used).
get_ami_details() {
parameter_name=$1
ami_details=$(aws ssm --region "us-west-2" get-parameters --names $parameter_name --query 'Parameters[0].Value' --output text | jq .)
ami_name=$(echo "$ami_details" | jq -r '.image_name')
agent_version=$(echo "$ami_details" | jq -r '.ecs_agent_version')
docker_version=$(echo "$ami_details" | jq -r '.ecs_runtime_version' | awk '{print $3}')
source_ami_name=$(echo "$ami_details" | jq -r '.source_image_name')
echo "$ami_name $agent_version $docker_version $source_ami_name"
}
# AL2023 AMI details
read ami_name_al2023_x86 agent_version_al2023_x86 docker_version_al2023_x86 source_ami_name_al2023_x86 <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2023/recommended")
read ami_name_al2023_arm agent_version_al2023_arm docker_version_al2023_arm source_ami_name_al2023_arm <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2023/arm64/recommended")
read ami_name_al2023_neuron agent_version_al2023_neuron docker_version_al2023_neuron source_ami_name_al2023_neuron <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2023/neuron/recommended")
# AL2 AMI details
read ami_name_al2_x86 agent_version_al2_x86 docker_version_al2_x86 source_ami_name_al2_x86 <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended")
read ami_name_al2_arm agent_version_al2_arm docker_version_al2_arm source_ami_name_al2_arm <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/arm64/recommended")
read ami_name_al2_gpu agent_version_al2_gpu docker_version_al2_gpu source_ami_name_al2_gpu <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/gpu/recommended")
read ami_name_al2_inf agent_version_al2_inf docker_version_al2_inf source_ami_name_al2_inf <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/inf/recommended")
read ami_name_al2_kernel_5_10 agent_version_al2_kernel_5_10 docker_version_al2_kernel_5_10 source_ami_name_al2_kernel_5_10 <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/kernel-5.10/recommended")
read ami_name_al2_kernel_5_10_arm agent_version_al2_kernel_5_10_arm docker_version_al2_kernel_5_10_arm source_ami_name_al2_kernel_5_10_arm <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux-2/kernel-5.10/arm64/recommended")
# AL1 AMI details
read ami_name_al1 agent_version_al1 docker_version_al1 source_ami_name_al1 <<<$(get_ami_details "/aws/service/ecs/optimized-ami/amazon-linux/recommended")
# Prepare release notes
release_notes="### Source AMI release notes
---
* [Amazon Linux 2023 release notes](https://docs.aws.amazon.com/linux/al2023/release-notes/relnotes.html)
* [Amazon Linux 2 release notes](https://docs.aws.amazon.com/AL2/latest/relnotes/relnotes-al2.html)
* [Amazon Linux release notes](https://aws.amazon.com/amazon-linux-ami/2018.03-release-notes)
### Changelog
---
https://github.com/aws/amazon-ecs-ami/blob/main/CHANGELOG.md#$ami_version
### Amazon ECS-optimized Amazon Linux 2023 AMI
---
#### AMD64
- AMI name: $ami_name_al2023_x86
- 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
- Source AMI name: $source_ami_name_al2023_x86
- Distribution al2023 release: $distribution_release_al2023
#### ARM64
- AMI name: $ami_name_al2023_arm
- 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
- Source AMI name: $source_ami_name_al2023_arm
- Distribution al2023 release: $distribution_release_al2023
#### Neuron
- AMI name: $ami_name_al2023_neuron
- 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
- Source AMI name: $source_ami_name_al2023_neuron
- Distribution al2023 release: $distribution_release_al2023
### Amazon ECS-optimized Amazon Linux 2 AMI
---
#### AMD64 (Kernel 4.14)
- AMI name: $ami_name_al2_x86
- 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
- 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
- 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
- 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
- NVIDIA driver version: $al2_gpu_nvidia_version
- CUDA version: $al2_gpu_cuda_version
- Source AMI name: $source_ami_name_al2_gpu
#### AMD64 (Kernel 5.10)
- AMI name: $ami_name_al2_kernel_5_10
- 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
- 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
- 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
al1_release_notes="
### Amazon ECS-optimized Amazon Linux AMI
---
The Amazon ECS-optimized Amazon Linux AMI is deprecated as of April 15, 2021. After that date, Amazon ECS will continue providing critical and important security updates for the AMI but will not add support for new features.
- AMI name: $ami_name_al1
- 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
- Source AMI name: $source_ami_name_al1"
release_notes="${release_notes}${al1_release_notes}"
fi
echo "$release_notes"