Skip to content

Support correctly templating numbers#65

Merged
foot merged 3 commits intomainfrom
support-templating-numbers
Apr 22, 2023
Merged

Support correctly templating numbers#65
foot merged 3 commits intomainfrom
support-templating-numbers

Conversation

@foot
Copy link
Copy Markdown
Collaborator

@foot foot commented Apr 21, 2023

  • Also incidentally add support for templating objects
  • Convert RawExtension back to YAML bytes before rendering
  • This re-escapes quotes introduced when gitopssets are converted to JSON
  • This technique is used in GitopsTemplates too

Caveats:

  • Strings that look like numbers will now become numbers, workarounds:
    • { version: "1.21" } -> { version: "{{ \"1.21\" | quote }}" }, my bad, I thought I saw this, but uncertain string values seem fine!

- Also incidentally add support for templating objects
- Convert RawExtension back to YAML bytes before rendering
- This re-escapes quotes introduced when gitopssets are converted to
  JSON
- This technique is used in GitopsTemplates too
@foot foot requested a review from bigkevmcd April 21, 2023 13:26
Copy link
Copy Markdown
Collaborator

@bigkevmcd bigkevmcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice work!

Comment thread controllers/templates/renderer.go Outdated
Co-authored-by: Kevin McDermott <kevin@weave.works>
@foot foot merged commit b31e6f6 into main Apr 22, 2023
@foot foot deleted the support-templating-numbers branch April 22, 2023 06:50
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.

2 participants