From ea373fc1588b69e9ca9296f499af033e620a8481 Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 11 Oct 2023 15:49:36 +0300 Subject: [PATCH] Add a helper script for preparing the release For now, it just updates the deployment files image tag and pull policy. Signed-off-by: Markus Lehtonen --- .github/ISSUE_TEMPLATE/new-release.md | 4 +++ hack/release-helper.sh | 43 +++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 hack/release-helper.sh diff --git a/.github/ISSUE_TEMPLATE/new-release.md b/.github/ISSUE_TEMPLATE/new-release.md index 8ea7d7ae4..53e649560 100644 --- a/.github/ISSUE_TEMPLATE/new-release.md +++ b/.github/ISSUE_TEMPLATE/new-release.md @@ -21,6 +21,10 @@ future releases. - [ ] Sync/tidy up dependencies. - [ ] Run `go mod tidy`. - [ ] Run `git commit -m 'go.mod,go.sum: update dependencies.' go.{mod,sum}`, if necessary. + - [ ] Update deployment files + - [ ] run `hack/release-helper.sh` + - [ ] commit changes, submit as a PR to GitHub + - [ ] wait for the PR to be merged - [ ] Run `git tag -a -m "NRI plugins $VERSION" $VERSION`. - Publishing - [ ] Push the tag with `git push $VERSION`. diff --git a/hack/release-helper.sh b/hack/release-helper.sh new file mode 100755 index 000000000..44c420e4c --- /dev/null +++ b/hack/release-helper.sh @@ -0,0 +1,43 @@ +#!/bin/bash -e +set -o pipefail + +this=`basename $0` + +usage () { +cat << EOF +Usage: $this VERSION + +Example: + + $this v0.2.0 +EOF +} + +# Check args +if [ $# -ne 1 ]; then + usage + exit 1 +fi + +version=$1 +shift 1 + +if ! [[ $version =~ ^v[0-9]+\.[0-9]+\..+$ ]]; then + echo -e "ERROR: invalid VERSION '$version'" + exit 1 +fi + +# Patch Kustomize +echo "Patching kustomize files" +find deployment/base deployment/overlays -name '*.yaml' | xargs -I '{}' \ + sed -E -e s",newTag:.+$,newTag: $version," \ + -e s",imagePullPolicy:.+$,imagePullPolicy: IfNotPresent," \ + -i '{}' + +# Patch Helm charts +echo "Patching Helm charts" +find deployment/helm -name Chart.yaml | xargs -I '{}' \ + sed -e s"/appVersion:.*/appVersion: $version/" -i '{}' +find deployment/helm -name values.yaml | xargs -I '{}' \ + sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}' +