1
0
Fork 0
mirror of https://github.com/kubernetes-sigs/node-feature-discovery.git synced 2025-03-18 22:33:09 +00:00

scripts/prepare-release: option to only create assets

Add '-a' command line option to only create release assets and not patch
any files in the repo. E.g.

  $ scripts/prepare-release.sh -a v0.8.0+1 user@example.com
This commit is contained in:
Markus Lehtonen 2021-03-31 11:37:28 +03:00
parent 33a6425d05
commit 7dd5f0e5c3

View file

@ -9,6 +9,7 @@ Usage: $this [-h] RELEASE_VERSION GPG_KEY
Options: Options:
-h show this help and exit -h show this help and exit
-a only generate release assets, do not patch files in the repo
Example: Example:
@ -33,8 +34,11 @@ files:
# #
# Parse command line # Parse command line
# #
while getopts "h" opt; do assets_only=
while getopts "ah" opt; do
case $opt in case $opt in
a) assets_only=y
;;
h) usage h) usage
exit 0 exit 0
;; ;;
@ -79,34 +83,36 @@ else
exit 1 exit 1
fi fi
# Patch docs configuration if [ -z "$assets_only" ]; then
echo Patching docs/_config.yml # Patch docs configuration
sed -e s"/release:.*/release: $release/" \ echo Patching docs/_config.yml
sed -e s"/release:.*/release: $release/" \
-e s"/version:.*/version: $docs_version/" \ -e s"/version:.*/version: $docs_version/" \
-e s"!container_image:.*!container_image: k8s.gcr.io/nfd/node-feature-discovery:$release!" \ -e s"!container_image:.*!container_image: k8s.gcr.io/nfd/node-feature-discovery:$release!" \
-i docs/_config.yml -i docs/_config.yml
# Patch README # Patch README
echo Patching README.md to refer to $release echo Patching README.md to refer to $release
sed s"!node-feature-discovery/v.*/!node-feature-discovery/$release/!" -i README.md sed s"!node-feature-discovery/v.*/!node-feature-discovery/$release/!" -i README.md
# Patch deployment templates # Patch deployment templates
echo Patching '*.yaml.template' to use $container_image echo Patching '*.yaml.template' to use $container_image
sed -E -e s",^([[:space:]]+)image:.+$,\1image: $container_image," \ sed -E -e s",^([[:space:]]+)image:.+$,\1image: $container_image," \
-e s",^([[:space:]]+)imagePullPolicy:.+$,\1imagePullPolicy: IfNotPresent," \ -e s",^([[:space:]]+)imagePullPolicy:.+$,\1imagePullPolicy: IfNotPresent," \
-i *yaml.template -i *yaml.template
# Patch Helm chart # Patch Helm chart
sed -e s"/appVersion:.*/appVersion: $release/" -i deployment/node-feature-discovery/Chart.yaml sed -e s"/appVersion:.*/appVersion: $release/" -i deployment/node-feature-discovery/Chart.yaml
sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" \ sed -e s"/pullPolicy:.*/pullPolicy: IfNotPresent/" \
-e s"!gcr.io/k8s-staging-nfd/node-feature-discovery!k8s.gcr.io/nfd/node-feature-discovery!" \ -e s"!gcr.io/k8s-staging-nfd/node-feature-discovery!k8s.gcr.io/nfd/node-feature-discovery!" \
-i deployment/node-feature-discovery/values.yaml -i deployment/node-feature-discovery/values.yaml
# Patch e2e test # Patch e2e test
echo Patching test/e2e/node_feature_discovery.go flag defaults to k8s.gcr.io/nfd/node-feature-discovery and $release echo Patching test/e2e/node_feature_discovery.go flag defaults to k8s.gcr.io/nfd/node-feature-discovery and $release
sed -e s'!"nfd\.repo",.*,!"nfd.repo", "k8s.gcr.io/nfd/node-feature-discovery",!' \ sed -e s'!"nfd\.repo",.*,!"nfd.repo", "k8s.gcr.io/nfd/node-feature-discovery",!' \
-e s"!\"nfd\.tag\",.*,!\"nfd.tag\", \"$release\",!" \ -e s"!\"nfd\.tag\",.*,!\"nfd.tag\", \"$release\",!" \
-i test/e2e/node_feature_discovery.go -i test/e2e/node_feature_discovery.go
fi
# #
# Create release assets to be uploaded # Create release assets to be uploaded