Skip to content

Commit 4c9358f

Browse files
kaustubhsardarrahul003
authored andcommitted
fixed an error in get-branch (aws#51)
* fixed an error in get-branch * fixed an error in get-branch
1 parent 344d5bc commit 4c9358f

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

config/get-branch.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ if [ "$CODEBUILD_GIT_BRANCH" = "" ] ; then
1414
fi
1515
SUBSTRING=$(echo $CODEBUILD_WEBHOOK_BASE_REF| cut -d'/' -f 3)
1616
BRANCH=''
17-
if [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_CREATED" ] || [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_REOPENED" ] || [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_UPDATED" ]; then
17+
if [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_CREATED" ] || [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_REOPENED" ] || [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_UPDATED" ] || [ "$CODEBUILD_WEBHOOK_EVENT" = "PULL_REQUEST_MERGED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PUSH" ]; then
1818
BRANCH=$SUBSTRING
1919

20-
elif [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_CREATED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_REOPENED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_UPDATED" ] && [ "$CODEBUILD_GIT_BRANCH" != "alpha" ] && [ "$CODEBUILD_GIT_BRANCH" != "master" ] ; then
20+
elif [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_CREATED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_REOPENED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_UPDATED" ] && [ "$CODEBUILD_WEBHOOK_EVENT" != "PULL_REQUEST_MERGED" ] && [ "$CODEBUILD_GIT_BRANCH" != "alpha" ] && [ "$CODEBUILD_GIT_BRANCH" != "master" ] ; then
21+
cd $CODEBUILD_SRC_DIR && git checkout $CODEBUILD_GIT_BRANCH
2122
if [ $(git merge-base --is-ancestor $CODEBUILD_GIT_BRANCH "alpha" ; echo $?) -eq 1 ]; then
2223
BRANCH='alpha'
2324

2425
elif [ $(git merge-base --is-ancestor $CODEBUILD_GIT_BRANCH "alpha" ; echo $?) -eq 0 ]; then
2526
BRANCH='master'
26-
27-
fi
28-
27+
28+
fi
29+
cd ..
30+
2931
else BRANCH=$CODEBUILD_GIT_BRANCH
3032
fi
3133

@@ -36,7 +38,7 @@ MXNET_BRANCH=$BRANCH ;
3638

3739

3840
if [ "$CODEBUILD_GIT_BRANCH" != "alpha" ] && [ "$CODEBUILD_GIT_BRANCH" != "master" ] ; then
39-
file="configure_branch_for_test.txt"
41+
file="config/configure_branch_for_test.txt"
4042
while IFS=: read -r repo_name default_or_branchname
4143
do
4244
if [ "$repo_name" = "$tf_repo" ] && [ "$default_or_branchname" != "default" ]; then
@@ -54,51 +56,49 @@ fi
5456

5557
cd $CODEBUILD_SRC_DIR && git checkout $CODEBUILD_GIT_BRANCH
5658
export CURRENT_COMMIT_HASH=$(git log -1 --pretty=%h);
57-
export CURRENT_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
59+
export CURRENT_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
5860
export CURRENT_REPO_NAME=$(basename `git rev-parse --show-toplevel`) ;
5961
export CURRENT_COMMIT_PATH="$CODEBUILD_SRC_DIR/wheels/$CURRENT_COMMIT_DATE/$CURRENT_REPO_NAME/$CURRENT_COMMIT_HASH"
62+
cd ..
6063

6164
if [ "$CURRENT_REPO_NAME" != "$core_repo" ]; then
62-
cd $CODEBUILD_SRC_DIR_tornasole_core && git checkout $CORE_BRANCH
65+
cd $CODEBUILD_SRC_DIR_tornasole_core && git checkout $CORE_BRANCH
6366
export CORE_REPO_NAME=$(basename `git rev-parse --show-toplevel`) ;
6467
export CORE_COMMIT_HASH=$(git log -1 --pretty=%h);
65-
export CORE_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
68+
export CORE_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
6669
export CORE_PATH="$CODEBUILD_SRC_DIR/wheels/$CORE_COMMIT_DATE/$CORE_REPO_NAME/$CORE_COMMIT_HASH"
6770
cd ..
6871
fi
6972

7073
if [ "$CURRENT_REPO_NAME" != "$rules_repo" ]; then
71-
cd $CODEBUILD_SRC_DIR_tornasole_rules && git checkout $RULES_BRANCH
74+
cd $CODEBUILD_SRC_DIR_tornasole_rules && git checkout $RULES_BRANCH
7275
export RULES_REPO_NAME=$(basename `git rev-parse --show-toplevel`) ;
7376
export RULES_COMMIT_HASH=$(git log -1 --pretty=%h);
74-
export RULES_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
77+
export RULES_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
7578
export RULES_PATH="$CODEBUILD_SRC_DIR/wheels/$RULES_COMMIT_DATE/$RULES_REPO_NAME/$RULES_COMMIT_HASH"
7679
cd ..
7780
fi
7881

7982
if [ "$CURRENT_REPO_NAME" != "$mxnet_repo" ]; then
80-
cd $CODEBUILD_SRC_DIR_tornasole_mxnet && git checkout $MXNET_BRANCH
83+
cd $CODEBUILD_SRC_DIR_tornasole_mxnet && git checkout $MXNET_BRANCH
8184
export MXNET_REPO_NAME=$(basename `git rev-parse --show-toplevel`) ;
8285
export MXNET_COMMIT_HASH=$(git log -1 --pretty=%h);
83-
export MXNET_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
86+
export MXNET_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
8487
export MXNET_PATH="$CODEBUILD_SRC_DIR/wheels/$MXNET_COMMIT_DATE/$MXNET_REPO_NAME/$MXNET_COMMIT_HASH"
8588
cd ..
8689
fi
8790

8891
if [ "$CURRENT_REPO_NAME" != "$tf_repo" ]; then
89-
cd $CODEBUILD_SRC_DIR_tornasole_tf && git checkout $TF_BRANCH
92+
cd $CODEBUILD_SRC_DIR_tornasole_tf && git checkout $TF_BRANCH
9093
export TF_REPO_NAME=$(basename `git rev-parse --show-toplevel`) ;
9194
export TF_COMMIT_HASH=$(git log -1 --pretty=%h);
92-
export TF_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
95+
export TF_COMMIT_DATE="$(git show -s --format=%ci | cut -d' ' -f 1)_$(git show -s --format=%ci | cut -d' ' -f 2)";
9396
export TF_PATH="$CODEBUILD_SRC_DIR/wheels/$TF_COMMIT_DATE/$TF_REPO_NAME/$TF_COMMIT_HASH"
9497
cd ..
9598
fi
9699

97-
98-
99100
export TF_BRANCH ;
100101
export CORE_BRANCH ;
101102
export RULES_BRANCH ;
102103
export MXNET_BRANCH ;
103104

104-

0 commit comments

Comments
 (0)