Skip to content

Commit 5e798c4

Browse files
committed
jenkins: Assorted fixes for AMI building
Assorted fixes to fix AMI building: * Install pandoc on all EC2 images * Update AWS CLI to v2 on RHEL, to avoid dependency on newer Python than is available in the AMI * Remove support for old distros, including Amazon Linux 1, Ubuntu 14.04, Ubuntu 16.04, and SLES 12 * Fix selection of base AMI for SLES 15 to avoid container optimized AMIs, which frequently do not have properly configured package management. Signed-off-by: Brian Barrett <bbarrett@amazon.com>
1 parent e2d66d2 commit 5e798c4

File tree

2 files changed

+38
-84
lines changed

2 files changed

+38
-84
lines changed

jenkins/customize-ami.sh

Lines changed: 37 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
set -e
2020

21+
pandoc_x86_url="s3://ompi-jenkins-config/pandoc-2.14.2-linux-amd64.tar.gz"
22+
pandoc_arm_url="s3://ompi-jenkins-config/pandoc-2.14.2-linux-arm64.tar.gz"
23+
awscli_x86_url="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip"
24+
awscli_arm_url="https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip"
25+
2126
labels="ec2"
2227

2328
os=`uname -s`
@@ -59,6 +64,8 @@ echo "==> Sleeping 2 minutes"
5964
# lock conflicts by waiting a couple minutes.
6065
sleep 120
6166

67+
pandoc_installed=0
68+
6269
case $PLATFORM_ID in
6370
rhel|centos)
6471
echo "==> Installing packages"
@@ -85,11 +92,16 @@ case $PLATFORM_ID in
8592
exit 1
8693
;;
8794
esac
95+
if test "$arch" = "x86_64" ; then
96+
awscli_url="${awscli_x86_url}"
97+
else
98+
awscli_url="${awscli_arm_url}"
99+
fi
88100
(cd /tmp && \
89-
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" && \
90-
unzip awscli-bundle.zip && \
91-
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws && \
92-
rm -rf awscli-bundle*)
101+
curl "${awscli_url}" -o "awscliv2.zip" && \
102+
unzip awscliv2.zip && \
103+
sudo ./aws/install &&
104+
rm -rf aws)
93105
;;
94106
amzn)
95107
echo "==> Installing packages"
@@ -100,15 +112,6 @@ case $PLATFORM_ID in
100112
gdb
101113
labels="${labels} linux"
102114
case $VERSION_ID in
103-
2016.09|2017.03|2017.09|2018.03)
104-
# clang == 3.6.2
105-
sudo yum -y groupinstall "Java Development"
106-
sudo yum -y install gcc44 gcc44-c++ gcc44-gfortran \
107-
gcc48 gcc48-c++ gcc48-gfortran clang \
108-
python27-mock python27-boto python27-boto3
109-
sudo alternatives --set java /usr/lib/jvm/jre-1.8.0-openjdk.x86_64/bin/java
110-
labels="${labels} amazon_linux_1 gcc44 gcc48 clang36"
111-
;;
112115
2)
113116
sudo yum -y install clang hwloc-devel \
114117
python2-pip python2 python2-boto3
@@ -131,29 +134,9 @@ case $PLATFORM_ID in
131134
sudo apt-get -y install build-essential gfortran \
132135
autoconf automake libtool flex hwloc libhwloc-dev git \
133136
default-jre awscli python-mock rman pandoc
134-
labels="${labels} linux ubuntu_${VERSION_ID}-${arch} pandoc"
137+
pandoc_installed=1
138+
labels="${labels} linux ubuntu_${VERSION_ID}-${arch}"
135139
case $VERSION_ID in
136-
14.04)
137-
sudo apt-get -y install python-boto3 python-mock \
138-
gcc-4.4 g++-4.4 gfortran-4.4 \
139-
gcc-4.6 g++-4.6 gfortran-4.6 \
140-
gcc-4.7 g++-4.7 gfortran-4.7 \
141-
gcc-4.8 g++-4.8 gfortran-4.8 \
142-
clang-3.6 clang-3.7 clang-3.8
143-
labels="${labels} gcc44 gcc46 gcc47 gcc48 clang36 clang37 clang38"
144-
;;
145-
16.04)
146-
sudo apt-get -y install python-boto3 python-mock \
147-
gcc-4.7 g++-4.7 gfortran-4.7 \
148-
gcc-4.8 g++-4.8 gfortran-4.8 \
149-
gcc-4.9 g++-4.9 gfortran-4.9 \
150-
clang-3.6 clang-3.7 clang-3.8
151-
labels="${labels} gcc47 gcc48 gcc49 gcc5 clang36 clang37 clang38"
152-
if test "$arch" = "x86_64" ; then
153-
sudo apt-get -y install gcc-multilib g++-multilib gfortran-multilib
154-
labels="${labels} 32bit_builds"
155-
fi
156-
;;
157140
18.04)
158141
sudo apt-get -y install \
159142
python-boto3 \
@@ -200,22 +183,6 @@ case $PLATFORM_ID in
200183
autoconf automake libtool flex make gdb
201184
labels="${labels} linux sles_${VERSION_ID}-${arch}"
202185
case $VERSION_ID in
203-
12.*)
204-
# gcc5 == 5.3.1
205-
# gcc6 == 6.2.1
206-
sudo zypper -n install \
207-
hwloc-devel \
208-
python-boto python-boto3 python-mock \
209-
gcc48 gcc48-c++ gcc48-fortran \
210-
gcc5 gcc5-c++ gcc5-fortran \
211-
gcc6 gcc6-c++ gcc6-fortran
212-
labels="${labels} gcc48 gcc5 gcc6"
213-
214-
# No java shipped in SLES12 by default...
215-
jre_file=jre-8u121-linux-x64.rpm
216-
aws s3 cp s3://ompi-jenkins-config/${jre_file} /tmp/${jre_file}
217-
sudo rpm -i /tmp/${jre_file}
218-
;;
219186
15.*)
220187
sudo zypper -n install \
221188
java-11-openjdk \
@@ -240,7 +207,8 @@ case $PLATFORM_ID in
240207
else
241208
echo "--> Skipping sudoers update"
242209
fi
243-
sudo pkg install -y openjdk8 autoconf automake libtool gcc wget curl git
210+
sudo pkg install -y openjdk8 autoconf automake libtool gcc wget curl git hs-pandoc
211+
pandoc_installed=1
244212
if ! grep -q '/dev/fd' /etc/fstab ; then
245213
echo "Adding /dev/fd entry to /etc/fstab"
246214
sudo sh -c 'echo "fdesc /dev/fd fdescfs rw 0 0" >> /etc/fstab'
@@ -255,6 +223,23 @@ case $PLATFORM_ID in
255223
exit 1
256224
esac
257225

226+
if [[ $pandoc_installed -eq 0 ]] ; then
227+
if [[ $arch == "x86_64" ]] ; then
228+
pandoc_url=${pandoc_x86_url}
229+
else
230+
pandoc_url=${pandoc_arm_url}
231+
fi
232+
pandoc_tarname=`basename ${pandoc_url}`
233+
234+
aws s3 cp "${pandoc_url}" "${pandoc_tarname}"
235+
tar xf "${pandoc_tarname}"
236+
# Pandoc does not name its directories exactly the same name
237+
# as the tarball. Sigh.
238+
pandoc_dir=`find . -maxdepth 1 -name "pandoc*" -type d -print`
239+
sudo cp "${pandoc_dir}/bin/pandoc" "/usr/local/bin/pandoc"
240+
rm -rf "${pandoc_tarname}" "${pandoc_dir}"
241+
fi
242+
258243
if test $run_test != 0; then
259244
# for these tests, fail the script if a test fails
260245
set -e

jenkins/packer.json

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -284,37 +284,6 @@
284284
"associate_public_ip_address" : true,
285285
"ena_support" : true,
286286
"iam_instance_profile" : "{{user `iam_role`}}"
287-
},{
288-
"type": "amazon-ebs",
289-
"name" : "SLES12-x86",
290-
"ami_name": "Jenkins SLES 12 x86_64 {{user `build_date`}}",
291-
"region": "us-west-2",
292-
"source_ami_filter": {
293-
"filters": {
294-
"architecture": "x86_64",
295-
"virtualization-type": "hvm",
296-
"root-device-type": "ebs",
297-
"name": "suse-sles-12-*"
298-
},
299-
"owners": ["amazon"],
300-
"most_recent": true
301-
},
302-
"ami_block_device_mappings": [ {
303-
"device_name": "/dev/sda1",
304-
"volume_size": 16,
305-
"delete_on_termination": true
306-
} ],
307-
"launch_block_device_mappings": [ {
308-
"device_name": "/dev/sda1",
309-
"volume_size": 16,
310-
"delete_on_termination": true
311-
} ],
312-
"instance_type": "t3.micro",
313-
"ssh_username": "ec2-user",
314-
"ssh_pty" : true,
315-
"associate_public_ip_address" : true,
316-
"ena_support" : true,
317-
"iam_instance_profile" : "{{user `iam_role`}}"
318287
},{
319288
"type": "amazon-ebs",
320289
"name" : "SLES15-x86",
@@ -325,7 +294,7 @@
325294
"architecture": "x86_64",
326295
"virtualization-type": "hvm",
327296
"root-device-type": "ebs",
328-
"name": "suse-sles-15-*"
297+
"name": "suse-sles-15-sp??-v????????-hvm-ssd*"
329298
},
330299
"owners": ["amazon"],
331300
"most_recent": true

0 commit comments

Comments
 (0)