fix(cloudflared): escape the stub's shell variables in molecule.yml
Build / build (pull_request) Successful in 19s
Lint / lint (pull_request) Successful in 1m23s
Molecule / molecule (pull_request) Failing after 2m21s

molecule interpolates environment variables in molecule.yml, so `$1`
and `$*` in the embedded stub script failed the config parse ("Invalid
placeholder") before any step ran. `$$` renders as a literal `$`.

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
Defame1297 committed 2026-11-23 15:11:21 +00:00
1 parent 92534a486e
commit 701226f499
1 file changed
+7 -7
@@ -35,16 +35,16 @@ provisioner:
# sha256, so the release files need no checksum file.
cloudflared_test_stub: |
#!/bin/sh
case "$1" in
case "$$1" in
--version) echo "cloudflared version @VERSION@ (built 2026-01-01-0000 UTC)" ;;
tunnel)
[ "$2" = --config ] || { echo "stub cloudflared: expected --config" >&2; exit 2; }
case "$4" in
ingress) grep -q 'service: http_status:404' "$3" && { echo "Validating rules from $3"; exit 0; } ;;
run) [ -r "$3" ] && exec sleep infinity ;;
[ "$$2" = --config ] || { echo "stub cloudflared: expected --config" >&2; exit 2; }
case "$$4" in
ingress) grep -q 'service: http_status:404' "$$3" && { echo "Validating rules from $$3"; exit 0; } ;;
run) [ -r "$$3" ] && exec sleep infinity ;;
esac
echo "stub cloudflared: cannot handle: $*" >&2; exit 1 ;;
*) echo "stub cloudflared: unexpected arguments: $*" >&2; exit 2 ;;
echo "stub cloudflared: cannot handle: $$*" >&2; exit 1 ;;
*) echo "stub cloudflared: unexpected arguments: $$*" >&2; exit 2 ;;
esac
cloudflared_test_stub_dir: "{{ lookup('ansible.builtin.env', 'MOLECULE_EPHEMERAL_DIRECTORY') }}/cloudflare-stub"
cloudflared_test_tunnel_id: 6f1a6e2c-0000-4000-8000-000000000001