Skip to content

Commit 4074a76

Browse files
authored
Create GCP cloud-image-tests workflow
Added a GitHub Actions workflow for GCP cloud image tests with customizable inputs for AlmaLinux versions and architectures. Signed-off-by: Jonathan Wright <[email protected]>
1 parent 9492ab1 commit 4074a76

File tree

1 file changed

+269
-0
lines changed

1 file changed

+269
-0
lines changed

.github/workflows/test-gcp.yml

Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
name: GCP cloud-image-tests
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_major:
7+
description: 'AlmaLinux major version'
8+
required: true
9+
default: '10'
10+
type: choice
11+
options:
12+
- 10-kitten
13+
- 10
14+
- 9
15+
- 8
16+
arch:
17+
description: 'Architecture to test'
18+
required: true
19+
default: 'ALL'
20+
type: choice
21+
options:
22+
- ALL
23+
- x86_64
24+
- aarch64
25+
image_override:
26+
description: 'Image to test, overrides version_major to test a direct image instead. Architecture must be set properly for the image being passed. This must be a full path to a GCP image, for example, projects/almalinux-dev-images-469421/global/images/almalinux-9-v20230920'
27+
required: false
28+
default: ''
29+
# notify_mattermost:
30+
# description: "Send notification to Mattermost"
31+
# required: true
32+
# type: boolean
33+
# default: false
34+
35+
jobs:
36+
init-data:
37+
runs-on: ubuntu-latest
38+
outputs:
39+
image_path: ${{ steps.determine_image.outputs.image_path }}
40+
steps:
41+
- name: Determine image to test
42+
id: determine_image
43+
run: |
44+
if [ -n "${{ inputs.image_override }}" ]; then
45+
echo "Using image override: ${{ inputs.image_override }}"
46+
image_path="${{ inputs.image_override }}"
47+
elif [ "${{ inputs.arch == 'ALL' }}" ]; then
48+
echo "Using version major: ${{ inputs.version_major }}"
49+
echo "Using all architectures"
50+
image_path="projects/almalinux-dev-images-469421/global/images/family/almalinux-${{ inputs.version_major }}"
51+
else
52+
echo "Using version major: ${{ inputs.version_major }}"
53+
echo "Using arch: ${{ inputs.arch }}"
54+
image_path="projects/almalinux-dev-images-469421/global/images/family/almalinux-${{ inputs.version_major }}"
55+
fi
56+
echo "Determined image path: ${image_path}"
57+
echo "image_path=${image_path}" >> $GITHUB_OUTPUT
58+
59+
# # this initial test does the generic suite of tests not assigned to any specific shape - letting the test system
60+
# # choose its own shapes and sizes. This is run first to catch any major issues before running the per-shape tests
61+
# # which take a long time and use a lot of resources. Think of this as a smoke test to catch major issues early.
62+
# test-gcp-initialtest:
63+
# name: AlmaLinux ${{ inputs.image_override || format('{0} {1}', inputs.version_major, matrix.arch) }} Generic Full Run
64+
# needs: init-data
65+
# permissions:
66+
# id-token: write
67+
# contents: read
68+
# runs-on: ubuntu-24.04
69+
# strategy:
70+
# fail-fast: false
71+
# matrix:
72+
# # this sets the arch matrix based on the input
73+
# # if input is ALL, then set to both x86_64 and aarch64
74+
# # otherwise set to the selected arch
75+
# arch: ${{ fromJSON(inputs.arch == 'ALL' && '["x86_64","aarch64"]' || format('["{0}"]', inputs.arch)) }}
76+
# steps:
77+
# # we don't need the checked out files, but this is required for the google auth action to work
78+
# - uses: 'actions/checkout@v5'
79+
80+
# - id: 'google-auth-image-testing'
81+
# uses: 'google-github-actions/auth@v2'
82+
# with:
83+
# workload_identity_provider: 'projects/527193872801/locations/global/workloadIdentityPools/github-actions/providers/github'
84+
# service_account: 'github-actions-image-testing@almalinux-image-testing-469421.iam.gserviceaccount.com'
85+
86+
# - name: 'Set up Google Cloud SDK'
87+
# uses: 'google-github-actions/[email protected]'
88+
89+
# - name: 'Run Google cloud-image-testing tests which are hard-coded to specific shapes'
90+
# shell: bash
91+
# run: |
92+
# docker run \
93+
# -v ${{ env.GOOGLE_GHA_CREDS_PATH }}:/creds/auth.json \
94+
# -e GOOGLE_APPLICATION_CREDENTIALS=/creds/auth.json \
95+
# gcr.io/compute-image-tools/cloud-image-tests:latest \
96+
# -project almalinux-image-testing-469421 \
97+
# -parallel_stagger 10s \
98+
# -parallel_count 20 \
99+
# -filter '^(cvm|livemigrate|suspendresume|loadbalancer|guestagent|hostnamevalidation|imageboot|licensevalidation|network|security|hotattach|packagevalidation|ssh|metadata|disk|lssd|vmspec)$' \
100+
# -images '${{ needs.init-data.outputs.image_path }}${{ inputs.image_override == '' && matrix.arch == 'aarch64' && '-arm64' || ''}}'
101+
102+
test-gcp-pershape-x86_64:
103+
name: ${{ inputs.image_override || format('{0}', inputs.version_major) }} x86_64 ${{ matrix.shape }}
104+
#needs: [init-data, test-gcp-initialtest]
105+
needs: init-data
106+
permissions:
107+
id-token: write
108+
contents: read
109+
runs-on: "${{ github.repository_owner == 'AlmaLinux' && format('runs-on={0}/runner=2cpu-linux-x64/spot=false/image=almalinux-10-x86_64', github.run_id) || 'ubuntu-24.04' }}"
110+
if: inputs.arch == 'ALL' || inputs.arch == 'x86_64'
111+
strategy:
112+
fail-fast: false
113+
matrix:
114+
shape:
115+
- n4-standard-2
116+
- n4-standard-80
117+
- n2-standard-2
118+
- n2-standard-128
119+
- n2d-standard-2
120+
- n2d-standard-224
121+
- n1-standard-1
122+
- n1-standard-96
123+
- c4-standard-2
124+
# can never get capacity for 288 so using 192
125+
- c4-standard-192
126+
# all lssd shapes fail
127+
# https://github.com/GoogleCloudPlatform/cloud-image-tests/issues/345
128+
# - c4-standard-4-lssd
129+
# - c4-standard-288-lssd
130+
# never has capacity anywhere
131+
# - c4-standard-288-metal
132+
- c4d-standard-2
133+
# can never get capacity for 384 so using 192
134+
- c4d-standard-192
135+
# - c4d-standard-8-lssd
136+
# - c4d-standard-384-lssd
137+
- c3-standard-4
138+
- c3-standard-176
139+
# never any metal capacity available
140+
- c3-standard-192-metal
141+
# - c3-standard-4-lssd
142+
# - c3-standard-176-lssd
143+
- c3d-standard-4
144+
- c3d-standard-360
145+
# - c3d-standard-8-lssd
146+
# - c3d-standard-360-lssd
147+
- e2-standard-2
148+
- e2-standard-32
149+
- e2-medium
150+
- t2d-standard-1
151+
- t2d-standard-60
152+
# h4d tests fail
153+
# https://github.com/GoogleCloudPlatform/cloud-image-tests/issues/346
154+
# - h4d-standard-192
155+
# - h4d-highmem-192-lssd
156+
# can never get capacity for this shape
157+
# - h3-standard-88
158+
- c2-standard-4
159+
- c2-standard-60
160+
- c2d-standard-2
161+
- c2d-standard-112
162+
# m4, x4, m3, m2 disabled due to no quotas
163+
# - m4-megamem-28
164+
# - m4-megamem-224
165+
# - x4-megamem-960-metal
166+
# - x4-megamem-1920-metal
167+
# - m3-megamem-64
168+
# - m2-megamem-416
169+
# m1 quota too low
170+
# - m1-megamem-96
171+
# z3 tests fail
172+
# https://github.com/GoogleCloudPlatform/cloud-image-tests/issues/346
173+
# z3 tests not needed, basically c3 with lots of lssd, so covered by c3-lssd tests
174+
# - z3-highmem-14-standardlssd
175+
# things with special zone requirements or other special needs
176+
# include:
177+
# only available in us-central1-b
178+
# disabled, never any capacity available
179+
# - shape: c4d-standard-384-metal
180+
# zone: us-central1-b
181+
182+
steps:
183+
# we don't need the checked out files, but this is required for the google auth action to work
184+
- uses: 'actions/checkout@v5'
185+
186+
- id: 'google-auth-image-testing'
187+
uses: 'google-github-actions/auth@v2'
188+
with:
189+
workload_identity_provider: 'projects/527193872801/locations/global/workloadIdentityPools/github-actions/providers/github'
190+
service_account: 'github-actions-image-testing@almalinux-image-testing-469421.iam.gserviceaccount.com'
191+
192+
- name: 'Set up Google Cloud SDK'
193+
uses: 'google-github-actions/[email protected]'
194+
195+
- name: Runner OS specific configuration
196+
shell: bash
197+
run: |
198+
# Runner OS specific configuration
199+
if [ -e /etc/redhat-release ]; then
200+
sudo setenforce 0
201+
sudo dnf -y install podman
202+
runner_user=$USER
203+
sudo loginctl enable-linger $runner_user
204+
docker_cmd=podman
205+
elif lsb_release -cs > /dev/null 2>&1; then
206+
docker_cmd=docker
207+
else
208+
echo "[Debug] Unknown OS"
209+
exit 1
210+
fi
211+
echo "docker_cmd=${docker_cmd}" >> $GITHUB_ENV
212+
213+
- name: 'Run Google cloud-image-testing tests on ${{ matrix.shape }}'
214+
shell: bash
215+
run: |
216+
${{ env.docker_cmd }} run \
217+
-v ${{ env.GOOGLE_GHA_CREDS_PATH }}:/creds/auth.json \
218+
-e GOOGLE_APPLICATION_CREDENTIALS=/creds/auth.json \
219+
gcr.io/compute-image-tools/cloud-image-tests:latest \
220+
-project almalinux-image-testing-469421 \
221+
-x86_shape ${{ matrix.shape }} \
222+
-parallel_count ${{ github.run_attempt > 1 && '5' || '1' }} \
223+
${{ matrix.zone && format('-zone {0}', matrix.zone) || '' }} \
224+
-filter '^(cvm|livemigrate|suspendresume|loadbalancer|guestagent|hostnamevalidation|imageboot|licensevalidation|network|security|hotattach|packagevalidation|ssh|metadata)$' \
225+
-images '${{ needs.init-data.outputs.image_path || inputs.image_override }}${{ inputs.image_override == '' && matrix.arch == 'aarch64' && '-arm64' || ''}}'
226+
227+
test-gcp-pershape-aarch64:
228+
name: ${{ inputs.image_override || format('{0}', inputs.version_major) }} aarch64 ${{ matrix.shape }}
229+
#needs: [init-data, test-gcp-initialtest]
230+
needs: init-data
231+
permissions:
232+
id-token: write
233+
contents: read
234+
runs-on: ubuntu-24.04
235+
if: inputs.arch == 'ALL' || inputs.arch == 'aarch64'
236+
strategy:
237+
fail-fast: false
238+
matrix:
239+
shape:
240+
- c4a-standard-1
241+
- c4a-standard-72
242+
- c4a-standard-4-lssd
243+
- c4a-standard-72-lssd
244+
- t2a-standard-1
245+
- t2a-standard-48
246+
steps:
247+
# we don't need the checked out files, but this is required for the google auth action to work
248+
- uses: 'actions/checkout@v5'
249+
250+
- id: 'google-auth-image-testing'
251+
uses: 'google-github-actions/auth@v2'
252+
with:
253+
workload_identity_provider: 'projects/527193872801/locations/global/workloadIdentityPools/github-actions/providers/github'
254+
service_account: 'github-actions-image-testing@almalinux-image-testing-469421.iam.gserviceaccount.com'
255+
256+
- name: 'Set up Google Cloud SDK'
257+
uses: 'google-github-actions/[email protected]'
258+
259+
- name: 'Run Google cloud-image-testing tests on ${{ matrix.shape }}'
260+
shell: bash
261+
run: |
262+
docker run \
263+
-v ${{ env.GOOGLE_GHA_CREDS_PATH }}:/creds/auth.json \
264+
-e GOOGLE_APPLICATION_CREDENTIALS=/creds/auth.json \
265+
gcr.io/compute-image-tools/cloud-image-tests:latest \
266+
-project almalinux-image-testing-469421 \
267+
-arm64_shape ${{ matrix.shape }} \
268+
-filter '^(cvm|livemigrate|suspendresume|loadbalancer|guestagent|hostnamevalidation|imageboot|licensevalidation|network|security|hotattach|packagevalidation|ssh|metadata)$' \
269+
-images '${{ needs.init-data.outputs.image_path || inputs.image_override }}${{ inputs.image_override == '' && matrix.arch == 'aarch64' && '-arm64' || ''}}'

0 commit comments

Comments
 (0)