From afcd098c314b35265ea6253132029319e0535c6e Mon Sep 17 00:00:00 2001 From: pavish Date: Fri, 10 May 2024 12:20:42 +0530 Subject: [PATCH 1/2] Add workflow to reset demo --- .github/workflows/reset-demo.yml | 51 ++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 .github/workflows/reset-demo.yml diff --git a/.github/workflows/reset-demo.yml b/.github/workflows/reset-demo.yml new file mode 100644 index 0000000000..1849b0c393 --- /dev/null +++ b/.github/workflows/reset-demo.yml @@ -0,0 +1,51 @@ +name: Reset demo + +on: + push: + branches: + - master + workflow_dispatch: + schedule: + - cron: '1,10,30,55 6 * * *' + + +env: + PROJECT_ID: ${{ secrets.GKE_PROJECT_ID }} + GKE_CLUSTER: mathesar-demo + GKE_ZONE: us-central1 + + +jobs: + reset: + runs-on: ubuntu-latest + steps: + - name: Checkout branch + uses: actions/checkout@v4 + + - name: GCP login + uses: 'google-github-actions/auth@v0' + with: + credentials_json: '${{ secrets.GKE_DEMO_RESET_SA_KEY }}' + + - name: Set up GKE credentials + uses: 'google-github-actions/get-gke-credentials@v0' + with: + cluster_name: ${{ env.GKE_CLUSTER }} + location: ${{ env.GKE_ZONE }} + + - name: Delete existing demo deployment + run: kubectl delete deployments.apps demo-serve + + - name: Wait until all pods are removed + run: >- + attempts=10 + until [ $attempts -le 0 ] || [ -z "$(kubectl get pods)" ]; do + sleep 5 + attempts=$((attempts - 1)) + done + if [ $attempts -le 0 ]; then + return 1 + fi + + - name: Deploy demo + run: kubectl apply -f ./kubernetes_manifests/mathesar-demo.yml \ No newline at end of file From 78d674b63901d81c922cfc1ece58cf700796e396 Mon Sep 17 00:00:00 2001 From: pavish Date: Fri, 10 May 2024 12:26:18 +0530 Subject: [PATCH 2/2] Add more schedules to test cron job --- .github/workflows/reset-demo.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/reset-demo.yml b/.github/workflows/reset-demo.yml index 1849b0c393..7b7e895e31 100644 --- a/.github/workflows/reset-demo.yml +++ b/.github/workflows/reset-demo.yml @@ -6,7 +6,7 @@ on: - master workflow_dispatch: schedule: - - cron: '1,10,30,55 6 * * *' + - cron: '1,9,17,30,45 6,7,8 * * *' env: