Skip to content

Commit

Permalink
Add a helper script for preparing the release
Browse files Browse the repository at this point in the history
For now, it just updates the deployment files image tag and pull policy.

Signed-off-by: Markus Lehtonen <[email protected]>
  • Loading branch information
marquiz committed Oct 12, 2023
1 parent 66ed9f4 commit ea373fc
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .github/ISSUE_TEMPLATE/new-release.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
43 changes: 43 additions & 0 deletions hack/release-helper.sh
Original file line number Diff line number Diff line change
@@ -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 '{}'

0 comments on commit ea373fc

Please sign in to comment.