From f7ac2355c572f1d9b69d0a30e9bd85cfe7a6b1c4 Mon Sep 17 00:00:00 2001 From: Jake Adams Date: Thu, 11 Jul 2024 14:06:53 -0600 Subject: [PATCH] ci: update scheduler creation --- .github/workflows/push.yml | 60 ++++++++++++++------------------------ 1 file changed, 22 insertions(+), 38 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index d2ca10a..d97b8b9 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -103,25 +103,17 @@ jobs: - name: 🕰️ Create Cloud Scheduler run: | - if [ ! "$(gcloud scheduler jobs list --location=us-central1 | grep $SCHEDULE_NAME)" ]; then - gcloud scheduler jobs create pubsub $SCHEDULE_NAME \ - --description="$SCHEDULE_DESCRIPTION" \ - --schedule="$SCHEDULE_CRON" \ - --time-zone=America/Denver \ - --location=us-central1 \ - --topic=$SCHEDULE_NAME-topic \ - --message-body='{"run": "now"}' \ - --quiet - else - gcloud scheduler jobs update pubsub $SCHEDULE_NAME \ - --description="$SCHEDULE_DESCRIPTION" \ - --schedule="$SCHEDULE_CRON" \ - --time-zone=America/Denver \ - --location=us-central1 \ - --topic=$SCHEDULE_NAME-topic \ - --message-body='{"run": "now"}' \ - --quiet - fi + for i in $(gcloud scheduler jobs list --location=us-central1 --uri); do + gcloud scheduler jobs delete $i --quiet + done + gcloud scheduler jobs create pubsub $SCHEDULE_NAME \ + --description="$SCHEDULE_DESCRIPTION" \ + --schedule="$SCHEDULE_CRON" \ + --time-zone=America/Denver \ + --location=us-central1 \ + --topic=$SCHEDULE_NAME-topic \ + --message-body='{"run": "now"}' \ + --quiet deploy-prod: name: Deploy to GCF - prod @@ -177,25 +169,17 @@ jobs: - name: 🕰️ Create Cloud Scheduler run: | - if [ ! "$(gcloud scheduler jobs list --location=us-central1 | grep $SCHEDULE_NAME)" ]; then - gcloud scheduler jobs create pubsub $SCHEDULE_NAME \ - --description="$SCHEDULE_DESCRIPTION" \ - --schedule="$SCHEDULE_CRON" \ - --time-zone=America/Denver \ - --location=us-central1 \ - --topic=$SCHEDULE_NAME-topic \ - --message-body='{"run": "now"}' \ - --quiet - else - gcloud scheduler jobs update pubsub $SCHEDULE_NAME \ - --description="$SCHEDULE_DESCRIPTION" \ - --schedule="$SCHEDULE_CRON" \ - --time-zone=America/Denver \ - --location=us-central1 \ - --topic=$SCHEDULE_NAME-topic \ - --message-body='{"run": "now"}' \ - --quiet - fi + for i in $(gcloud scheduler jobs list --location=us-central1 --uri); do + gcloud scheduler jobs delete $i --quiet + done + gcloud scheduler jobs create pubsub $SCHEDULE_NAME \ + --description="$SCHEDULE_DESCRIPTION" \ + --schedule="$SCHEDULE_CRON" \ + --time-zone=America/Denver \ + --location=us-central1 \ + --topic=$SCHEDULE_NAME-topic \ + --message-body='{"run": "now"}' \ + --quiet - name: 🔔 Create deployment notification uses: agrc/service-now-worknote-action@v1