Skip to content

generate-gitops output is not round-trip compatible with gitops when string values contain $Β #44053

@Brajim20

Description

@Brajim20

Fleet version: v4.84.0-rc.2604222001
Found Fleet version: v4.84.0-rc.2604222001

πŸ’₯ Actual behavior

Image Image

When a string field value (e.g., VPP app display_name) contains a $ character followed by alphanumeric characters, the round-trip UI β†’ generate-gitops β†’ gitops is broken.

  1. A value set via the Fleet UI (e.g., display_name: ($($U$J@) is stored in the DB.

  2. fleetctl generate-gitops outputs this value literally into the yml file.

  3. fleetctl gitops attempts to apply the file and interprets $U and $J as environment variable references, failing with:

  4. No working escape mechanism found:

    • $$ produces more errors (5 instead of 2), as gitops treats $$ as a separate var reference
    • Single-quoting the value does not help
    • Double-quoting the value does not help
      No working escape was found: $$ produces more errors, and single/double quoting does not help.

UPDATE: @noahtalerman: this is how to escape:

Image

(https://fleetdm.com/docs/configuration/yaml-files#variables:~:text=)-,can%20be%20escaped,-so%20it%27s%20not)

πŸ› οΈ Expected behavior

Update the error message:

* environment variable U not set; if you intended the literal string $U then please escape it as \$U.

πŸ§‘β€πŸ’» Steps to reproduce

  1. In the Fleet UI, set a string field (e.g., VPP app display_name) to a value containing $ followed by alphanumeric chars β€” e.g., ($($U$J@
  2. Run fleetctl generate-gitops --dir /tmp/test-export --force
  3. Run fleetctl gitops -f /tmp/test-export/fleets/<team>.yml --dry-run
  4. Observe failure with environment variable "<X>" not set

πŸ•―οΈ More info

Discovered while verifying #33106. Affects any text field that ends up in gitops yml output (display names, descriptions, URLs, passwords, queries, etc.).

Metadata

Metadata

Assignees

Labels

#g-first-impressionsFirst impressions working groupbugSomething isn't working as documented~released bugThis bug was found in a stable release.

Type

No type
No fields configured for issues without a type.

Projects

Status

πŸ₯ Ready for review

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions