butane icon indicating copy to clipboard operation
butane copied to clipboard

Gomplate integration

Open vic1707 opened this issue 5 months ago • 4 comments

Well, this PR was opened much earlier than intended due to my mistake; I accidentally opened it against the source repo instead of my fork 😓.

This PR proposes a solution to https://github.com/coreos/butane/issues/111, as envsubst may not be sufficient for all users.

This PR makes butane use gomplate as a templating engine, each file butane wants to open is passed through gomplate first. Gomplate is configurable by having a .gomplate.yaml file in the current directory, no flags are used to configure gomplate (for CLI simplicity).

Disclaimer: This is my first time working with Go. I'm learning as I go, so things might not be perfect or fully optimized. Please be kind 🙏

vic1707 avatar Jul 23 '25 14:07 vic1707

Just looking at the amount of lines changed here (all the vendoring), I don't think this is a realistic path forward.

travier avatar Aug 04 '25 13:08 travier

To make it easier to review/consider, please put all the vendored code in a single commit, the rest of the changes in another one.

travier avatar Aug 04 '25 14:08 travier

Just looking at the amount of lines changed here (all the vendoring), I don't think this is a realistic path forward.

I believe you're talking about the whole concept of embeding gomplate, not the amount of commits I had 😓 ?

To make it easier to review/consider, please put all the vendored code in a single commit, the rest of the changes in another one.

Done, the PR has now 3 commits

  1. fix a small typo: an extra ) in the license comment
  2. installing and vendoring everything
  3. the actual implementation

Thanks for your time and the review!

Note: I didn't add the license on the newly created files for now, I'll add it once you're ok with what I did 😉

Edit:

  • Do you want me to ping you upon updates/messages?
  • I thing I found a way to get all the config settings applied to this implementation (currently missing experimental support amongst others), the core idea of the PR won't change, but some implementation details might

vic1707 avatar Aug 04 '25 14:08 vic1707

Was able to add support for the Experimental mode (and simplify implementation), Appart from the Input and Output class configurations which are incompatible with butane, I'm still missing

Plugins
PostExec
PluginTimeout
ExecPipe

I don't think ExecPipe or PostExec should be used, so only Plugins are missing assuming they're wanted. Will look into it asap, still code is reviewable now 😉

Edit: Plugins also done, was easier than I thought

vic1707 avatar Aug 10 '25 18:08 vic1707