Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 1 | - 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 Sokolovsky | d662a56 | 2024-11-07 17:24:16 +0700 | [diff] [blame] | 11 | days-to-keep: 365 |
| 12 | num-to-keep: 20 |
Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 13 | 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 Spoon | d64e64f | 2024-10-27 23:51:03 -0500 | [diff] [blame] | 23 | description: Build Ubuntu AMD64 AMI |
| 24 | - bool: |
| 25 | name: BUILD_UBUNTU_AARCH64_AMI |
| 26 | default: false |
| 27 | description: Build Ubuntu AARCH64 AMI |
Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 28 | - 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-Gasnier | e561ca0 | 2025-07-30 15:16:57 +0100 | [diff] [blame] | 36 | - string: |
| 37 | name: AMI_REPO_BRANCH |
| 38 | default: master |
| 39 | description: Branch to use when cloning git.trustedfirmware.org/ci/aws-amis.git |
Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 40 | builders: |
| 41 | - shell: | |
| 42 | #!/bin/bash |
| 43 | |
| 44 | export PACKER_LOG=1 |
| 45 | |
| 46 | AMI="" |
| 47 | [ ${BUILD_UBUNTU_AMI} == "true" ] && AMI="${AMI} ubuntu" |
Kelley Spoon | d64e64f | 2024-10-27 23:51:03 -0500 | [diff] [blame] | 48 | [ ${BUILD_UBUNTU_AARCH64_AMI} == "true" ] && AMI="${AMI} aarch64" |
Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 49 | [ ${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 She | 345c928 | 2023-10-28 20:59:19 -0700 | [diff] [blame] | 54 | [ -d "aws-amis" ] && rm -rf aws-amis |
Fabrice Saya-Gasnier | e561ca0 | 2025-07-30 15:16:57 +0100 | [diff] [blame] | 55 | git clone https://git.trustedfirmware.org/ci/aws-amis.git -b $AMI_REPO_BRANCH |
Arthur She | 345c928 | 2023-10-28 20:59:19 -0700 | [diff] [blame] | 56 | cd aws-amis |
Arthur She | db8680f | 2023-10-28 20:48:35 -0700 | [diff] [blame] | 57 | |
| 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 |