summary refs log tree commit diff
path: root/nixos/maintainers
diff options
context:
space:
mode:
authorAmineChikhaoui <amine@chikhaoui.org>2021-03-20 06:59:13 -0400
committerAmineChikhaoui <amine@chikhaoui.org>2021-03-21 14:04:09 -0400
commit606b49721f3b7a9240a0c736cb57bc36d180c705 (patch)
treec81bac0a70fd79e092decc65b92588a38bf65608 /nixos/maintainers
parentd00e4cd1feff75def05d1627abd95a5eccbdc0b9 (diff)
downloadnixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar.gz
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar.bz2
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar.lz
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar.xz
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.tar.zst
nixpkgs-606b49721f3b7a9240a0c736cb57bc36d180c705.zip
add new Google Cloud image for the current release
update the create-gce.sh script with the ability to create public images
out of a GS object.
Diffstat (limited to 'nixos/maintainers')
-rwxr-xr-xnixos/maintainers/scripts/gce/create-gce.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/nixos/maintainers/scripts/gce/create-gce.sh b/nixos/maintainers/scripts/gce/create-gce.sh
index 77cc64e591e..0eec4d04110 100755
--- a/nixos/maintainers/scripts/gce/create-gce.sh
+++ b/nixos/maintainers/scripts/gce/create-gce.sh
@@ -17,7 +17,19 @@ nix-build '<nixpkgs/nixos/lib/eval-config.nix>' \
 img_path=$(echo gce/*.tar.gz)
 img_name=${IMAGE_NAME:-$(basename "$img_path")}
 img_id=$(echo "$img_name" | sed 's|.raw.tar.gz$||;s|\.|-|g;s|_|-|g')
+img_family=$(echo "$img_id" | cut -d - -f1-4)
+
 if ! gsutil ls "gs://${BUCKET_NAME}/$img_name"; then
   gsutil cp "$img_path" "gs://${BUCKET_NAME}/$img_name"
   gsutil acl ch -u AllUsers:R "gs://${BUCKET_NAME}/$img_name"
+
+  gcloud compute images create \
+    "$img_id" \
+    --source-uri "gs://${BUCKET_NAME}/$img_name" \
+    --family="$img_family"
+
+  gcloud compute images add-iam-policy-binding \
+    "$img_id" \
+    --member='allAuthenticatedUsers' \
+    --role='roles/compute.imageUser'
 fi