-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Add bumper script
Ease go package bumping. Signed-off-by: Or Shoval <[email protected]>
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
# Package bump helper | ||
# Make sure you already have a repository (i.e CNAO) with remote upstream, and origin branches | ||
# No untracked files are allowed on folder (they will be added and pushed, so make sure folder is clean) | ||
|
||
# ./hack/bumper.sh CVE-2021-38561 golang.org/x/[email protected] release-0.89 | ||
|
||
if [ $# -ne 3 ]; then | ||
echo "Syntax: $0 <CVE> <TARGET_PACK> <BR>" | ||
exit 1 | ||
fi | ||
|
||
CVE=$1 | ||
TARGET_PACK=$2 | ||
BR=$3 | ||
|
||
PACK="${TARGET_PACK/@*}" | ||
git checkout "${BR}" | ||
git pull upstream "$(git symbolic-ref --short HEAD)" | ||
go mod edit -dropreplace="${PACK}" | ||
go mod edit -require="${TARGET_PACK}" | ||
make vendor | ||
|
||
git checkout -b "${BR}_${CVE}_$(openssl rand -hex 4)" | ||
git add . | ||
git commit -s -m "$( [ "$BR" == "main" ] && echo "" || echo "[$BR] " )$CVE: Bump $PACK" | ||
git push --set-upstream origin "$(git rev-parse --abbrev-ref HEAD)" |