blob: e8a2f0ca13a36bd713ed60b39099bc5d8fa0679a [file] [log] [blame]
Arthur Shedb8680f2023-10-28 20:48:35 -07001- job:
2 name: build-aws-amis
3 project-type: freestyle
4 defaults: global
5 properties:
6 - authorization:
7 anonymous:
8 - job-read
9 - job-extended-read
10 - build-discarder:
Paul Sokolovskyd662a562024-11-07 17:24:16 +070011 days-to-keep: 365
12 num-to-keep: 20
Arthur Shedb8680f2023-10-28 20:48:35 -070013 disabled: false
14 node: build-amd64-private
15 concurrent: false
16 display-name: 'Build AWS AMI'
17 wrappers:
18 - timestamps
19 parameters:
20 - bool:
21 name: BUILD_UBUNTU_AMI
22 default: true
Kelley Spoond64e64f2024-10-27 23:51:03 -050023 description: Build Ubuntu AMD64 AMI
24 - bool:
25 name: BUILD_UBUNTU_AARCH64_AMI
26 default: false
27 description: Build Ubuntu AARCH64 AMI
Arthur Shedb8680f2023-10-28 20:48:35 -070028 - bool:
29 name: BUILD_FREEBSD_AMI
30 default: false
31 description: Build FreeBSD AMI
32 - bool:
33 name: BUILD_CUSTOM_AMI
34 default: false
35 description: Build Custom AMI
Fabrice Saya-Gasniere561ca02025-07-30 15:16:57 +010036 - string:
37 name: AMI_REPO_BRANCH
38 default: master
39 description: Branch to use when cloning git.trustedfirmware.org/ci/aws-amis.git
Arthur Shedb8680f2023-10-28 20:48:35 -070040 builders:
41 - shell: |
42 #!/bin/bash
43
44 export PACKER_LOG=1
45
46 AMI=""
47 [ ${BUILD_UBUNTU_AMI} == "true" ] && AMI="${AMI} ubuntu"
Kelley Spoond64e64f2024-10-27 23:51:03 -050048 [ ${BUILD_UBUNTU_AARCH64_AMI} == "true" ] && AMI="${AMI} aarch64"
Arthur Shedb8680f2023-10-28 20:48:35 -070049 [ ${BUILD_FREEBSD_AMI} == "true" ] && AMI="${AMI} freebsd"
50 [ ${BUILD_CUSTOM_AMI} == "true" ] && AMI="${AMI} custom"
51
52 [ -z "${AMI}" ] && echo "Build Nothing.." && exit
53
Arthur She345c9282023-10-28 20:59:19 -070054 [ -d "aws-amis" ] && rm -rf aws-amis
Fabrice Saya-Gasniere561ca02025-07-30 15:16:57 +010055 git clone https://git.trustedfirmware.org/ci/aws-amis.git -b $AMI_REPO_BRANCH
Arthur She345c9282023-10-28 20:59:19 -070056 cd aws-amis
Arthur Shedb8680f2023-10-28 20:48:35 -070057
58 for os in ${AMI}
59 do
60 echo -e "\nBuild ${os} AMI"
61 [ ! -f "packer_${os}.json" ] && echo -e "\nERROR: Can not find packer_${os}.json" && exit -1
62 # Dump packer_config.json to job log
63 cat packer_${os}.json
64 packer build packer_${os}.json
65 done
66 publishers:
67 - email:
68 recipients: linaro-infrastructure-errors@lists.linaro.org,arthur.she@linaro.org