diff --git a/SubmitReverseProxy/ReverseProxy/authorize.py b/SubmitReverseProxy/ReverseProxy/authorize.py index 8e36349..8055b98 100644 --- a/SubmitReverseProxy/ReverseProxy/authorize.py +++ b/SubmitReverseProxy/ReverseProxy/authorize.py @@ -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 diff --git a/cicd/cloudbuild-develop-pr-srp.yaml b/cicd/cloudbuild-develop-pr-srp.yaml new file mode 100644 index 0000000..69b0b4e --- /dev/null +++ b/cicd/cloudbuild-develop-pr-srp.yaml @@ -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'] + + + diff --git a/cicd/cloudbuild-master-pr-srp.yaml b/cicd/cloudbuild-master-pr-srp.yaml new file mode 100644 index 0000000..69b0b4e --- /dev/null +++ b/cicd/cloudbuild-master-pr-srp.yaml @@ -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'] + + +