fix(scripts): make check-bootstrap.sh work under bash 3.2#217
Merged
Conversation
`just smoke` → smoke-bootstrap aborted with `ns_args[@]: unbound
variable`. The script expands an optional namespace-args array as
`"${ns_args[@]}"`; for cluster-scoped resources that array is empty, and
a bare empty-array expansion under `set -u` is an "unbound variable"
error in bash 3.2 (macOS's /bin/bash) — only made safe in bash 4.4. The
script worked on Linux (cluster / CI bash 5.x) but broke whenever the
operator ran `just smoke` from their Mac.
Use the bash-3.2-safe `"${ns_args[@]+"${ns_args[@]}"}"` expansion at both
sites. Verified: the script now checks all three resources to completion
under bash 3.2.57, all Ready=True.
Closes: #216
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
just smoke→smoke-bootstrapaborted on macOS:The script builds an optional namespace-args array and expands it as
"${ns_args[@]}". For cluster-scoped resources (ClusterIssuer,ClusterSecretStore) that array is empty — and a bare empty-array expansion underset -uis an "unbound variable" error in bash 3.2 (macOS's/bin/bash,3.2.57); it was only made safe in bash 4.4. The script worked on Linux (cluster / CI bash 5.x) but broke every time the operator ranjust smokefrom their Mac.The namespaced
Certificatecheck passed (non-empty array); the script then died on the cluster-scopedClusterIssuerbefore checking it or thegsmClusterSecretStore.Fix
Use the bash-3.2-safe expansion
"${ns_args[@]+"${ns_args[@]}"}"at bothkubectlcall sites — expands to nothing when the array is empty/unset, to the elements otherwise, no stray empty-string argument. A comment at the declaration records why the longer form is required.Testing
Verified on this machine (
bash 3.2.57):All three resources now check to completion. Combined with #212 and #215,
just smokepasses end-to-end.Context
Pre-existing and unrelated to Cilium — surfaced once #212 + #215 got
smoke-ciliumpassing so execution reachedsmoke-bootstrap.Closes: #216
Refs: #198
🤖 Generated with Claude Code