diff --git a/hack/pre-release.sh b/hack/pre-release.sh index 90bebcfb69..cbf5903386 100755 --- a/hack/pre-release.sh +++ b/hack/pre-release.sh @@ -11,6 +11,7 @@ CVP=false BASEIMAGE=false DISTGIT=false GITLAB=false +KEEP_BUNDLE_CHANGES=false # codes for printing and resetting pink text PINK='\033[95m' @@ -30,6 +31,9 @@ usage() { echo "optional flags: -g" echo " bumps the gitlab versions" echo -e " ${PINK}Requires connection to the RedHat VPN" + echo "optional flags: -k" + echo " keep all changes from 'make bundle' including RBAC regeneration" + echo " (default: only keep version-related changes, revert RBAC changes)" printf "${START_COLOR}" } @@ -231,6 +235,16 @@ github_update() { sed -i 's/REPLACE_IMAGE:latest/REPLACE_IMAGE/' bundle/manifests/windows-machine-config-operator.clusterserviceversion.yaml sed -i "s/operator-sdk-v1.14.0+git/operator-sdk-$OPERATOR_SDK_VERSION+git/" bundle/manifests/windows-machine-config-operator.clusterserviceversion.yaml + # Revert unintended RBAC changes from make bundle unless -k flag is set + if [[ $KEEP_BUNDLE_CHANGES == "false" ]]; then + echo "Reverting RBAC changes from make bundle (use -k flag to keep all changes)" + git checkout HEAD -- bundle/manifests/prometheus-k8s_rbac.authorization.k8s.io_v1_role.yaml \ + bundle/manifests/system-wicd-nodes_rbac.authorization.k8s.io_v1_clusterrole.yaml \ + config/rbac/role.yaml 2>/dev/null || true + else + echo "Keeping all changes from make bundle including RBAC regeneration" + fi + commit_message="[$base_branch] Update version to $updated_version This commit was generated by hack/pre-release.sh" @@ -424,14 +438,15 @@ if [[ "$operator_sdk_current_version" != "$OPERATOR_SDK_VERSION" ]]; then exit fi -# This sets the CVP and baseimage flags -while getopts "bcdg" opt; do - case "$opt" in +# This sets the CVP, baseimage, and other flags +while getopts "bcdgk" opt; do + case "$opt" in c) CVP=true;; b) BASEIMAGE=true;; d) DISTGIT=true;; g) GITLAB=true;; - esac + k) KEEP_BUNDLE_CHANGES=true;; + esac done shift $((OPTIND-1))