Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add bumper script
Browse files Browse the repository at this point in the history
Ease go package bumping.

Signed-off-by: Or Shoval <[email protected]>
oshoval committed Jan 7, 2025

Verified

This commit was signed with the committer’s verified signature.
pietroalbini Pietro Albini
1 parent 856c0b3 commit c965277
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions hack/bumper.sh
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)"

0 comments on commit c965277

Please sign in to comment.