fix(shield): strip leading newline from dragent.yaml ConfigMap block scalar - #2701
Open
mavimo wants to merge 1 commit into
Open
fix(shield): strip leading newline from dragent.yaml ConfigMap block scalar#2701mavimo wants to merge 1 commit into
mavimo wants to merge 1 commit into
Conversation
francesco-furlan
approved these changes
Jul 31, 2026
…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
force-pushed
the
fix/2686-dragent-leading-newline
branch
from
August 3, 2026 11:59
f0e80f9 to
810cd1a
Compare
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.
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 inhost.configmaptherefore emitted a stray newline thatnindent 4rendered as a whitespace-only first line of thedragent.yamlblock 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
feat(agent,node-analyzer,sysdig-deploy):)