Skip to content

Commit

Permalink
scripts/prepare-release: option -k to specify the signing key
Browse files Browse the repository at this point in the history
Make the GPG signing an optional argument. It doesn't make much sense to
require that when no assets are being generated (i.e. when "-b" is
used).
  • Loading branch information
marquiz committed Aug 9, 2022
1 parent 3f084a4 commit e41c5a7
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions scripts/prepare-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,21 @@ this=`basename $0`

usage () {
cat << EOF
Usage: $this [-h] [-a] [-b] RELEASE_VERSION GPG_KEY
Usage: $this [-h] [-a] [-b] [-k GPG_KEY] RELEASE_VERSION
Options:
-h show this help and exit
-a do not patch files in the repo
-b do not generate assets
-k gpg key to use for signing the assets
Example:
$this v0.1.2 "Jane Doe <[email protected]>"
$this v0.1.2 -k "Jane Doe <[email protected]>"
NOTE: The GPG key should be associated with the signer's Github account.
Use -k to specify the correct key (if needed).
EOF
}

Expand All @@ -29,20 +31,22 @@ sign_helm_chart() {
echo "$yaml
...
files:
$chart: sha256:$sha256" | gpg -u "$key" --clearsign -o "$chart.prov"
$chart: sha256:$sha256" | gpg ${signing_key:+-u "$signing_key"} --clearsign -o "$chart.prov"
}

#
# Parse command line
#
no_patching=
no_assets=
while getopts "abh" opt; do
while getopts "abk:h" opt; do
case $opt in
a) no_patching=y
;;
b) no_assets=y
;;
k) signing_key="$OPTARG"
;;
h) usage
exit 0
;;
Expand All @@ -54,8 +58,8 @@ done
shift "$((OPTIND - 1))"

# Check that no extra args were provided
if [ $# -ne 2 ]; then
if [ $# -lt 2 ]; then
if [ $# -ne 1 ]; then
if [ $# -lt 1 ]; then
echo -e "ERROR: too few arguments\n"
else
echo -e "ERROR: unknown arguments: ${@:3}\n"
Expand All @@ -65,8 +69,7 @@ if [ $# -ne 2 ]; then
fi

release=$1
key="$2"
shift 2
shift 1

container_image=k8s.gcr.io/nfd/node-feature-discovery:$release

Expand Down

0 comments on commit e41c5a7

Please sign in to comment.