Skip to content

Commit 3d2208b

Browse files
fix: avoid masking kubectl exit code in CatalogSource check
Separate local declaration from command substitution to preserve kubectl's exit code. While the exit code isn't currently used in this error path, following this best practice prevents potential issues and improves code maintainability. Before: local state=$(kubectl get catalogsource ...) After: local state state=$(kubectl get catalogsource ...) This ensures $? reflects kubectl's exit status, not the local builtin.
1 parent c1f31cc commit 3d2208b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/deployment-helpers.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,8 @@ EOF
11541154
if ! kubectl wait catalogsource "$name" -n "$namespace" \
11551155
--for=jsonpath='{.status.connectionState.lastObservedState}'=READY \
11561156
--timeout="${CATALOGSOURCE_TIMEOUT}s" 2>/dev/null; then
1157-
local state=$(kubectl get catalogsource "$name" -n "$namespace" \
1157+
local state
1158+
state=$(kubectl get catalogsource "$name" -n "$namespace" \
11581159
-o jsonpath='{.status.connectionState.lastObservedState}' 2>/dev/null)
11591160
echo " ERROR: CatalogSource not ready after ${CATALOGSOURCE_TIMEOUT}s (state: $state)"
11601161
return 1

0 commit comments

Comments
 (0)