Skip to content

Comments

Refactor build script to use bash arrays instead of string concatenation#3

Merged
miragecentury merged 1 commit intomainfrom
claude/manifest-build-config-Qd3UB
Feb 19, 2026
Merged

Refactor build script to use bash arrays instead of string concatenation#3
miragecentury merged 1 commit intomainfrom
claude/manifest-build-config-Qd3UB

Conversation

@miragecentury
Copy link
Contributor

Summary

Refactored the Docker build script in the release workflow to use bash arrays for constructing build arguments and labels instead of string concatenation. This improves code robustness and eliminates the need for shellcheck directives.

Key Changes

  • Converted BUILD_ARGS from a string variable to an array, using yq with process substitution for cleaner iteration
  • Converted LABELS from a string variable to an array, appending label entries with proper quoting
  • Updated the buildah build command to use array expansion syntax ("${BUILD_ARGS[@]}" and "${LABELS[@]}") instead of unquoted variable expansion
  • Removed the shellcheck disable=SC2086 comment as it's no longer needed with proper array handling

Implementation Details

  • Used bash arrays with the += operator for appending elements, which is more idiomatic than string concatenation
  • Maintained proper quoting around array elements to handle values with spaces or special characters
  • Preserved the existing label parsing logic (key-value extraction and quote trimming) while improving the variable handling

https://claude.ai/code/session_01WtJC749bMVKy7Xxr5P2WD7

…spaces

Labels like org.opencontainers.image.description="Python GitHub Runner"
contain spaces. Using unquoted string variables caused word-splitting when
passed to buildah, resulting in "accepts at most 1 arg(s), received 13".

Switch to bash arrays with proper quoting so values with spaces are passed
as single arguments.

https://claude.ai/code/session_01WtJC749bMVKy7Xxr5P2WD7
@miragecentury miragecentury merged commit 9485a49 into main Feb 19, 2026
3 checks passed
@miragecentury miragecentury deleted the claude/manifest-build-config-Qd3UB branch February 19, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants