From b8c6d3004a35d7e01f3b0ddde7c9a7e532d2fb19 Mon Sep 17 00:00:00 2001 From: Tom Dohrmann Date: Tue, 29 Oct 2024 09:28:20 +0100 Subject: [PATCH] scripts: add upload-release-image --- packages/scripts.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/packages/scripts.nix b/packages/scripts.nix index ac201bd4cb..76c15d2d42 100644 --- a/packages/scripts.nix +++ b/packages/scripts.nix @@ -91,6 +91,54 @@ ''; }; + upload-release-image = writeShellApplication { + name = "upload-release-image"; + runtimeInputs = with pkgs; [ + azure-cli + uplosi + ]; + text = + let + image = pkgs.image-podvm; + in + '' + imageVersion="" + + for i in "$@"; do + case $i in + --version=*) + imageVersion="''${i#*=}" + shift + ;; + *) + echo "Unknown option $i" + exit 1 + ;; + esac + done + + set -x + + # Create an uplosi config. + cat < uplosi.conf + [base] + imageVersion = "''${imageVersion}" + name = "contrast" + provider = "azure" + + [base.azure] + subscriptionID = "0d202bbb-4fa7-4af8-8125-58c269a05435" + location = "GermanyWestCentral" + resourceGroup = "contrast-images" + sharedImageGallery = "contrast_images" + sharingProfile = "community" + sharingNamePrefix = "Contrast" + EOF + + uplosi upload ${image}/*.raw + ''; + }; + generate = writeShellApplication { name = "generate"; runtimeInputs = with pkgs; [