forked from jfrog/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
e2e-gke.sh
executable file
·46 lines (37 loc) · 1.21 KB
/
e2e-gke.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
readonly REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
# shellcheck source=test/common.sh
source "${REPO_ROOT}/test/common.sh"
get_creds() {
# shellcheck disable=SC2086
echo $GCLOUD_SERVICE_KEY_CHARTS_CI | base64 --decode -i > $REPO_ROOT/gcloud-service-key.json
# shellcheck disable=SC2086
echo $GCLOUD_GKE_CLUSTER | base64 --decode -i > $REPO_ROOT/gke_cluster
# shellcheck disable=SC1090,SC2086
source $REPO_ROOT/gke_cluster
}
run_ct_container() {
echo 'Running ct container...'
docker rm -f ct || true
docker run --rm --interactive --detach --name ct \
--volume "$REPO_ROOT/gcloud-service-key.json:/gcloud-service-key.json" \
--volume "$REPO_ROOT:/workdir" \
"$CHART_TESTING_IMAGE:$CHART_TESTING_TAG" \
cat
echo
}
connect_to_cluster() {
docker_exec gcloud auth activate-service-account --key-file /gcloud-service-key.json
docker_exec gcloud container clusters get-credentials "$CLUSTER_NAME" --project "$PROJECT_NAME" --region "$CLOUDSDK_COMPUTE_REGION"
}
main() {
get_creds
run_ct_container
trap cleanup EXIT
connect_to_cluster
install_charts
}
main