mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2025-03-05 16:27:05 +00:00
scripts/prepare-release: patch golang version in Makefile
Make it mandatory to specify a golang version with "-g" when running the script (and patching repo content). The given version will be patched into the Makefile to fix the version used in the release build - it is meant to use a exact point release (like 1.18.3) to get reproducible builds.
This commit is contained in:
parent
e41c5a712f
commit
989565de97
1 changed files with 17 additions and 2 deletions
|
@ -5,12 +5,14 @@ this=`basename $0`
|
|||
|
||||
usage () {
|
||||
cat << EOF
|
||||
Usage: $this [-h] [-a] [-b] [-k GPG_KEY] RELEASE_VERSION
|
||||
Usage: $this [-h] [-b] [-k GPG_KEY] {-a|-g GOLANG_VERSION} RELEASE_VERSION
|
||||
|
||||
Options:
|
||||
-h show this help and exit
|
||||
-a do not patch files in the repo
|
||||
-b do not generate assets
|
||||
-g golang version to fix for the release (mandatory when -a not
|
||||
specified). Should be a exact point release e.g. 1.18.3.
|
||||
-k gpg key to use for signing the assets
|
||||
|
||||
Example:
|
||||
|
@ -39,12 +41,14 @@ files:
|
|||
#
|
||||
no_patching=
|
||||
no_assets=
|
||||
while getopts "abk:h" opt; do
|
||||
while getopts "abg:k:h" opt; do
|
||||
case $opt in
|
||||
a) no_patching=y
|
||||
;;
|
||||
b) no_assets=y
|
||||
;;
|
||||
g) golang_version="$OPTARG"
|
||||
;;
|
||||
k) signing_key="$OPTARG"
|
||||
;;
|
||||
h) usage
|
||||
|
@ -68,6 +72,12 @@ if [ $# -ne 1 ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$no_patching" -a -z "$golang_version" ]; then
|
||||
echo -e "ERROR: '-g GOLANG_VERSION' must be specified when modifying repo (i.e. when '-a' is not used)\n"
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
release=$1
|
||||
shift 1
|
||||
|
||||
|
@ -94,6 +104,11 @@ fi
|
|||
# Modify files in the repo to point to new release
|
||||
#
|
||||
if [ -z "$no_patching" ]; then
|
||||
# Patch docs configuration
|
||||
echo Patching golang version $golang_version into Makefile
|
||||
sed -e s"/\(^BUILDER_IMAGE.*=.*golang:\)[0-9][0-9.]*\(.*\)/\1$golang_version\2/" \
|
||||
-i Makefile
|
||||
|
||||
# Patch docs configuration
|
||||
echo Patching docs/_config.yml
|
||||
sed -e s"/release:.*/release: $release/" \
|
||||
|
|
Loading…
Add table
Reference in a new issue