Skip to content

Commit

Permalink
Quote to prevent command substitution expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Jul 10, 2024
1 parent 2787df2 commit 090425c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions task/build-vm-image/0.1/build-vm-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ spec:
# form the --type arguments
IMAGE_TYPE_ARGUMENT=" --type $IMAGE_TYPE "
# this heredoc allows expansions for the image name
# this unquoted heredoc allows expansions for the image name
cat >scripts/script-build.sh <<REMOTESSHEOF
#!/bin/sh
set -e
Expand All @@ -166,7 +166,7 @@ spec:
REMOTESSHEOF
# no expansions in this one, the env vars are evaluated on the remote vm
# this quoted heredoc prevents expansions and command substitutions. the env vars are evaluated on the remote vm
cat >>scripts/script-build.sh <<'REMOTESSHEOF'
echo >config.toml <<EOF
[[blueprint.customizations.user]]
Expand Down Expand Up @@ -203,9 +203,17 @@ spec:
REMOTESSHEOF
# script-push.sh script is intended run _inside_ podman on the ssh host and requires sudo
# this unquoted heredoc allows expansions for the image name
cat >scripts/script-push.sh <<REMOTESSHEOF
#!/bin/bash
set -ex
export OUTPUT_IMAGE="$OUTPUT_IMAGE"
REMOTESSHEOF
# this quoted heredoc prevents expansions and command substitutions. the env vars are evaluated on the remote vm
cat >>scripts/script-push.sh <<'REMOTESSHEOF'
dnf -y install buildah pigz jq
# Build an image index of length 1 referring to an image manifest with the content
Expand Down

0 comments on commit 090425c

Please sign in to comment.