git: 86b5e5bb7814 - stable/14 - GCE: Specify the architecture of images

From: Xin LI <delphij_at_FreeBSD.org>
Date: Mon, 29 Dec 2025 03:28:05 UTC
The branch stable/14 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=86b5e5bb7814f4f972dc29076969d06cd76567cb

commit 86b5e5bb7814f4f972dc29076969d06cd76567cb
Author:     Andrew Jorgensen <ajorgens@google.com>
AuthorDate: 2025-11-14 18:06:52 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2025-12-29 03:22:19 +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.
    
    (cherry picked from commit 0a8ecca4e3156bcd4ebbfcb24d968e67a3a09434)
---
 release/Makefile.gce | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/release/Makefile.gce b/release/Makefile.gce
index f67cc5da8d82..31bed380f56e 100644
--- a/release/Makefile.gce
+++ b/release/Makefile.gce
@@ -17,6 +17,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
@@ -76,6 +84,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