From 397a3d97df620fd219cdda19397294d22ab48f41 Mon Sep 17 00:00:00 2001 From: nate stemen Date: Tue, 3 Aug 2021 10:32:13 -0400 Subject: [PATCH] Merge pull request #4374 from overleaf/jpa-support-main-branch [misc] add support for main branch GitOrigin-RevId: 0720706674db329d7f1ddb8e829da076b86c75f8 --- services/web/Makefile | 2 ++ services/web/bin/cdn_upload | 6 +++--- services/web/bin/push-translations-changes.sh | 6 +++++- services/web/bin/sentry_upload | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/services/web/Makefile b/services/web/Makefile index 5edde09e7c..d513742bed 100644 --- a/services/web/Makefile +++ b/services/web/Makefile @@ -433,6 +433,7 @@ format_in_docker: IMAGE_CI ?= ci/$(PROJECT_NAME):$(BRANCH_NAME)-$(BUILD_NUMBER) IMAGE_REPO ?= gcr.io/overleaf-ops/$(PROJECT_NAME) IMAGE_REPO_BRANCH ?= $(IMAGE_REPO):$(BRANCH_NAME) +IMAGE_REPO_MAIN ?= $(IMAGE_REPO):main IMAGE_REPO_MASTER ?= $(IMAGE_REPO):master IMAGE_REPO_FINAL ?= $(IMAGE_REPO_BRANCH)-$(BUILD_NUMBER) @@ -441,6 +442,7 @@ export SENTRY_RELEASE ?= ${COMMIT_SHA} build_deps: docker build --pull \ --cache-from $(IMAGE_REPO_BRANCH)-deps \ + --cache-from $(IMAGE_REPO_MAIN)-deps \ --cache-from $(IMAGE_REPO_MASTER)-deps \ --tag $(IMAGE_REPO_BRANCH)-deps \ --target deps \ diff --git a/services/web/bin/cdn_upload b/services/web/bin/cdn_upload index 7644dbfaef..cdd3df2f50 100755 --- a/services/web/bin/cdn_upload +++ b/services/web/bin/cdn_upload @@ -44,8 +44,8 @@ function upload_into_bucket() { } -# Upload to staging CDN if branch is either 'master' or 'staging-master' -if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" ]]; then +# Upload to staging CDN if branch is either 'master' or 'staging-master' or main variants +if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" || "$BRANCH_NAME" == "main" || "$BRANCH_NAME" == "staging-main" ]]; then tar --directory=/tmp/ -xf build.tar # delete source maps @@ -53,7 +53,7 @@ if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "staging-master" ]]; then upload_into_bucket $CDN_STAG # Only upload to production CDN if branch is - if [[ "$BRANCH_NAME" == "master" ]]; then + if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "main" ]]; then upload_into_bucket $CDN_PROD fi fi diff --git a/services/web/bin/push-translations-changes.sh b/services/web/bin/push-translations-changes.sh index dbc7d9f173..6e0df59cd3 100755 --- a/services/web/bin/push-translations-changes.sh +++ b/services/web/bin/push-translations-changes.sh @@ -1,10 +1,14 @@ #!/bin/bash set -e +if [[ -z "$BRANCH_NAME" ]]; then + BRANCH_NAME=master +fi + if [[ `git status --porcelain=2 locales/` ]]; then git add locales/* git commit -m "auto update translation" - git push $UPSTREAM_REPO HEAD:master + git push "$UPSTREAM_REPO" "HEAD:$BRANCH_NAME" else echo 'No changes' fi diff --git a/services/web/bin/sentry_upload b/services/web/bin/sentry_upload index 6deff41d1e..412b6a5015 100755 --- a/services/web/bin/sentry_upload +++ b/services/web/bin/sentry_upload @@ -1,7 +1,7 @@ #!/bin/sh set -e -if [[ "$BRANCH_NAME" == "master" ]]; then +if [[ "$BRANCH_NAME" == "master" || "$BRANCH_NAME" == "main" ]]; then rm -rf sentry_upload mkdir sentry_upload tar --directory sentry_upload -xf build.tar