Skip to content

Commit

Permalink
Mount google-cloud-sdk into e2e image
Browse files Browse the repository at this point in the history
  • Loading branch information
cofyc committed Mar 20, 2020
1 parent b62752b commit 119ab4e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
10 changes: 10 additions & 0 deletions hack/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ GCP_PROJECT=${GCP_PROJECT:-}
GCP_REGION=${GCP_REGION:-}
GCP_ZONE=${GCP_ZONE:-}
GCP_CREDENTIALS=${GCP_CREDENTIALS:-}
GCP_SDK=${GCP_SDK:-/google-cloud-sdk}
IMAGE_TAG=${IMAGE_TAG:-}
SKIP_IMAGE_LOAD=${SKIP_IMAGE_LOAD:-}
TIDB_OPERATOR_IMAGE=${TIDB_OPERATOR_IMAGE:-localhost:5000/pingcap/tidb-operator:latest}
Expand Down Expand Up @@ -370,6 +371,15 @@ elif [ "$PROVIDER" == "gke" ]; then
-v ${GCP_CREDENTIALS}:${GCP_CREDENTIALS}
--env GOOGLE_APPLICATION_CREDENTIALS=${GCP_CREDENTIALS}
)
# google-cloud-sdk is very large, we didn't pack it into our e2e image.
# instead, we use the sdk installed in CI image.
if [ ! -e "${GCP_SDK}/bin/gcloud" ]; then
echo "error: ${GCP_SDK} is not google cloud sdk, please install it here or specify correct path via GCP_SDK env"
exit 1
fi
docker_args+=(
-v ${GCP_SDK}:/google-cloud-sdk
)
else
e2e_args+=(
--provider=${PROVIDER}
Expand Down
3 changes: 3 additions & 0 deletions tests/images/e2e/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ ADD bin/e2e.test /usr/local/bin/
ADD bin/webhook /usr/local/bin/
ADD bin/blockwriter /usr/local/bin/
ADD bin/apiserver /usr/local/bin/

ADD entrypoint.sh /usr/local/bin
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
17 changes: 17 additions & 0 deletions tests/images/e2e/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash

set -e

# Add default command if no command provided or the first argument is an
# option.
if [ $# -lt 1 -o "${1:0:1}" = '-' ]; then
set -- /usr/local/bin/ginkgo "$@"
fi

# If google-cloud-sdk is detected, install it.
if [ -d /google-cloud-sdk ]; then
source /google-cloud-sdk/path.bash.inc
export CLOUDSDK_CORE_DISABLE_PROMPTS=1
fi

exec "$@"

0 comments on commit 119ab4e

Please sign in to comment.