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.
This commit is contained in:
committed by
Colin Percival
parent
fc83e6c5e1
commit
0a8ecca4e3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user