fix(generate): env-route promote input JSON and escape dispatch-input defaults#604
Merged
Merged
Conversation
… defaults Signed-off-by: Joshua Temple <joshua.temple@stablekernel.com> (cherry picked from commit 87022d69f2f111ab05f6d3ea65ad7a6b5dcc889a)
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.
The promote Build Deploy Matrices step embedded operator-input JSON in a shell single-quote literal (DEFAULT_INPUTS='{...}'), and json.Marshal never escapes an apostrophe. A benign manifest value like message: "it's live" made cascade generate-workflow exit 0 but emit a script that fails shell parsing (bash -n: unexpected EOF) - breaking every promotion; a crafted value could execute in the promote job. The dispatch-input default sink (generator.go:779) had the same apostrophe-breaks-YAML flaw.
Fix: route the input JSON out of the shell literal into per-deploy env: entries (read back double-quoted, fed only to jq as data), and emit both those env values and the dispatch-input defaults via a yamlSingleQuote helper (single-quote, apostrophes doubled). No behavioral change for special-char-free inputs; own workflows regenerate byte-identical.
Verification: build/-race/lint green, 3005 tests; red-then-green tests (bash -n rc2->0, yaml.Unmarshal err->parses) + e2e scenario 66-input-value-quoting. (Rebased onto main after the artifacts PR; CHANGELOG union, scenario renumbered 65->66.)