Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .scripts/actions/get_build_arguments.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env bash

# Splits comma-separated values, prepends them with --build-arg, and prints
# them out separated by newlines.
echo "$1" | awk '{ split($0, args, ","); for (i in args) { printf "--build-arg \"%s\" ", args[i] }}'
# them out. Variable values MUST mot contain any whitespace as following commands
# will break.
echo "$1" | awk '{ split($0, args, ","); for (i in args) { printf "--build-arg %s ", args[i] }}'
2 changes: 1 addition & 1 deletion build-container-image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ All subsequent tasks must use this value to ensure consistency.
- `image-index-manifest-tag` (required, eg: `3.4.1-stackable0.0.0-dev`)
- `container-file` (defaults to `Dockerfile`)
- `build-context` (defaults to `.`)
- `build-arguments`
- `build-arguments`: MUST not contain any whitespace

### Outputs

Expand Down
11 changes: 9 additions & 2 deletions build-container-image/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ inputs:
default: .
build-arguments:
description: |
A comma-separated list of KEY=VALUE pairs provided as build arguments
A comma-separated list of KEY=VALUE pairs provided as build arguments.
MUST not contain any whitespace.
outputs:
image-repository-uri:
description: |
Expand Down Expand Up @@ -53,6 +54,12 @@ runs:
run: |
set -euo pipefail

# Validate that the build arguments input doesn't contain any whitespaces
if echo "$BUILD_ARGUMENTS" | grep '[[:space:]]'; then
>&2 echo "Build arguments MUST not contain any whitespace."
exit 1
fi

DOCKER_BUILD_ARGUMENTS=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_build_arguments.sh" "$BUILD_ARGUMENTS")

IMAGE_ARCH=$("$GITHUB_ACTION_PATH/../.scripts/actions/get_architecture.sh")
Expand All @@ -75,7 +82,7 @@ runs:
--tag "${IMAGE_MANIFEST_URI}" \
--load \
$DOCKER_BUILD_ARGUMENTS \
"${BUILD_CONTEXT}"
"$BUILD_CONTEXT"
echo "::endgroup::"

echo "::group::docker images"
Expand Down