git: 0a8ecca4e315 - main - GCE: Specify the architecture of images
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 15 Nov 2025 14:50:35 UTC
The branch main has been updated by cperciva:
URL: https://cgit.FreeBSD.org/src/commit/?id=0a8ecca4e3156bcd4ebbfcb24d968e67a3a09434
commit 0a8ecca4e3156bcd4ebbfcb24d968e67a3a09434
Author: Andrew Jorgensen <ajorgens@google.com>
AuthorDate: 2025-11-14 18:06:52 +0000
Commit: Colin Percival <cperciva@FreeBSD.org>
CommitDate: 2025-11-15 14:45:46 +0000
GCE: Specify the architecture of images
Without a specified architecture, a user can attempt to create an
arm64 instance with an amd64 image or vice versa. With the change
the API will prevent that mismatch.
---
release/Makefile.gce | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/release/Makefile.gce b/release/Makefile.gce
index a6d09de468c0..21df4ddbc3f5 100644
--- a/release/Makefile.gce
+++ b/release/Makefile.gce
@@ -15,6 +15,14 @@ CLEANFILES+= ${GCE_UPLOAD_TGTS}
GCE_BUCKET?=
GCE_LICENSE?=
+.if ${TARGET_ARCH} == "amd64"
+GCE_ARCH= X86_64
+.elif ${TARGET_ARCH} == "aarch64"
+GCE_ARCH= ARM64
+.else
+.error "Unsupported TARGET_ARCH for GCE: ${TARGET_ARCH}. Must be amd64 or aarch64."
+.endif
+
.if !defined(GCE_FAMILY) || empty(GCE_FAMILY)
GCE_FAMILY= ${TYPE:tl}-${REVISION:S,.,-,}-${TARGET}
.endif
@@ -74,6 +82,7 @@ gce-do-upload-${_FS}:
/usr/local/bin/gsutil cp ${.OBJDIR}/${GCE_TARGET_${_FS}}.tar.gz \
gs://${GCE_BUCKET}/
/usr/local/bin/gcloud compute images create ${GCE_TARGET_${_FS}} \
+ --architecture=${GCE_ARCH} \
--family=${GCE_FAMILY}-${_FS}${GCE_FAMILY_SUFX} ${GCE_LICENSE} \
--guest-os-features=GVNIC,UEFI_COMPATIBLE \
--source-uri gs://${GCE_BUCKET}/${GCE_TARGET_${_FS}}.tar.gz