Skip to content

Commit 25609f0

Browse files
Merge pull request #77 from yuravk/master
CI (self-hosted): build images of AlmaLinux OS Kitten 10
2 parents 6905d40 + b01d3eb commit 25609f0

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

.github/workflows/build-rpi.yml

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,15 @@ on:
3434
default: '9'
3535
type: choice
3636
options:
37+
- 10-kitten
3738
- 9
3839
- 8
3940

41+
iteration:
42+
description: 'Kitten 10 build iteration'
43+
required: true
44+
default: '0'
45+
4046
store_as_artifact:
4147
description: "Store images to the workflow Artifacts"
4248
required: true
@@ -76,6 +82,9 @@ jobs:
7682
# 8 has no GPT image
7783
- version_major: '8'
7884
partitioning: 'gpt'
85+
# 10-kitten has no MBR image
86+
- version_major: '10-kitten'
87+
partitioning: 'mbr'
7988

8089
steps:
8190

@@ -87,7 +96,8 @@ jobs:
8796
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
8897
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
8998
aws_region: ${{ secrets.AWS_REGION }}
90-
ec2_ami_id: ${{ inputs.version_major == '9' && secrets.EC2_AMI_ID_AL9 || secrets.EC2_AMI_ID_AL8 }}
99+
# TODO: EC2_AMI_ID_AL9 (9-th AMI) should be used for Kitten 10 until appliance-tools isn't available
100+
ec2_ami_id: ${{ secrets[format('EC2_AMI_ID_AL{0}', ( inputs.version_major == '10-kitten' && '9' || inputs.version_major ))] }}
91101
ec2_subnet_id: ${{ secrets.EC2_SUBNET_ID}}
92102
ec2_security_group_id: ${{ secrets.EC2_SECURITY_GROUP_ID }}
93103

@@ -119,20 +129,43 @@ jobs:
119129
# 8 has no GPT image
120130
- version_major: '8'
121131
partitioning: 'gpt'
132+
# 10-kitten has no MBR image
133+
- version_major: '10-kitten'
134+
partitioning: 'mbr'
122135

123136
steps:
124137

125138
- uses: actions/checkout@v4
126139
name: Checkout ${{ github.action_repository }}
127140

128-
- name: Prepare AlmaLinux Minor version number
141+
- name: Set environment variables
129142
run: |
130-
release=$(rpm -q --qf="%{VERSION}\n" https://repo.almalinux.org/almalinux/almalinux-release-latest-${{ inputs.version_major }}.aarch64.rpm 2>/dev/null)
131-
version_minor=$(cut -d '.' -f 2 <<< "$release")
132-
[ "x${version_minor}" != "x" ] && echo "version_minor=${version_minor}" >> $GITHUB_ENV
143+
# Set environment variables
144+
version_major=${{ matrix.version_major }}
145+
version_minor=
146+
code_name_var=${{ matrix.version_major }}
147+
kickstart_var=${{ matrix.version_major }}
148+
iteration=
149+
150+
case ${{ matrix.version_major }} in
151+
10-kitten)
152+
version_major=10
153+
code_name_var="Kitten"
154+
kickstart_var=10k # TODO: this should be 'kitten-10' or '10-kitten'
155+
iteration=.${{ inputs.iteration }}
156+
release_str="${code_name_var} ${version_major}"
157+
;;
158+
*)
159+
release_url="https://repo.almalinux.org/almalinux/almalinux-release-latest-${version_major}.aarch64.rpm"
160+
release=$(rpm -q --qf="%{VERSION}\n" ${release_url} 2>/dev/null)
161+
version_minor=.$(cut -d '.' -f 2 <<< "$release")
162+
release_str="${version_major}${version_minor}"
163+
;;
164+
esac
165+
166+
# Release string, 8.10, 9.5 or Kitten 10
167+
echo "release_str=${release_str}" >> $GITHUB_ENV
133168
134-
- name: Prepare other stuff
135-
run: |
136169
# date stamp
137170
date_stamp=$(date -u '+%Y%m%d')
138171
[ "x${date_stamp}" != "x" ] && echo "date_stamp=${date_stamp}" >> $GITHUB_ENV
@@ -147,7 +180,7 @@ jobs:
147180
echo "need_pkgs=${need_pkgs}" >> $GITHUB_ENV
148181
149182
# Kickstart file name
150-
kickstart="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-${{ matrix.image_types }}-${{ matrix.partitioning }}.aarch64.ks"
183+
kickstart="AlmaLinux-${kickstart_var}-RaspberryPi-${{ matrix.image_types }}-${{ matrix.partitioning }}.aarch64.ks"
151184
echo "kickstart=${kickstart}" >> $GITHUB_ENV
152185
153186
# Appliance Tools results directory
@@ -156,8 +189,8 @@ jobs:
156189
sudo mkdir -p ${rpi_image_resultdir}
157190
158191
# Image file base name
159-
image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-${{ matrix.partitioning }}-${{ inputs.version_major }}.${{ env.version_minor }}-${date_stamp}.aarch64"
160-
[ "${{ matrix.image_types }}" = "gnome" ] && image_name="AlmaLinux-${{ inputs.version_major }}-RaspberryPi-GNOME-${{ matrix.partitioning }}-${{ inputs.version_major }}.${{ env.version_minor }}-${date_stamp}.aarch64"
192+
image_name="AlmaLinux-${code_name_var}-RaspberryPi-${{ matrix.partitioning }}-${version_major}${version_minor}-${date_stamp}${iteration}.aarch64"
193+
[ "${{ matrix.image_types }}" = "gnome" ] && image_name="AlmaLinux-${code_name_var}-RaspberryPi-GNOME-${{ matrix.partitioning }}-${version_major}${version_minor}-${date_stamp}${iteration}.aarch64"
161194
echo "image_name=${image_name}" >> $GITHUB_ENV
162195
163196
- name: Generate appliance creator script
@@ -166,7 +199,7 @@ jobs:
166199
appliance-creator \
167200
-c kickstart/${{ env.kickstart }} \
168201
-d -v --logfile ${{ env.rpi_image_resultdir }}/${{ env.image_name }}.log \
169-
--cache ./cache8 --no-compress \
202+
--cache ./cache --no-compress \
170203
-o ${{ env.rpi_image_resultdir }} --format raw --name ${{ env.image_name }} | \
171204
tee ${{ env.rpi_image_resultdir }}/${{ env.image_name }}.log.2
172205
EOF
@@ -285,7 +318,7 @@ jobs:
285318
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
286319
MATTERMOST_USERNAME: ${{ github.triggering_actor }}
287320
TEXT: |
288-
**AlmaLinux OS ${{ inputs.version_major }}.${{ env.version_minor }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
321+
**AlmaLinux OS ${{ env.release_str }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
289322
290323
:almalinux: **${{ matrix.image_types }} ${{ matrix.partitioning }}**
291324
@@ -301,7 +334,7 @@ jobs:
301334
MATTERMOST_CHANNEL: ${{ vars.MATTERMOST_CHANNEL }}
302335
MATTERMOST_USERNAME: ${{ github.triggering_actor }}
303336
TEXT: |
304-
**AlmaLinux OS ${{ inputs.version_major }}.${{ env.version_minor }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
337+
**AlmaLinux OS ${{ env.release_str }} Raspberry Pi image Build** `${{ env.date_time_stamp }}` generated by the GitHub [Action](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
305338
306339
:almalinux: **${{ matrix.image_types }} ${{ matrix.partitioning }}**
307340

0 commit comments

Comments
 (0)