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.
  • Loading branch information
marquiz committed Oct 11, 2023
1 parent 66ed9f4 commit 658eba4
Show file tree
Hide file tree
Showing 2 changed files with 48 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
44 changes: 44 additions & 0 deletions hack/release-helper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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
image_tag=${BASH_REMATCH[1]}

# Patch Kustomize
echo "Patching kustomize files"
find deployment/base deployment/overlays -name '*.yaml' | xargs -I '{}' \
sed -E -e s",newTag:.+$,newTag: $image_tag," \
-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: $image_tag/" -i '{}'
find deployment/helm -name values.yaml | xargs -I '{}' \
sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" -i '{}'

0 comments on commit 658eba4

Please sign in to comment.