forked from AlmaLinux/cloud-images
-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (80 loc) · 3.32 KB
/
gcp-publish.yml
File metadata and controls
89 lines (80 loc) · 3.32 KB
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: GCP Image Publish
on:
workflow_dispatch:
inputs:
version_major:
description: 'AlmaLinux major version'
required: true
default: ''
type: choice
options:
- 10-kitten
- 10
- 9
- 8
arch:
description: 'Architecture we are publishing'
required: true
default: ''
type: choice
options:
- x86_64
- aarch64
image_datetag:
description: 'Date tag of the image to publish after the "v" in the image name. E.g. for almalinux-10-arm64-v20251205 the date tag is "20251205"'
required: true
default: ''
jobs:
publish-image:
name: Publish Images to almalinux-cloud GCP Project (prod)
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
# we don't need the checked out files, but this is required for the google auth action to work
- uses: actions/checkout@v5
- name: Build image name from inputs
id: build-image-name
run: |
IMAGE_NAME="almalinux-${{ inputs.version_major }}${{ inputs.arch == 'aarch64' && '-arm64' || '' }}-v${{ inputs.image_datetag }}"
echo "image_name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
- id: google-auth-image-release
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/1071098808632/locations/global/workloadIdentityPools/github-actions/providers/github
service_account: gh-actions-prod-release@almalinux-image-release.iam.gserviceaccount.com
- name: Set up Google Cloud SDK
uses: google-github-actions/setup-gcloud@v3.0.0
# TODO: re-enable this for prod
# - name: Copy image to almalinux-cloud project
# run: |
# gcloud storage cp gs://almalinux-images-dev/${{ steps.build-image-name.outputs.image_name }}/root.tar.gz gs://almalinux-images-prod/${{ steps.build-image-name.outputs.image_name }}/root.tar.gz
- name: Get gce_image_publish tool
run: |
wget https://storage.googleapis.com/compute-image-tools/release/linux/gce_image_publish
chmod +x gce_image_publish
# todo: this is the prod version
# - name: Create production image on GCP
# shell: bash
# run: |
# ./gce_image_publish \
# -var:environment=prod \
# -skip_confirmation \
# -rollout_rate=60 \
# -work_project="almalinux-dev-images-469421" \
# -source_gcs_path="gs://almalinux-images-prod/" \
# -source_version="${{ inputs.image_datetag }}" \
# vm-scripts/gcp/almalinux_${{ inputs.version_major }}${{ inputs.arch == 'aarch64' && '_arm64' || '' }}.publish.json
- name: Create production image on GCP
shell: bash
run: |
./gce_image_publish \
-var:environment=test \
-skip_confirmation \
-replace \
-rollout_rate=0 \
-work_project="almalinux-dev-images-469421" \
-source_gcs_path="gs://almalinux-images-prod/" \
-source_version="${{ inputs.image_datetag }}" \
vm-scripts/gcp/almalinux_${{ inputs.version_major }}${{ inputs.arch == 'aarch64' && '_arm64' || '' }}.publish.json