forked from jenkinsci/kubernetes-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kind.sh
executable file
·37 lines (33 loc) · 1.09 KB
/
kind.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
#!/usr/bin/env bash
set -euxo pipefail
cd $(dirname $0)
export PATH=$WORKSPACE_TMP:$PATH
if [ \! -x "$WORKSPACE_TMP/kind" ]
then
curl -sLo "$WORKSPACE_TMP/kind" https://github.com/kubernetes-sigs/kind/releases/download/v0.17.0/kind-$(uname | tr '[:upper:]' '[:lower:]')-amd64
chmod +x "$WORKSPACE_TMP/kind"
fi
if [ \! -x "$WORKSPACE_TMP/kubectl" ]
then
curl -sLo "$WORKSPACE_TMP/kubectl" https://storage.googleapis.com/kubernetes-release/release/v1.25.4/bin/$(uname | tr '[:upper:]' '[:lower:]')/amd64/kubectl
chmod +x "$WORKSPACE_TMP/kubectl"
fi
export cluster=ci$RANDOM
export KUBECONFIG="$WORKSPACE_TMP/kubeconfig-$cluster"
if ${MOUNT_M2:-false}
then
./kind-mount-m2.sh
else
kind create cluster --name $cluster --wait 5m
fi
function cleanup() {
kind export logs --name $cluster "$WORKSPACE_TMP/kindlogs" || :
kind delete cluster --name $cluster || :
rm "$KUBECONFIG"
}
trap cleanup EXIT
kubectl cluster-info
./kind-preload.sh
./test-in-k8s.sh "$@"
rm -rf "$WORKSPACE_TMP/surefire-reports"
kubectl cp jenkins:/checkout/target/surefire-reports "$WORKSPACE_TMP/surefire-reports"