-
Notifications
You must be signed in to change notification settings - Fork 15
/
kuttl_test.sh
executable file
·37 lines (28 loc) · 1.08 KB
/
kuttl_test.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
#!/bin/bash
set -exv
mkdir -p /container_workspace/bin
export KUBEBUILDER_ASSETS=/container_workspace/testbin/bin
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl.sha256"
echo "$(cat kubectl.sha256) ./kubectl" | sha256sum --check
chmod +x kubectl
mv kubectl /container_workspace/bin
export PATH="/container_workspace/bin:$PATH"
# Install krew for kubectl
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
export PATH="/bins:$PATH"
# Install kuttl with krew
kubectl krew install kuttl
# Run kuttl tests
make kuttl
KUTTL_RESULT=$?
exit $KUTTL_RESULT