Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mount google-cloud-sdk into e2e image #1997

Merged
merged 1 commit into from
Mar 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

e2e image needs to run /google-cloud-sdk/bin/gcloud config config-helper to refresh the auth token when it expired, but the SDK is very large. we can use the SDK installed in CI image.

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 "$@"