From 88cff38cd51ad611c67c6d5eed47f0090b96c930 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 15:19:25 +0100 Subject: [PATCH 1/4] feat(cd): scaffold infrastructure deployment workflow --- .github/workflows/deploy.yml | 58 ++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..1eb7ee7 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,58 @@ +name: Deploy Infrastructure + +# Deploy after CI succeeds on main, or allow manual execution. +on: + workflow_run: + workflows: [CI] + types: [completed] + branches: [main] + workflow_dispatch: + +# Prevent overlapping infrastructure deployments. +# Do not cancel an active deployment, since OpenTofu may be modifying resources. +concurrency: + group: infrastructure-deployment + cancel-in-progress: false + +permissions: + contents: read + +jobs: + deploy-test: + name: Deploy TEST + # Only deploy after successful CI on a push to main, + # or when manually triggered from main. + if: >- + (github.event_name == 'workflow_run' && + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'push' && + github.event.workflow_run.head_branch == 'main') || + (github.event_name == 'workflow_dispatch' && + github.ref == 'refs/heads/main') + + runs-on: [self-hosted, linux, assignment2] + timeout-minutes: 45 + environment: TEST + + steps: + # Checkout the exact commit validated by CI. + - name: Checkout + uses: actions/checkout@v5 + with: + ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} + persist-credentials: false + + # Use the same OpenTofu version as the CI workflow. + - name: Setup OpenTofu + uses: opentofu/setup-opentofu@v2 + with: + tofu_version: "1.12.6" + tofu_wrapper: false + + # Verify OpenTofu and TEST stack configurations are available. + # Actual deployment steps will be added after credentials are configured. + - name: Preflight checks + run: | + tofu version + test -f environments/test/network/providers.tf + test -f environments/test/frontend/providers.tf \ No newline at end of file From b66b92969abda217265cd2296a710ac949170922 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 16:54:17 +0100 Subject: [PATCH 2/4] feat(cd): configure TEST OpenStack credentials --- .github/workflows/deploy.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 1eb7ee7..21747d6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -34,6 +34,16 @@ jobs: timeout-minutes: 45 environment: TEST + # Authenticate to SkyHiGh using environment-specific credentials. + env: + OS_AUTH_TYPE: v3applicationcredential + OS_AUTH_URL: ${{ vars.OS_AUTH_URL }} + OS_REGION_NAME: ${{ vars.OS_REGION_NAME }} + OS_IDENTITY_API_VERSION: "3" + OS_INTERFACE: public + OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} + OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} + steps: # Checkout the exact commit validated by CI. - name: Checkout @@ -52,7 +62,15 @@ jobs: # Verify OpenTofu and TEST stack configurations are available. # Actual deployment steps will be added after credentials are configured. - name: Preflight checks + shell: bash run: | tofu version test -f environments/test/network/providers.tf - test -f environments/test/frontend/providers.tf \ No newline at end of file + test -f environments/test/frontend/providers.tf + + : "${OS_AUTH_URL:?Missing OS_AUTH_URL}" + : "${OS_REGION_NAME:?Missing OS_REGION_NAME}" + : "${OS_APPLICATION_CREDENTIAL_ID:?Missing application credential ID}" + : "${OS_APPLICATION_CREDENTIAL_SECRET:?Missing application credential secret}" + + echo "TEST deployment prerequisites are configured." \ No newline at end of file From 0fa894ced324eda353d9644fe01fc1724dd20fca Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:29:11 +0100 Subject: [PATCH 3/4] feat(cd): add Kubernetes tooling and kOps state verification --- .github/workflows/deploy.yml | 72 +++++++++++++++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 21747d6..3c0ee4e 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -44,6 +44,8 @@ jobs: OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.OS_APPLICATION_CREDENTIAL_ID }} OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.OS_APPLICATION_CREDENTIAL_SECRET }} + KOPS_STATE_STORE: swift://demo-kops + steps: # Checkout the exact commit validated by CI. - name: Checkout @@ -73,4 +75,72 @@ jobs: : "${OS_APPLICATION_CREDENTIAL_ID:?Missing application credential ID}" : "${OS_APPLICATION_CREDENTIAL_SECRET:?Missing application credential secret}" - echo "TEST deployment prerequisites are configured." \ No newline at end of file + echo "TEST deployment prerequisites are configured." + + # Install tools into the job's temporary directory. + - name: Install kOps and kubectl + shell: bash + run: | + set -euo pipefail + + BIN_DIR="$RUNNER_TEMP/tofu-tools" + mkdir -p "$BIN_DIR" + + # Kubernetes API server + KUBECTL_VERSION="v1.36.4" + + curl -fsSL -o "$BIN_DIR/kubectl" \ + "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" + + curl -fsSL -o "$BIN_DIR/kubectl.sha256" \ + "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl.sha256" + + ( + cd "$BIN_DIR" + echo "$(cat kubectl.sha256) kubectl" | sha256sum --check + ) + + # Download kOps and verify its checksum. + KOPS_VERSION="v1.36.2" + + curl -fsSL -o "$BIN_DIR/kops" \ + "https://github.com/kubernetes/kops/releases/download/${KOPS_VERSION}/kops-linux-amd64" + + curl -fsSL -o "$BIN_DIR/kops.sha256" \ + "https://github.com/kubernetes/kops/releases/download/${KOPS_VERSION}/kops-linux-amd64.sha256" + + ( + cd "$BIN_DIR" + echo "$(cat kops.sha256) kops" | sha256sum --check + ) + + chmod +x "$BIN_DIR/kubectl" "$BIN_DIR/kops" + + # Make both tools available to subsequent steps. + echo "$BIN_DIR" >> "$GITHUB_PATH" + + - name: Verify installed tools + shell: bash + run: | + kops version + kubectl version --client + + - name: Verify kOps state store access + shell: bash + env: + # Override TEST deployment credentials for this step only. + OS_APPLICATION_CREDENTIAL_ID: ${{ secrets.KOPS_APPLICATION_CREDENTIAL_ID }} + OS_APPLICATION_CREDENTIAL_SECRET: ${{ secrets.KOPS_APPLICATION_CREDENTIAL_SECRET }} + run: | + set -euo pipefail + + : "${OS_APPLICATION_CREDENTIAL_ID:?Missing kOps credential ID}" + : "${OS_APPLICATION_CREDENTIAL_SECRET:?Missing kOps credential secret}" + : "${KOPS_STATE_STORE:?Missing kOps state store}" + + kops get clusters --state="$KOPS_STATE_STORE" + + kops get cluster einalien.k8s.local \ + --state="$KOPS_STATE_STORE" > /dev/null + + echo "kOps state store access verified." \ No newline at end of file From e2af3d02b17a6ae4ad3564dae743b5328d92d413 Mon Sep 17 00:00:00 2001 From: eili1s <183522504+eili1s@users.noreply.github.com> Date: Sun, 1 Nov 2026 18:32:33 +0100 Subject: [PATCH 4/4] chore(runner): include Python dependencies for CI --- bootstrap/cloud_init/runner.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bootstrap/cloud_init/runner.yaml b/bootstrap/cloud_init/runner.yaml index fe47620..68f0f56 100644 --- a/bootstrap/cloud_init/runner.yaml +++ b/bootstrap/cloud_init/runner.yaml @@ -9,4 +9,6 @@ packages: - jq - tar - unzip - - libicu76 \ No newline at end of file + - libicu76 + - python3 + - python3-venv \ No newline at end of file