From f74d46275a90fb9679ae4b066fdcdd206dfb7b66 Mon Sep 17 00:00:00 2001 From: Spencer Dixon Date: Fri, 22 Nov 2024 10:17:01 +0000 Subject: [PATCH] Testing kubectl in workflow --- .github/workflows/actions/deploy/action.yml | 24 ++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions/deploy/action.yml b/.github/workflows/actions/deploy/action.yml index dfd7c25b8a..ec12bae204 100644 --- a/.github/workflows/actions/deploy/action.yml +++ b/.github/workflows/actions/deploy/action.yml @@ -44,9 +44,11 @@ runs: tf_vars_file=terraform/aks/config/${{ inputs.environment }}.tfvars.json terraform_version=$(awk '/{/{f=/^terraform/;next}f' terraform/aks/terraform.tf | grep -o [0-9\.]*) cluster=$(jq -r '.cluster' ${tf_vars_file}) + namespace=$(jq -r '.namespace' ${tf_vars_file}) appenv=$(jq -r '.environment' ${tf_vars_file}) cluster_domain=".${cluster}" echo "TERRAFORM_VERSION=$terraform_version" >> $GITHUB_ENV + echo "NAMESPACE=$namespace" >> $GITHUB_ENV case ${{ inputs.environment }} in review) @@ -94,8 +96,24 @@ runs: HTTPAUTH_PASSWORD: ${{ steps.fetch-secrets.outputs.HTTP_PASSWORD }} HTTPAUTH_USERNAME: ${{ steps.fetch-secrets.outputs.HTTP_USERNAME }} - - name: Track Page Modifications + - name: Print Deployed Pods shell: bash run: | - POD_NAME=$(kubectl get pods -n git-${{ inputs.environment }} -l app=get-into-teaching-${{ inputs.environment }} -o jsonpath='{.items[0].metadata.name}') - kubectl exec -n git-${{ inputs.environment }} $POD_NAME -- bundle exec rails runner "TrackPageModificationsJob.perform_later(host: '${{steps.variables.outputs.healthcheck}}')" \ No newline at end of file + case ${{ inputs.environment }} in + review) + CLUSTER_NAME="s189t01-tsc-test-aks" + RESOURCE_GROUP="s189t01-tsc-ts-rg" + ;; + production) + CLUSTER_NAME="s189p01-tsc-production-aks" + RESOURCE_GROUP="s189p01-tsc-pd-rg" + ;; + *) + CLUSTER_NAME="s189t01-tsc-test-aks" + RESOURCE_GROUP="s189t01-tsc-ts-rg" + ;; + esac + + az aks get-credentials --resource-group $RESOURCE_GROUP --name $CLUSTER_NAME --overwrite-existing + kubelogin convert-kubeconfig -l spn + kubectl get pods -n ${{ env.NAMESPACE }} \ No newline at end of file