diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 69ae392a70..964c4d3654 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -232,6 +232,10 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to Azure + uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0 + with: + creds: ${{ secrets.CONTRAST_IMAGES_CI_INFRA_AZURE }} - name: Bump flake version temporarily to release version uses: ./.github/actions/bump_version with: @@ -275,6 +279,8 @@ jobs: front=${nydusSnapshotterImg%@*} back=${nydusSnapshotterImg#*@} echo "nydusSnapshotterImgTagged=$(printf "%s:%s@%s" "$front" "$nydusVer" "$back")" | tee -a "$GITHUB_ENV" + - name: Upload peerpods images + run: nix run .#scripts.upload-release-image -- --version=${{ needs.process-inputs.outputs.WITHOUT_V }} - name: Create file with image replacements run: | { diff --git a/packages/scripts.nix b/packages/scripts.nix index 6c4a7c02f9..9bc419aa1d 100644 --- a/packages/scripts.nix +++ b/packages/scripts.nix @@ -20,7 +20,6 @@ name = "upload-image"; runtimeInputs = with pkgs; [ azure-cli - gnused uplosi ]; text = @@ -92,6 +91,59 @@ ''; }; + 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" + publisher = "edgelesssys" + offer = "contrast" + sku = "peer-pods" + + replicationRegions = ["northeurope", "westeurope", "eastus", "westus"] + EOF + + uplosi upload ${image}/*.raw + ''; + }; + generate = writeShellApplication { name = "generate"; runtimeInputs = with pkgs; [