From ef30944daf5fb48f5854986a3deff1cad79aa35a Mon Sep 17 00:00:00 2001 From: ce0la Date: Tue, 23 Jul 2024 17:27:46 +0100 Subject: [PATCH] Add protected automated deployment to environments chore: Remove kubeconfig dependency (@gytis-ivaskevicius commit) chore: Add workflow for protected auto deployments (extra configuration done in repo > settings > environments) --- .github/workflows/deploy-env.yaml | 48 ++++++++++++++++++++ nix/cardano-services/deployments/default.nix | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy-env.yaml diff --git a/.github/workflows/deploy-env.yaml b/.github/workflows/deploy-env.yaml new file mode 100644 index 00000000000..55d5b3eea5e --- /dev/null +++ b/.github/workflows/deploy-env.yaml @@ -0,0 +1,48 @@ +name: Deploy Environment + +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to deploy to' + type: choice + required: true + default: 'ops-preview-1' + options: + options: + - ops-preview-1 + region: + description: 'Region containing cluster to deploy to' + type: choice + required: true + default: 'us-east-1' + options: + - us-east-1 + - us-east-2 + - eu-central-1 + +jobs: + deploy: + environment: ${{ inputs.environment }} + runs-on: ubuntu-latest + steps: + - name: 📥 Checkout repository + uses: actions/checkout@v3 + + - name: Install QEMU + run: sudo apt-get install -y qemu-user-static + + - name: 🧰 Setup Nix + uses: cachix/install-nix-action@v21 + with: + extra_nix_config: | + system = aarch64-linux + + - name: 🚀 Deploy + run: | + echo "${{ secrets.ENVRC }}" > .envrc + source .envrc + nix develop + nix run .#cardano-services.${{ inputs.environment }}@${{ inputs.region }}.status + nix run .#cardano-services.${{ inputs.environment }}@${{ inputs.region }}.plan + nix run .#cardano-services.${{ inputs.environment }}@${{ inputs.region }}.apply -y diff --git a/nix/cardano-services/deployments/default.nix b/nix/cardano-services/deployments/default.nix index 133a71eec87..0edfde23183 100644 --- a/nix/cardano-services/deployments/default.nix +++ b/nix/cardano-services/deployments/default.nix @@ -38,7 +38,7 @@ in name = "${final.namespace}-cardanojs"; chart = ./Chart.yaml; context = "eks-devs"; - kubeconfig = "$PRJ_ROOT/.kube/${final.region}"; + kubeconfig = ./../../local/kubeconfig + "/${final.region}"; utils = { mkPodEnv = lib.mapAttrsToList (