From 237d07eab2f94c6cfe69146c83c8d5215256f283 Mon Sep 17 00:00:00 2001 From: Andy Pack Date: Thu, 10 Nov 2022 22:13:50 +0000 Subject: [PATCH] stop deploying from admin script, straight from CI --- .github/workflows/ci.yml | 58 +++++++++++++++++++++++++++++++++++++--- admin.py | 8 +++--- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 703478a..0dafa98 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -163,7 +163,7 @@ jobs: # DEPLOY for setting up cloud API - name: Set up Cloud SDK - uses: google-github-actions/auth@v0.7.3 + uses: google-github-actions/auth@v1.0.0 with: credentials_json: '${{ secrets.GCP_SA_KEY }}' export_environment_variables: true @@ -178,29 +178,81 @@ jobs: run: gcloud app deploy dispatch.yaml --quiet # DEPLOY app engine service, -nb for skipping compile - - name: Deploy App Engine Service + - name: Copy Engine Main run: python admin.py app -nb + - name: Deploy App Engine + uses: google-github-actions/deploy-appengine@v0.8.0 ### MAIN FUNCTIONS # DEPLOY update_tag function - - name: Deploy update_tag Function + - name: Prepare update_tag Function run: python admin.py tag + - name: Deploy update_tag Function + uses: google-github-actions/deploy-cloud-functions@v0.10.1 + with: + name: update_tag + event_trigger_resource: projects/sarsooxyz/topics/update_tag + event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish + region: europe-west2 + runtime: python310 + timeout: 60 + env_vars: DEPLOY_DESTINATION=PROD # DEPLOY run_user_playlist function - name: Deploy run_user_playlist Function run: python admin.py playlist + - name: Deploy run_user_playlist Function + uses: google-github-actions/deploy-cloud-functions@v0.10.1 + with: + name: run_user_playlist + event_trigger_resource: projects/sarsooxyz/topics/run_user_playlist + event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish + region: europe-west2 + runtime: python310 + timeout: 60 + env_vars: DEPLOY_DESTINATION=PROD ### CRON FUNCTIONS # DEPLOY run_all_playlists function - name: Deploy run_all_playlists Function run: python admin.py playlist_cron + - name: Deploy run_all_playlists Function + uses: google-github-actions/deploy-cloud-functions@v0.10.1 + with: + name: run_all_playlists + event_trigger_resource: projects/sarsooxyz/topics/run_all_playlists + event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish + region: europe-west2 + runtime: python310 + timeout: 60 + env_vars: DEPLOY_DESTINATION=PROD # DEPLOY run_all_playlist_stats function - name: Deploy run_all_playlist_stats Function run: python admin.py playlist_stats_cron + - name: Deploy run_all_playlist_stats Function + uses: google-github-actions/deploy-cloud-functions@v0.10.1 + with: + name: run_all_playlist_stats + event_trigger_resource: projects/sarsooxyz/topics/run_all_playlist_stats + event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish + region: europe-west2 + runtime: python310 + timeout: 60 + env_vars: DEPLOY_DESTINATION=PROD # DEPLOY run_all_tags function - name: Deploy run_all_tags Function run: python admin.py tags_cron + - name: Deploy run_all_tags Function + uses: google-github-actions/deploy-cloud-functions@v0.10.1 + with: + name: run_all_tags + event_trigger_resource: projects/sarsooxyz/topics/run_all_tags + event_trigger_type: providers/cloud.pubsub/eventTypes/topic.publish + region: europe-west2 + runtime: python310 + timeout: 60 + env_vars: DEPLOY_DESTINATION=PROD diff --git a/admin.py b/admin.py index 1e1a7aa..4798559 100755 --- a/admin.py +++ b/admin.py @@ -141,8 +141,8 @@ class Admin(Cmd): self.compile_frontend() self.copy_main_file('api') - print('>> deploying app engine service') - subprocess.check_call('gcloud app deploy', shell=True) + # print('>> deploying app engine service') + # subprocess.check_call('gcloud app deploy', shell=True) def function_deploy(self, main, function_id): """Deploy Cloud Function, copy main file and initiate gcloud command @@ -153,8 +153,8 @@ class Admin(Cmd): """ self.copy_main_file(main) - print(f'>> deploying {function_id}') - self.deploy_function(function_id) + # print(f'>> deploying {function_id}') + # self.deploy_function(function_id) def do_tag(self, args): """