forked from jfrog/charts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathe2e-local-gke.sh
executable file
·50 lines (42 loc) · 1.18 KB
/
e2e-local-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
47
48
49
50
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
readonly IMAGE_TAG=${CHART_TESTING_TAG}
readonly IMAGE_REPOSITORY="releases-docker.jfrog.io/charts-ci"
readonly REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
# shellcheck source=test/common.sh
source "${REPO_ROOT}/test/common.sh"
run_ct_container() {
echo 'Running ct container...'
docker run --rm --interactive --detach --name ct \
--volume "$HOME/.config/gcloud:/root/.config/gcloud" \
--volume "$REPO_ROOT:/workdir" \
--workdir /workdir \
"$IMAGE_REPOSITORY:$IMAGE_TAG" \
cat
echo
}
connect_to_cluster() {
# copy and update kubeconfig file
docker cp "$HOME/.kube" ct:/root/.kube
# shellcheck disable=SC2086
docker_exec sed -i 's|'${HOME}'||g' /root/.kube/config
# Set to specified cluster
if [[ -e CLUSTER ]]; then
# shellcheck disable=SC1091
source CLUSTER
if [[ -n "${GKE_CLUSTER}" ]]; then
echo
docker_exec kubectl config use-context "${GKE_CLUSTER}"
echo
fi
fi
}
main() {
run_ct_container
trap cleanup EXIT
connect_to_cluster
install_charts
}
main