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