4 # Make sure you set secret enviroment variables in CI
15 helm=$(curl -s https://github.com/helm/helm/releases)
16 helm=$(echo $helm\" |grep -oP '(?<=tag\/v)[0-9][^"]*'|grep -v \-|sort -Vr|head -1)
17 echo "helm version is $helm"
20 DEBIAN_FRONTEND=noninteractive
21 #sudo apt-get update && sudo apt-get -q -y install jq
22 curl -sL https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 -o jq
23 sudo mv jq /usr/bin/jq
24 sudo chmod +x /usr/bin/jq
27 kustomize_release=$(curl -s https://api.github.com/repos/kubernetes-sigs/kustomize/releases | /usr/bin/jq -r '.[].tag_name | select(contains("kustomize"))' \
28 | sort -rV | head -n 1)
29 kustomize_version=$(basename ${kustomize_release})
30 echo "kustomize version is $kustomize_version"
33 kubeseal_version=$(curl -s https://api.github.com/repos/bitnami-labs/sealed-secrets/releases | /usr/bin/jq -r '.[].tag_name | select(startswith("v"))' \
34 | sort -rV | head -n 1 |sed 's/v//')
35 echo "kubeseal version is $kubeseal_version"
37 docker build --no-cache \
38 --build-arg KUBECTL_VERSION=${tag} \
39 --build-arg HELM_VERSION=${helm} \
40 --build-arg KUSTOMIZE_VERSION=${kustomize_version} \
41 --build-arg KUBESEAL_VERSION=${kubeseal_version} \
45 echo "Detected Helm3+"
46 version=$(docker run --rm ${image}:${tag} helm version)
47 # version.BuildInfo{Version:"v3.6.3", GitCommit:"d506314abfb5d21419df8c7e7e68012379db2354", GitTreeState:"clean", GoVersion:"go1.16.5"}
49 version=$(echo ${version}| awk -F \" '{print $2}')
50 if [ "${version}" == "v${helm}" ]; then
57 if [[ "$CIRCLE_BRANCH" == "master" ]]; then
58 docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
59 docker push ${image}:${tag}
64 docker build --no-cache \
73 curl -s https://raw.githubusercontent.com/awsdocs/amazon-eks-user-guide/master/doc_source/kubernetes-versions.md |egrep -A 10 "The following Kubernetes versions"|awk -F \` '/^\+/ {print $2}'|sort -Vr | while read tag
76 status=$(curl -sL https://hub.docker.com/v2/repositories/${bimage}/tags/${tag})
78 if [[ ( "${status}" =~ "not found" ) || ( ${REBUILD} == "true" ) ]]; then
84 tag=$(awk -F '=' '/ARG\ KUBECTL_VERSION/{print $NF}' Dockerfile)