aboutsummaryrefslogtreecommitdiff
path: root/gcloud-image-publish.aww
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2022-06-30 01:44:12 +0700
committerShulhan <ms@kilabit.info>2022-08-05 00:02:10 +0700
commitcb31f4f3fd1a24b8268cca34f9bfefaf3b747a5d (patch)
treed4a2081f011c037bcc58a87aae9fd8a8c873034b /gcloud-image-publish.aww
parent015e2edf17ef7bdb7fd05a9f848c4747a62e7a6f (diff)
downloadcompute-archlinux-image-builder-cb31f4f3fd1a24b8268cca34f9bfefaf3b747a5d.tar.xz
all: add awwan scripts to deploy and test image
The gcloud-image-publish.aww is the script to publish the recently build image to gcloud and create new image. The gcloud-image-test.aww is the script to test the new image by creating new compute engine. The gcloud-test-image-official.aww is the script to test the official public image from Google. The gcloud-test-tail.aww is the script to get the serial log from test image in compute engine.
Diffstat (limited to 'gcloud-image-publish.aww')
-rw-r--r--gcloud-image-publish.aww27
1 files changed, 27 insertions, 0 deletions
diff --git a/gcloud-image-publish.aww b/gcloud-image-publish.aww
new file mode 100644
index 0000000..d16e0f8
--- /dev/null
+++ b/gcloud-image-publish.aww
@@ -0,0 +1,27 @@
+## Script to publish builded image to public.
+
+#require: gcloud config configurations activate {{.Val "gcloud::config"}}
+
+gsutil cp {{.Val "host::image"}}.tar.gz gs://arch-builder-a/image/
+
+gcloud compute images delete {{.Val "host::image"}} --quiet || exit 0
+
+gcloud compute images create {{.Val "host::image"}} \
+ --source-uri=gs://arch-builder-a/image/{{.Val "host::image"}}.tar.gz \
+ --family=arch \
+ --guest-os-features=GVNIC,UEFI_COMPATIBLE,VIRTIO_SCSI_MULTIQUEUE \
+ --description="Arch linux image with ops-agent. See https://github.com/shuLhan/compute-archlinux-image-builder"
+
+gcloud compute images list --no-standard-images
+gcloud compute images describe {{.Val "host::image"}}
+
+## Share the image publicly with authenticated users.
+
+gcloud compute images add-iam-policy-binding {{.Val "host::image"}} \
+ --member='allAuthenticatedUsers' \
+ --role='roles/compute.imageUser'
+
+## Delete the image on storage.
+
+gsutil rm -a gs://arch-builder-a/image/**
+gsutil ls gs://arch-builder-a/