Skip to content

Commit f166b60

Browse files
navinsonishreyapandit
authored andcommitted
change: update code to get commit_id in codepipeline (#2961)
1 parent 26f2446 commit f166b60

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/scripts/run-notebook-test.sh

+8-1
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,15 @@ echo "$LIFECYCLE_CONFIG_CONTENT"
8181
8282
set -euo pipefail
8383
84+
# git doesn't work in codepipeline, use CODEBUILD_RESOLVED_SOURCE_VERSION to get commit id
85+
codebuild_initiator="${CODEBUILD_INITIATOR:-0}"
86+
if [ "${codebuild_initiator:0:12}" == "codepipeline" ]; then
87+
COMMIT_ID="${CODEBUILD_RESOLVED_SOURCE_VERSION}"
88+
else
89+
COMMIT_ID=$(git rev-parse --short HEAD)
90+
fi
91+
8492
ACCOUNT_ID=$(aws sts get-caller-identity --query Account --output text)
85-
COMMIT_ID=$(git rev-parse --short HEAD)
8693
LIFECYCLE_CONFIG_NAME="install-python-sdk-$COMMIT_ID"
8794
8895
python setup.py sdist

0 commit comments

Comments
 (0)