Add an action to find new versions of helm charts (#184)

Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
kfox1111
2023-04-25 10:04:38 +02:00
committed by GitHub
co-authored by Marco Franssen
parent 2c360a50fd
commit 17d62f1246
8 changed files with 101 additions and 3 deletions
+17
View File
@@ -0,0 +1,17 @@
[
{
"name": "kube-prometheus-stack",
"repo": "https://prometheus-community.github.io/helm-charts",
"version": "45.10.1"
},
{
"name": "cert-manager",
"repo": "https://charts.jetstack.io",
"version": "v1.11.1"
},
{
"name": "ingress-nginx",
"repo": "https://kubernetes.github.io/ingress-nginx",
"version": "4.6.0"
}
]
+6
View File
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
REPOS=$(jq -r '.[] | "export " + ("HELM_REPO_" + .name | ascii_upcase | gsub("-";"_")) + "=" + .repo' .github/tests/charts.json)
VERSIONS=$(jq -r '.[] | "export " + ("VERSION_" + .name | ascii_upcase | gsub("-";"_")) + "=" + .version' .github/tests/charts.json)
eval "$REPOS"
eval "$VERSIONS"
+1 -1
View File
@@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
helm install kube-prometheus-stack kube-prometheus-stack --version 45.7.1 --repo https://prometheus-community.github.io/helm-charts -n "$scenario" --wait helm install kube-prometheus-stack kube-prometheus-stack --version $VERSION_KUBE_PROMETHEUS_STACK --repo $HELM_REPO_KUBE_PROMETHEUS_STACK -n "$scenario" --wait
@@ -1,4 +1,4 @@
#!/usr/bin/env bash #!/usr/bin/env bash
helm install ingress-nginx ingress-nginx --version 4.5.2 --repo https://kubernetes.github.io/ingress-nginx -n "$scenario" --set controller.extraArgs.enable-ssl-passthrough= helm install ingress-nginx ingress-nginx --version "$VERSION_INGRESS_NGINX" --repo "$HELM_REPO_INGRESS_NGINX" -n "$scenario" --set controller.extraArgs.enable-ssl-passthrough=
kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller -n "$scenario" kubectl wait --namespace ingress-nginx --for=condition=ready pod --selector=app.kubernetes.io/component=controller -n "$scenario"
@@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
helm install cert-manager cert-manager --namespace cert-manager --create-namespace --version v1.11.0 --set installCRDs=true --repo https://charts.jetstack.io --wait helm install cert-manager cert-manager --namespace cert-manager --create-namespace --version "$VERSION_CERT_MANAGER" --set installCRDs=true --repo "$HELM_REPO_CERT_MANAGER" --wait
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
kubectl apply -f $SCRIPT_DIR/cert-manager-ca.yaml -n "$scenario" kubectl apply -f $SCRIPT_DIR/cert-manager-ca.yaml -n "$scenario"
+49
View File
@@ -0,0 +1,49 @@
name: Check versions
on:
schedule:
- cron: '0 8 * * 1'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
HELM_VERSION: v3.11.1
jobs:
check-helm-chart-versions:
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Helm
uses: azure/[email protected]
with:
version: ${{ env.HELM_VERSION }}
- name: Update test chart versions
run: |
./.github/workflows/scripts/update-versions.sh
git diff
- name: Create Pull Request
id: cpr
uses: peter-evans/[email protected]
with:
title: Bump test chart dependencies
branch: bump-test-chart-deps
commit-message: Bump test chart dependencies
body: Bump the Helm charts used in test scenarios to latest available versions.
signoff: true
add-paths: |
.github/tests
- name: Check outputs
if: ${{ steps.cpr.outputs.pull-request-number }}
run: 'echo "::notice title=PR #${{ steps.cpr.outputs.pull-request-number }}::${{ steps.cpr.outputs.pull-request-url }}"'
+2
View File
@@ -199,6 +199,8 @@ jobs:
export scenario="$(basename "${TEST_DIR}")" export scenario="$(basename "${TEST_DIR}")"
export EXTRA_HELM_ARGS="" export EXTRA_HELM_ARGS=""
source .github/tests/charts.sh
[ "${scenario}" != "default" ] && kubectl create namespace "${scenario}" [ "${scenario}" != "default" ] && kubectl create namespace "${scenario}"
[ -x "${TEST_DIR}/pre-install.sh" ] && "${TEST_DIR}/pre-install.sh" [ -x "${TEST_DIR}/pre-install.sh" ] && "${TEST_DIR}/pre-install.sh"
[ -f "${TEST_DIR}/.env" ] && source "${TEST_DIR}/.env" [ -f "${TEST_DIR}/.env" ] && source "${TEST_DIR}/.env"
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
CHARTJSON=$SCRIPTPATH/../../tests/charts.json
jq -r ".[].name" "${CHARTJSON}" | while read -r CHART; do
ENTRYQUERY='.[] | select(.name == "'$CHART'")'
REPO_URL="$(jq -r "$ENTRYQUERY | .repo" "${CHARTJSON}")"
VERSION="$(jq -r "$ENTRYQUERY | .version" "${CHARTJSON}")"
echo Processing: ${CHART}
echo " repo: $REPO_URL"
echo " current version: $VERSION"
helm repo add "$CHART" "$REPO_URL" > /dev/null
helm repo update "$CHART" > /dev/null
LATEST_VERSION=$(helm search repo --regexp "$CHART/$CHART\v" -o json | jq -r '.[0].version')
echo " latest version: $LATEST_VERSION"
if [ "x$VERSION" != "x$LATEST_VERSION" ]; then
echo " New version found!"
jq "( $ENTRYQUERY ).version |= "'"${LATEST_VERSION}"' "${CHARTJSON}" > /tmp/$$
mv /tmp/$$ "${CHARTJSON}"
fi
done