From 04f48ea384d1cdc303da37ceb415afb5522cae9e Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Fri, 26 Mar 2021 12:58:40 +0100 Subject: [PATCH] docs: Update upgrade v2.19 documentation --- docs/Upgrade-2.19.md | 5 ++++- scripts/git-pre-receive-hook.sh | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) create mode 100644 scripts/git-pre-receive-hook.sh diff --git a/docs/Upgrade-2.19.md b/docs/Upgrade-2.19.md index 5aed758e..9029dbad 100644 --- a/docs/Upgrade-2.19.md +++ b/docs/Upgrade-2.19.md @@ -37,6 +37,9 @@ This change was required to enable node restrictions via the upstream aws-iam-au `./bootstrap.sh crds all clusters/$CLUSTER ../../../kubezero/charts` ### Components +- delete old fluentd deployement because labels are immutable and they changed due to the migration to new upstream helm chart +`kubectl delete deployment logging-fluentd -n logging` + `./bootstrap.sh deploy all clusters/$CLUSTER ../../../kubezero/charts` ## Upgrade - ArgoCD @@ -48,4 +51,4 @@ This change was required to enable node restrictions via the upstream aws-iam-au ## Verification / Tests - check if all pods are RUNNING - check any Ingress services -- ... \ No newline at end of file +- ... diff --git a/scripts/git-pre-receive-hook.sh b/scripts/git-pre-receive-hook.sh new file mode 100644 index 00000000..d80aaeb6 --- /dev/null +++ b/scripts/git-pre-receive-hook.sh @@ -0,0 +1,33 @@ +#!/bin/bash +# +# Reject pushes that contain commits with messages that do not adhere +# to the defined regex. + +# [1] https://www.conventionalcommits.org/en/v1.0.0/#specification + +set -e + +zero_commit='0000000000000000000000000000000000000000' +msg_regex='/^((fixup! |squash! )?(\w+)(?:\(([^\)\s]+)\))?: (.+))(?:\n|$){0,2}?((?:^.+(\n|$))+(?:\n|$){0,2}?)+((?:^.+(\n|$))+)+/gm' + +while read -r oldrev newrev refname; do + # Branch or tag got deleted, ignore the push + [ "$newrev" = "$zero_commit" ] && continue + + # Calculate range for new branch/updated branch + [ "$oldrev" = "$zero_commit" ] && range="$newrev" || range="$oldrev..$newrev" + + for commit in $(git rev-list "$range" --not --all); do + if ! git log --max-count=1 --format=%B $commit | grep -iqE "$msg_regex"; then + echo "ERROR:" + echo "ERROR: Your push was rejected because the commit" + echo "ERROR: $commit in ${refname#refs/heads/}" + echo "ERROR: is not adhering to convential commit format." + echo "ERROR:" + echo "ERROR: Please fix the commit message and push again." + echo "ERROR: https://www.conventionalcommits.org/en/v1.0.0/#specification" + echo "ERROR" + exit 1 + fi + done +done