From eca7d0a6d370284ecb9ce8348edfe806c70045d4 Mon Sep 17 00:00:00 2001 From: zcain117 Date: Wed, 29 Jul 2020 15:35:32 -0700 Subject: [PATCH] Check CI_PULL_REQUEST and set GITHUB_REF accordingly. (#2741) --- .circleci/config.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ca0e7660c6..9d28743232 100755 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -40,9 +40,7 @@ references: # $CI_PULL_REQUEST seems to be of form: https://github.com/org/repo-name/pull/11. # Grab the last bit, e.g. pull/11, convert to pull/11/head, and use it # for the GITHUB_REF so Docker can pull the latest pending code in PR. - git_ref=$(echo "$CI_PULL_REQUEST" | sed "s/.*pytorch-lightning\///")/head - docker build --tag "$GCR_IMAGE_PATH:$CIRCLE_WORKFLOW_JOB_ID" -f Dockerfile --build-arg "TEST_IMAGE=1" --build-arg "GITHUB_REF=$git_ref" . - #docker build --tag "$IMAGE:$GITHUB_RUN_ID" -f Dockerfile --build-arg "GITHUB_REF=$GITHUB_REF" --build-arg "TEST_IMAGE=1" . + if [ -z "$CI_PULL_REQUEST" ]; then docker build --tag "$GCR_IMAGE_PATH:$CIRCLE_WORKFLOW_JOB_ID" -f Dockerfile --build-arg "TEST_IMAGE=1"; else git_ref=$(echo "$CI_PULL_REQUEST" | sed "s/.*pytorch-lightning\///")/head && docker build --tag "$GCR_IMAGE_PATH:$CIRCLE_WORKFLOW_JOB_ID" -f Dockerfile --build-arg "TEST_IMAGE=1" --build-arg "GITHUB_REF=$git_ref" .; fi docker push "$GCR_IMAGE_PATH:$CIRCLE_WORKFLOW_JOB_ID" deploy_cluster: &deploy_cluster