-
Notifications
You must be signed in to change notification settings - Fork 578
90 lines (86 loc) · 2.98 KB
/
build-ami.yml
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
name: build-and-publish-ami
on:
workflow_dispatch:
inputs:
regions:
description: 'Publication regions'
required: true
default: 'ap-south-1,eu-west-3,eu-west-2,eu-west-1,ap-northeast-2,ap-northeast-1,sa-east-1,ca-central-1,ap-southeast-1,ap-southeast-2,eu-central-1,us-east-1,us-east-2,us-west-1,us-west-2'
k8s_semver:
description: 'K8s Semver'
required: true
k8s_series:
description: 'K8s Release Series (major.minor version)'
required: true
k8s_rpm_version:
description: 'K8s rpm package version'
required: true
k8s_deb_version:
description: 'K8s deb package version'
required: true
cni_semver:
description: 'CNI Semver'
required: true
cni_deb_version:
description: 'CNI deb package version'
required: true
crictl_version:
description: 'Crictl version'
required: true
permissions:
id-token: write
contents: read
jobs:
buildandpublish:
strategy:
matrix:
target: ['ubuntu-2204', 'ubuntu-2404', 'flatcar', 'rhel-8']
max-parallel: 1
fail-fast: false
name: Build and publish CAPA AMIs
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
repository: kubernetes-sigs/image-builder
fetch-depth: 0
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: us-east-2
role-to-assume: arn:aws:iam::819546954734:role/gh-image-builder
- name: Install deps
run: make deps-ami
working-directory: ./images/capi
- name: Install Amazon EBS Plugin
working-directory: ./images/capi
run: ./.local/bin/packer plugins install github.com/hashicorp/amazon
- name: Create Packer Args
env:
K8S_RPM_VERSION: ${{ inputs.k8s_rpm_version }}
K8S_SEMVER: ${{ inputs.k8s_semver }}
K8S_SERIES: ${{ inputs.k8s_series }}
K8S_DEB_VERSION: ${{ inputs.k8s_deb_version }}
CNI_SEMVER: ${{ inputs.cni_semver }}
CNI_DEB_VERSION: ${{ inputs.cni_deb_version }}
CRICTL_VERSION: ${{ inputs.crictl_version }}
AMI_REGIONS: ${{ inputs.regions }}
run: |
cat > ./images/capi/vars.json << EOF
{
"kubernetes_rpm_version": "$K8S_RPM_VERSION",
"kubernetes_semver": "$K8S_SEMVER",
"kubernetes_series": "$K8S_SERIES",
"kubernetes_deb_version": "$K8S_DEB_VERSION",
"kubernetes_cni_semver": "$CNI_SEMVER",
"kubernetes_cni_deb_version": "$CNI_DEB_VERSION",
"crictl_version": "$CRICTL_VERSION",
"ami_regions": "$AMI_REGIONS"
}
EOF
- name: Show vars
run: cat ./images/capi/vars.json
- name: Build AMI
working-directory: ./images/capi
run: PACKER_VAR_FILES=vars.json make build-ami-${{ matrix.target }}