Skip to content

Commit

Permalink
Merge pull request #153 from arXiv/gcp-cd-arxiv-development
Browse files Browse the repository at this point in the history
Gcp cd arxiv development
  • Loading branch information
mnazzaro authored Feb 14, 2024
2 parents 725c010 + be1a003 commit c5177b1
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 1 deletion.
2 changes: 1 addition & 1 deletion SubmitReverseProxy/ReverseProxy/authorize.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def is_editor (user_id: int) -> bool:

def is_moderator (user_id: int) -> bool:
conn = current_session().connection()
query = text("SELECT user_id FROM arxiv_moderators WHERE user_id=:user_id") \
query = text("SELECT user_id FROM arXiv_moderators WHERE user_id=:user_id") \
.bindparams(user_id=user_id)
return conn.execute(query).scalar() is not None

Expand Down
39 changes: 39 additions & 0 deletions cicd/cloudbuild-develop-pr-srp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest || echo "need a :latest because we use it for cache-from" && exit 0']
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest'
- '-t'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest'
- './SubmitReverseProxy/'
- name: 'gcr.io/cloud-builders/docker'
args:
- push
- '--all-tags'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy'
id: Push
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- services
- update
- $_SERVICE_NAME
- '--platform=managed'
- >-
--image=gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA
- >-
--labels=commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID
- '--region=$_DEPLOY_REGION'
- '--quiet'
id: Deploy
entrypoint: gcloud
images: ['gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest', 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA']



39 changes: 39 additions & 0 deletions cicd/cloudbuild-master-pr-srp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
steps:
- name: 'gcr.io/cloud-builders/docker'
entrypoint: 'bash'
args: ['-c', 'docker pull gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest || echo "need a :latest because we use it for cache-from" && exit 0']
- name: 'gcr.io/cloud-builders/docker'
args:
- 'build'
- '--cache-from'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest'
- '-t'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA'
- '-t'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest'
- './SubmitReverseProxy/'
- name: 'gcr.io/cloud-builders/docker'
args:
- push
- '--all-tags'
- 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy'
id: Push
- name: 'gcr.io/google.com/cloudsdktool/cloud-sdk:slim'
args:
- run
- services
- update
- $_SERVICE_NAME
- '--platform=managed'
- >-
--image=gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA
- >-
--labels=commit-sha=$COMMIT_SHA,gcb-build-id=$BUILD_ID,gcb-trigger-id=$_TRIGGER_ID
- '--region=$_DEPLOY_REGION'
- '--quiet'
id: Deploy
entrypoint: gcloud
images: ['gcr.io/$PROJECT_ID/html-submit-reverse-proxy:latest', 'gcr.io/$PROJECT_ID/html-submit-reverse-proxy:$COMMIT_SHA']



0 comments on commit c5177b1

Please sign in to comment.