-
Notifications
You must be signed in to change notification settings - Fork 73
./hack/post-release.sh omit bundle change #4184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -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 | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+442
to
+449
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Handle unsupported flags explicitly in There is no fallback branch for invalid options. At Line 443-449 this matches ShellCheck SC2220 and leads to unclear/partial execution on bad flags. Suggested fix while getopts "bcdgk" opt; do
case "$opt" in
c) CVP=true;;
b) BASEIMAGE=true;;
d) DISTGIT=true;;
g) GITLAB=true;;
k) KEEP_BUNDLE_CHANGES=true;;
+ \?)
+ echo "Invalid option: -$OPTARG"
+ usage
+ exit 2
+ ;;
esac
done As per coding guidelines, 📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[warning] 443-449: Invalid flags are not handled. Add a *) case. (SC2220) 🤖 Prompt for AI AgentsSources: Coding guidelines, Linters/SAST tools |
||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||
| shift $((OPTIND-1)) | ||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not suppress RBAC reversion failures.
At Line 243,
2>/dev/null || truehides checkout failures, so the script can continue while still carrying unintended RBAC changes (opposite of the default contract).Suggested fix
As per coding guidelines,
hack/**/*scripts must “Check for proper error handling.”🤖 Prompt for AI Agents
Source: Coding guidelines