Skip to content

Commit

Permalink
chore: Remove Helm v2 and update test component versions
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs committed Sep 23, 2024
1 parent 655ce0f commit 53a3144
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 46 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ clean:
help:
@grep -E '^[a-zA-Z_-]+:.*$$' $(MAKEFILE_LIST) | sort

.PHONY: all build test verify package publish draft-release help
.PHONY: all build test verify package publish draft-release help
25 changes: 8 additions & 17 deletions scripts/install-toolchain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@ TOOLS_DIR="${BUILD_DIR}/tools"
mkdir -p "${TOOLS_DIR}"
export PATH="${TOOLS_DIR}:${PATH}"

HELMV2_VERSION="v2.17.0"
HELMV3_VERSION="v3.6.3"
HELM_VERSION="v3.16.1"
KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)
KIND_VERSION=v0.11.1
BATS_VERSION=1.1.0
KIND_VERSION=v0.24.0
BATS_VERSION=1.11.0

## Install kubectl
curl -sSL "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/${PLATFORM}/${ARCH}/kubectl" -o "${TOOLS_DIR}/kubectl"
Expand All @@ -25,26 +24,18 @@ mkdir -p "${TMP_DIR}/kubeval"
curl -sSL https://github.com/instrumenta/kubeval/releases/latest/download/kubeval-${PLATFORM}-${ARCH}.tar.gz | tar xz -C "${TMP_DIR}/kubeval"
mv "${TMP_DIR}/kubeval/kubeval" "${TOOLS_DIR}/kubeval"

## Install helm v2
mkdir -p "${TMP_DIR}/helmv2"
curl -sSL https://get.helm.sh/helm-${HELMV2_VERSION}-${PLATFORM}-${ARCH}.tar.gz | tar xz -C "${TMP_DIR}/helmv2"
mv "${TMP_DIR}/helmv2/${PLATFORM}-${ARCH}/helm" "${TOOLS_DIR}/helmv2"
rm -rf "${PLATFORM}-${ARCH}"

## Install helm v3
mkdir -p "${TMP_DIR}/helmv3"
curl -sSL https://get.helm.sh/helm-${HELMV3_VERSION}-${PLATFORM}-${ARCH}.tar.gz | tar xz -C "${TMP_DIR}/helmv3"
mv "${TMP_DIR}/helmv3/${PLATFORM}-${ARCH}/helm" "${TOOLS_DIR}/helmv3"
## Install helm
mkdir -p "${TMP_DIR}/helm"
curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-${PLATFORM}-${ARCH}.tar.gz | tar xz -C "${TMP_DIR}/helm"
mv "${TMP_DIR}/helm/${PLATFORM}-${ARCH}/helm" "${TOOLS_DIR}/helm"
rm -rf "${PLATFORM}-${ARCH}"

## Install Bats
curl -sSL https://github.com/bats-core/bats-core/archive/v${BATS_VERSION}.tar.gz | tar xz -C "${TOOLS_DIR}"
ln -s ${TOOLS_DIR}/bats-core-${BATS_VERSION}/bin/bats ${TOOLS_DIR}/bats

## Initialize helm

helmv2 init --stable-repo-url https://charts.helm.sh/stable --client-only --kubeconfig="${BUILD_DIR}/.kube/kubeconfig"

helm init --stable-repo-url https://charts.helm.sh/stable --client-only --kubeconfig="${BUILD_DIR}/.kube/kubeconfig"

## Install kind
curl -sSL "https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-${PLATFORM}-${ARCH}" -o "${TOOLS_DIR}/kind"
Expand Down
19 changes: 6 additions & 13 deletions scripts/lint-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ TOOLS_DIR="${BUILD_DIR}/tools"
STABLE="${GIT_REPO_ROOT}/stable"
export PATH="${TOOLS_DIR}:${PATH}"

FAILED_V2=()
FAILED_V3=()
FAILED=()

cd ${STABLE}
for d in */; do
EXTRA_ARGS=""
if [ -f ${STABLE}/${d}/ci/extra_args ]; then
EXTRA_ARGS=$(cat ${STABLE}/${d}/ci/extra_args)
fi
echo "Linting chart ${d} w/ helm v3"
helmv3 lint ${STABLE}/${d} || FAILED_V3+=("${d}")
echo "Linting chart ${d} w/ helm v2"
helmv2 lint ${STABLE}/${d} || FAILED_V2+=("${d}")
echo "Linting chart ${d} w/ helm"
helm lint ${STABLE}/${d} || FAILED+=("${d}")
done

if [[ "${#FAILED_V2[@]}" -eq 0 ]] && [[ "${#FAILED_V3[@]}" -eq 0 ]]; then
if [[ "${#FAILED[@]}" -eq 0 ]]; then
echo "All charts passed linting!"
exit 0
else
echo "Helm v2:"
for chart in "${FAILED_V2[@]}"; do
printf "%40s ❌\n" "$chart"
done
echo "Helm v3:"
for chart in "${FAILED_V2[@]}"; do
echo "Helm linting failed:"
for chart in "${FAILED[@]}"; do
printf "%40s ❌\n" "$chart"
done
fi
2 changes: 1 addition & 1 deletion scripts/package-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export PATH="${TOOLS_DIR}:${PATH}"
PACKAGE_DIR="${GIT_REPO_ROOT}/build"
mkdir -p "${PACKAGE_DIR}"

helmv3 package "${STABLE}/"* --destination "${PACKAGE_DIR}/stable" --dependency-update
helm package "${STABLE}/"* --destination "${PACKAGE_DIR}/stable" --dependency-update
2 changes: 1 addition & 1 deletion scripts/publish-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if echo "${VERSION}" | grep -Eq "^v[0-9]+(\.[0-9]+){2}$"; then
git config pull.rebase false
git checkout gh-pages
mv -n $PACKAGE_DIR/stable/*.tgz .
helmv3 repo index . --url https://aws.github.io/eks-charts
helm repo index . --url https://aws.github.io/eks-charts
git add .
git commit -m "Publish stable charts ${VERSION}"
git push origin gh-pages
Expand Down
19 changes: 6 additions & 13 deletions scripts/validate-charts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,24 @@ TOOLS_DIR="${BUILD_DIR}/tools"
STABLE="${GIT_REPO_ROOT}/stable"
export PATH="${TOOLS_DIR}:${PATH}"

FAILED_V2=()
FAILED_V3=()
FAILED=()

cd ${STABLE}
for d in */; do
EXTRA_ARGS=""
if [ -f ${STABLE}/${d}/ci/extra_args ]; then
EXTRA_ARGS=$(cat ${STABLE}/${d}/ci/extra_args)
fi
echo "Validating chart ${d} w/ helm v3"
helmv3 template ${STABLE}/${d} ${EXTRA_ARGS}| kubeval --strict --ignore-missing-schemas || FAILED_V3+=("${d}")
echo "Validating chart ${d} w/ helm v2"
helm template ${STABLE}/${d} ${EXTRA_ARGS}| kubeval --strict --ignore-missing-schemas || FAILED_V2+=("${d}")
echo "Validating chart ${d} w/ helm"
helm template ${STABLE}/${d} ${EXTRA_ARGS}| kubeval --strict --ignore-missing-schemas || FAILED+=("${d}")
done

if [[ "${#FAILED_V2[@]}" -eq 0 ]] && [[ "${#FAILED_V3[@]}" -eq 0 ]]; then
if [[ "${#FAILED[@]}" -eq 0 ]]; then
echo "All charts passed validations!"
exit 0
else
echo "Helm v2:"
for chart in "${FAILED_V2[@]}"; do
printf "%40s ❌\n" "$chart"
done
echo "Helm v3:"
for chart in "${FAILED_V3[@]}"; do
echo "Helm validation failed:"
for chart in "${FAILED[@]}"; do
printf "%40s ❌\n" "$chart"
done
fi

0 comments on commit 53a3144

Please sign in to comment.