From 26b15fcda45a35e305de0429b9068fb1780b4540 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Mon, 11 Nov 2024 16:19:23 +0100 Subject: [PATCH] wip: basic test for peerpods --- .github/workflows/e2e_peerpods.yml | 38 ++++++++++++++++++++++++++++++ justfile | 4 ++-- packages/scripts.nix | 10 ++++++++ packages/test-peerpods.sh | 36 ++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/e2e_peerpods.yml create mode 100644 packages/test-peerpods.sh diff --git a/.github/workflows/e2e_peerpods.yml b/.github/workflows/e2e_peerpods.yml new file mode 100644 index 000000000..0862959f0 --- /dev/null +++ b/.github/workflows/e2e_peerpods.yml @@ -0,0 +1,38 @@ +name: e2e peer-pods + +on: + workflow_dispatch: + pull_request: + +jobs: + recreate: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: ./.github/actions/setup_nix + with: + githubToken: ${{ secrets.GITHUB_TOKEN }} + cachixToken: ${{ secrets.CACHIX_AUTH_TOKEN }} + - name: Login to Azure + uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0 + with: + creds: ${{ secrets.CONTRAST_CI_INFRA_AZURE }} + - name: Cleanup .azure dir + run: | + rm "$HOME/.azure/{commandIndex.json,versionCheck.json}" + - id: resourcegroup + working-directory: contrast + run: | + echo "rg=contrastpp$RANDOM" >> "$GITHUB_OUTPUT" + - name: Test peer-pods + run: | + export azure_resource_group="${{ steps.kataversion.outputs.rg }}" + nix run .#scripts.test-peerpods + - name: Test peer-pods + run: | + export azure_resource_group="${{ steps.kataversion.outputs.rg }}" + nix run .#scripts.test-peerpods + - name: Terminate cluster + if: always() + run: | + az group delete --name "${{ steps.kataversion.outputs.rg }}_caa_cluster" --yes diff --git a/justfile b/justfile index 4e4569459..1dbca06ff 100644 --- a/justfile +++ b/justfile @@ -201,7 +201,7 @@ create platform=default_platform: echo "subscription_id = \"$azure_subscription_id\"" >> infra/azure-peerpods/just.auto.tfvars nix run -L .#terraform -- -chdir=infra/azure-peerpods init - nix run -L .#terraform -- -chdir=infra/azure-peerpods apply + nix run -L .#terraform -- -chdir=infra/azure-peerpods apply --auto-approve ;; *) echo "Unsupported platform: {{ platform }}" @@ -330,7 +330,7 @@ destroy platform=default_platform: : ;; "AKS-PEER-SNP") - nix run -L .#terraform -- -chdir=infra/azure-peerpods destroy + nix run -L .#terraform -- -chdir=infra/azure-peerpods destroy --auto-approve # Clean-up cached image ids. rm -f ${CONTRAST_CACHE_DIR}/image-upload/*.image-id diff --git a/packages/scripts.nix b/packages/scripts.nix index 830181a10..2e834857c 100644 --- a/packages/scripts.nix +++ b/packages/scripts.nix @@ -511,4 +511,14 @@ ]; text = builtins.readFile ./cleanup-images.sh; }; + + test-peerpods = writeShellApplication { + name = "test-peerpods"; + runtimeInputs = with pkgs; [ + just + azure-cli + kubectl + ]; + text = builtins.readFile ./test-peerpods.sh; + }; } diff --git a/packages/test-peerpods.sh b/packages/test-peerpods.sh new file mode 100644 index 000000000..64e41c8d4 --- /dev/null +++ b/packages/test-peerpods.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash +# Copyright 2024 Edgeless Systems GmbH +# SPDX-License-Identifier: AGPL-3.0-only + +set -euo pipefail + +# just create AKS-PEER-SNP +# just get-credentials AKS-PEER-SNP +# just node-installer AKS-PEER-SNP + +cat <