Skip to content

fix(shield): strip leading newline from dragent.yaml ConfigMap block scalar - #2701

Open
mavimo wants to merge 1 commit into
mainfrom
fix/2686-dragent-leading-newline
Open

fix(shield): strip leading newline from dragent.yaml ConfigMap block scalar#2701
mavimo wants to merge 1 commit into
mainfrom
fix/2686-dragent-leading-newline

Conversation

@mavimo

@mavimo mavimo commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Go template comments written as {{/* ... */}} sit in the template's output stream, and {{- trimming does not reach past a comment node. The comment above the Host Scanner block in host.configmap therefore emitted a stray newline that nindent 4 rendered as a whitespace-only first line of the dragent.yaml block scalar. Strict YAML parsers such as YamlDotNet (used by Octopus Deploy) reject this with "While scanning a literal block scalar, found extra spaces in first line".

Left-trim both output-stream comments so the block scalar starts on the first content line, and add regression tests asserting the ConfigMap values begin with a non-whitespace character.

Fixes #2686

Generated with support from AI

What this PR does / why we need it:

Checklist

  • Title of the PR starts with type and scope, (e.g. feat(agent,node-analyzer,sysdig-deploy):)
  • Chart Version bumped for the respective charts
  • Variables are documented in the README.md (or README.tpl in some charts)
  • Check GithubAction checks (like lint) to avoid merge-check stoppers
  • All test files are added in the tests folder of their respective chart and have a "_test" suffix

@mavimo
mavimo requested a review from a team as a code owner July 30, 2026 16:09
…scalar

Go template comments written as `{{/* ... */}}` sit in the template's output
stream, and `{{-` trimming does not reach past a comment node. The comment
above the Host Scanner block in `host.configmap` therefore emitted a stray
newline that `nindent 4` rendered as a whitespace-only first line of the
`dragent.yaml` block scalar. Strict YAML parsers such as YamlDotNet (used by
Octopus Deploy) reject this with "While scanning a literal block scalar, found
extra spaces in first line".

Left-trim both output-stream comments so the block scalar starts on the first
content line, and add regression tests asserting the ConfigMap values begin
with a non-whitespace character.

Fixes #2686

Generated with support from AI

Co-Authored-By: Marco Vito Moscaritolo <marcovito.moscaritolo@sysdig.com>
@mavimo
mavimo force-pushed the fix/2686-dragent-leading-newline branch from f0e80f9 to 810cd1a Compare August 3, 2026 11:59
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.

shield: host.parse_features template leaks leading newline into dragent.yaml ConfigMap block scalar

2 participants