From b2f132e01dc26017cb1c1b57245b1da14f85968e Mon Sep 17 00:00:00 2001 From: Shuya Ma Date: Wed, 19 Jul 2023 12:49:59 -0700 Subject: [PATCH 1/2] fix CI --- .../downstream-builder/generate_downstream.sh | 10 +++++++--- .ci/containers/downstream-waiter/wait_for_commit.sh | 4 ++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.ci/containers/downstream-builder/generate_downstream.sh b/.ci/containers/downstream-builder/generate_downstream.sh index 57abca7b7828..f946f610a691 100755 --- a/.ci/containers/downstream-builder/generate_downstream.sh +++ b/.ci/containers/downstream-builder/generate_downstream.sh @@ -28,7 +28,7 @@ function clone_repo() { GH_REPO=terraform-google-conversion LOCAL_PATH=$GOPATH/src/github.com/GoogleCloudPlatform/terraform-google-conversion elif [ "$REPO" == "tf-oics" ]; then - if [ "$UPSTREAM_BRANCH" == "main"]; then + if [ "$UPSTREAM_BRANCH" == "main" ]; then UPSTREAM_BRANCH=master fi UPSTREAM_OWNER=terraform-google-modules @@ -48,7 +48,11 @@ function clone_repo() { mkdir -p "$(dirname $LOCAL_PATH)" echo "BASE_BRANCH: $BASE_BRANCH" - git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH + if [ "$REPO" == "tf-oics" ] && [ "$BASE_BRANCH" == "main" ]; then + git clone $GITHUB_PATH $LOCAL_PATH --branch master + else + git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH + fi } if [ $# -lt 4 ]; then @@ -236,4 +240,4 @@ if [ "$COMMITTED" == "true" ] && [ "$COMMAND" == "downstream" ]; then "https://api.github.com/repos/$UPSTREAM_OWNER/$GH_REPO/pulls/$NEW_PR_NUMBER/merge" fi -popd +popd \ No newline at end of file diff --git a/.ci/containers/downstream-waiter/wait_for_commit.sh b/.ci/containers/downstream-waiter/wait_for_commit.sh index f4a8e027422d..b59bde2a3698 100755 --- a/.ci/containers/downstream-waiter/wait_for_commit.sh +++ b/.ci/containers/downstream-waiter/wait_for_commit.sh @@ -10,7 +10,7 @@ SYNC_BRANCH_PREFIX=$1 BASE_BRANCH=$2 SHA=$3 -if [ "$BASE_BRANCH" == "main"]; then +if [ "$BASE_BRANCH" == "main" ]; then SYNC_BRANCH=$SYNC_BRANCH_PREFIX else SYNC_BRANCH=$SYNC_BRANCH_PREFIX-$BASE_BRANCH @@ -33,4 +33,4 @@ while true; do git fetch origin $SYNC_BRANCH fi sleep 5 -done +done \ No newline at end of file From 22f2f8f00796a79046284f8b5d886511c1dea309 Mon Sep 17 00:00:00 2001 From: Shuya Ma Date: Wed, 19 Jul 2023 14:26:20 -0700 Subject: [PATCH 2/2] update --- .ci/containers/downstream-builder/generate_downstream.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.ci/containers/downstream-builder/generate_downstream.sh b/.ci/containers/downstream-builder/generate_downstream.sh index f946f610a691..3c4eaf0c9bbe 100755 --- a/.ci/containers/downstream-builder/generate_downstream.sh +++ b/.ci/containers/downstream-builder/generate_downstream.sh @@ -48,11 +48,7 @@ function clone_repo() { mkdir -p "$(dirname $LOCAL_PATH)" echo "BASE_BRANCH: $BASE_BRANCH" - if [ "$REPO" == "tf-oics" ] && [ "$BASE_BRANCH" == "main" ]; then - git clone $GITHUB_PATH $LOCAL_PATH --branch master - else - git clone $GITHUB_PATH $LOCAL_PATH --branch $BASE_BRANCH - fi + git clone $GITHUB_PATH $LOCAL_PATH --branch $UPSTREAM_BRANCH } if [ $# -lt 4 ]; then