-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.sh
executable file
·56 lines (51 loc) · 1.3 KB
/
run.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
51
52
53
54
55
56
#!/bin/bash
set -euo pipefail
IFS=$'\n\t'
IMAGE_TAG="latest"
PULL_SETTINGS="always" #"always"|"missing"|"never"
TOOLBOX_DIR="$( cd "$(dirname "$0")" ; pwd -P )"
#functions
function startNewToolbox {
docker run -ti --rm \
--name toolbox \
-v ~/.kube:/root/.kube \
-v ~/.helm:/root/.helm \
-v ~/.ssh:/root/.ssh \
-v ${PWD}:/root/project \
-v ~/.gitconfig:/root/.gitconfig \
-v $TOOLBOX_DIR/.autoexec.sh:/root/.autoexec.sh \
-v ~/.aws:/root/.aws \
-v ~/.azure:/root/.azure \
-v ~/.config/gcloud:/root/.config/gcloud \
-v ~/ca-certificates:/usr/local/share/ca-certificates/extra \
-v /var/run/docker.sock:/var/run/docker.sock \
--env-file <(env | grep -i proxy) \
--pull $PULL_SETTINGS \
ksandermann/cloud-toolbox:$IMAGE_TAG \
/bin/zsh
}
function attachToToolbox {
docker exec -it toolbox /bin/bash
}
function testBinaries {
docker --version && \
yq --version && \
tcpping && \
helm version && \
kubectl version --client=true && \
crictl --version && \
terraform version && \
velero version --client-only && \
sentinel --version && \
kubelogin --version && \
stern --version && \
oc version --client && \
vault -version && \
gcloud version
}
if [[ "$(docker ps -a | grep toolbox)" ]]
then
attachToToolbox
else
startNewToolbox
fi