Skip to content

Commit 75bd85b

Browse files
rexcsnenrico-usai
authored andcommitted
Create packer file and enable kitchen tests for CentOS8
* Create packer file for CentOS8 with similar logic to CentOS7 * Using dnf instead of yum as package manager everywhere * Add kitchen tests for CentOS 8 * Install python3 version of aws-cfn-bootstrap scripts to support CentOS8 Signed-off-by: Enrico Usai <[email protected]> Signed-off-by: Rex <[email protected]>
1 parent 7924032 commit 75bd85b

File tree

3 files changed

+374
-5
lines changed

3 files changed

+374
-5
lines changed

.kitchen.cloud.yml

+61
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,67 @@ platforms:
273273
transport:
274274
username: centos
275275
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
276+
- name: centos-8-minimal
277+
driver_plugin: ec2
278+
driver_config:
279+
image_id: <%= ENV['CENTOS8_IMAGE_ID'] %>
280+
block_device_mappings:
281+
- device_name: /dev/sda1
282+
ebs:
283+
volume_size: <%= ENV['VOLUME_SIZE'] || 25 %>
284+
volume_type: gp2
285+
delete_on_termination: true
286+
- device_name: /dev/xvdba
287+
virtual_name: ephemeral0
288+
- device_name: /dev/xvdbb
289+
virtual_name: ephemeral1
290+
- device_name: /dev/xvdbc
291+
virtual_name: ephemeral2
292+
- device_name: /dev/xvdbd
293+
virtual_name: ephemeral3
294+
- device_name: /dev/xvdbe
295+
virtual_name: ephemeral4
296+
- device_name: /dev/xvdbf
297+
virtual_name: ephemeral5
298+
- device_name: /dev/xvdbg
299+
virtual_name: ephemeral6
300+
- device_name: /dev/xvdbh
301+
virtual_name: ephemeral7
302+
- device_name: /dev/xvdbi
303+
virtual_name: ephemeral8
304+
- device_name: /dev/xvdbj
305+
virtual_name: ephemeral9
306+
- device_name: /dev/xvdbk
307+
virtual_name: ephemeral10
308+
- device_name: /dev/xvdbl
309+
virtual_name: ephemeral11
310+
- device_name: /dev/xvdbm
311+
virtual_name: ephemeral12
312+
- device_name: /dev/xvdbn
313+
virtual_name: ephemeral13
314+
- device_name: /dev/xvdbo
315+
virtual_name: ephemeral14
316+
- device_name: /dev/xvdbp
317+
virtual_name: ephemeral15
318+
- device_name: /dev/xvdbq
319+
virtual_name: ephemeral16
320+
- device_name: /dev/xvdbr
321+
virtual_name: ephemeral17
322+
- device_name: /dev/xvdbs
323+
virtual_name: ephemeral18
324+
- device_name: /dev/xvdbt
325+
virtual_name: ephemeral19
326+
- device_name: /dev/xvdbu
327+
virtual_name: ephemeral20
328+
- device_name: /dev/xvdbv
329+
virtual_name: ephemeral21
330+
- device_name: /dev/xvdbw
331+
virtual_name: ephemeral22
332+
- device_name: /dev/xvdbx
333+
virtual_name: ephemeral23
334+
transport:
335+
username: centos
336+
ssh_key: <%= ENV['EC2_SSH_KEY_PATH'] %>
276337
- name: ubuntu-16-04-lts
277338
driver_plugin: ec2
278339
driver_config:

amis/build_ami.sh

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717
# Usage: build_ami.sh --os <os> --region <region> --partition <partition> [--public] [--custom]
1818
# [--build-date <build-date>] [--arch <arch>]
19-
# os: the os to build (supported values: all|centos6|centos7|alinux|alinux2|ubuntu1604|ubuntu1804)
19+
# os: the os to build (supported values: all|centos6|centos7|centos8|alinux|alinux2|ubuntu1604|ubuntu1804)
2020
# partition: partition to build in (supported values: commercial|govcloud|china|region)
2121
# region: region to copy ami too (supported values: all|us-east-1|us-gov-west-1|...)
2222
# custom: specifies to create the AMI from a custom AMI-id, which must be specified by variable CUSTOM_AMI_ID in the environment (optional)
@@ -114,7 +114,7 @@ parse_options() {
114114
check_options() {
115115
set -e
116116

117-
available_arm_os="ubuntu1804 alinux2" # subset of supported OSes for which ARM AMIs are available
117+
available_arm_os="ubuntu1804 alinux2 centos8" # subset of supported OSes for which ARM AMIs are available
118118
available_os="centos6 centos7 alinux ubuntu1604 ${available_arm_os}"
119119
cwd="$(dirname $0)"
120120
export COOKBOOK_PATH="$(cd ${cwd}/..; pwd)"
@@ -184,8 +184,8 @@ check_options() {
184184
esac
185185

186186
# Ensure the specified architecture-OS combination is valid
187-
if [ "${_arch}" == "arm64" ] && [[ "${_os}" =~ ^centos[0-9]+ ]]; then
188-
echo "Currently there are no CentOS arm64 AMIs available."
187+
if [ "${_arch}" == "arm64" ] && [[ "${_os}" =~ ^centos[6-7]$ ]]; then
188+
echo "Currently there are no arm64 AMIs available for ${_os}."
189189
exit 1
190190
elif [ "${_arch}" == "arm64" ] && [ "${_os}" == "alinux" ]; then
191191
echo "Currently there are no alinux (AL1) arm64 AMIs available."
@@ -222,7 +222,7 @@ do_command() {
222222
RC=$?
223223
done
224224
;;
225-
centos6|centos7|alinux|ubuntu1604|ubuntu1804|alinux2)
225+
centos6|centos7|centos8|alinux|ubuntu1604|ubuntu1804|alinux2)
226226
packer build -color=false -var-file="${cwd}/packer_variables.json" -only=${only} "${cwd}/packer_${_os}.json"
227227
RC=$?
228228
;;

0 commit comments

Comments
 (0)