From f20e4dd5bc9bee07db884fcba6fdfc234735ecf6 Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Wed, 27 Feb 2019 14:39:29 -0500 Subject: [PATCH 1/2] Support PRs in clone script --- .cirrus.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 51fb814e..2c1df633 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -5,9 +5,14 @@ docker_builder: matrix: DEVICE: beta DEVICE: micro - clone_script: - - git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR - - git reset --hard $CIRRUS_CHANGE_IN_REPO + clone_script: > + if [ "$CIRRUS_PR" != "" ]; then + git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR + else + git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR + git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR + fi + git reset --hard $CIRRUS_CHANGE_IN_REPO make_script: ./makefiles/docker-make.sh DEVICE=$DEVICE test_script: ./makefiles/docker-make.sh DEVICE=$DEVICE test release_script: > From f2db3451c0d8900ff8076bcd4002d4c6a5edf02a Mon Sep 17 00:00:00 2001 From: Fedor Korotkov Date: Wed, 27 Feb 2019 14:45:20 -0500 Subject: [PATCH 2/2] Cleaner if statement --- .cirrus.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index 2c1df633..8c0c027c 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -6,13 +6,14 @@ docker_builder: DEVICE: beta DEVICE: micro clone_script: > - if [ "$CIRRUS_PR" != "" ]; then + if [[ -z "$CIRRUS_PR" ]]; then git clone --recursive --branch=$CIRRUS_BRANCH https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR + git reset --hard $CIRRUS_CHANGE_IN_REPO else git clone --recursive https://x-access-token:${CIRRUS_REPO_CLONE_TOKEN}@github.com/${CIRRUS_REPO_FULL_NAME}.git $CIRRUS_WORKING_DIR git fetch origin pull/$CIRRUS_PR/head:pull/$CIRRUS_PR + git reset --hard $CIRRUS_CHANGE_IN_REPO fi - git reset --hard $CIRRUS_CHANGE_IN_REPO make_script: ./makefiles/docker-make.sh DEVICE=$DEVICE test_script: ./makefiles/docker-make.sh DEVICE=$DEVICE test release_script: >