common images * common images resolve commit with --rebase * Remove bitbucket-pipelines.yml.orig Approved-by: Rachit Bhargava
84 lines
2.2 KiB
Bash
84 lines
2.2 KiB
Bash
#!/bin/bash
|
|
|
|
export DIR=`pwd`
|
|
exec > >(tee -a $DIR/script.log) 2>&1
|
|
|
|
function install {
|
|
|
|
# kubectl
|
|
# ----------------
|
|
curl -fsSLO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
|
|
chmod +x ./kubectl
|
|
mv ./kubectl /usr/local/bin/kubectl
|
|
# setenv
|
|
# -----------
|
|
. ./setenv.sh
|
|
|
|
# krew
|
|
# ---------
|
|
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" >> ~/.bashrc && . ~/.bashrc
|
|
|
|
# kubeval
|
|
# -------------------
|
|
curl -fsSLO https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-linux-amd64.tar.gz
|
|
tar xf kubeval-linux-amd64.tar.gz &&
|
|
cp kubeval /usr/local/bin
|
|
|
|
# kube-score
|
|
# ---------------
|
|
kubectl krew install score
|
|
|
|
}
|
|
|
|
install
|
|
|
|
default () {
|
|
|
|
cd $DIR/build
|
|
find . -type f -exec kubeval --ignore-missing-schemas '{}' \; | tee -a $DIR/script.log
|
|
|
|
find . -type f -exec kubectl score --output-format ci '{}' \; | tee -a $DIR/script.log
|
|
|
|
cat $DIR/script.log | egrep -v -i "script.log|warning|SQL|create mode|rewrite" | egrep -i "fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file|ERR" && exit 9 || echo VALIDATION_PASS_$opt
|
|
|
|
}
|
|
|
|
|
|
opt=$1
|
|
|
|
case $opt in
|
|
|
|
default)
|
|
|
|
default
|
|
;;
|
|
|
|
env)
|
|
|
|
env
|
|
;;
|
|
|
|
*)
|
|
echo "validation job shell script utility taking variables from env"
|
|
echo "Usage: $0 {default|env}"
|
|
|
|
esac
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# -------------------------------------------------------------------------------------------------------------------------------------------
|
|
#cat $DIR/script.log | egrep -v -i "script.log|warning|SQL|create mode|rewrite" | egrep -i "fail|fatal|exception|terminated|command not found|error|unexpected|cannot access|No such file|ERR" && exit 9 || echo VALIDATION_PASS_$opt
|
|
# --------------------------------------------------------------------------------------------
|
|
|