Replies: 1 comment 2 replies
-
Sorry, we really are lacking any good docs on how to implement a mixin. All the mixins right now act as wrappers for a CLI installed in the bundle's container. The pkg/exec/builder package contains common logic that they all share to handle calling the CLI. The mixin is mostly responsible for the following:
Here is the line in the aws mixin's code that tells the builder package how to call aws (i.e. what is the name of the cli that is wrapped by the mixin) You mentioned that you looked for the term "ec2" in the mixin and I wanted to explain quick why you won't find that in the aws mixin. Most of the public mixins just wrap existing commands, and use concepts such as "arguments" and "flags" to support calling any aws command supported by the CLI without having to maintain and keep up to date a mixin that has explicit understanding of each sub-command the aws CLI supports. A mixin could choose to be more than a wrapper for a CLI (the helm3 mixin is more opinionated, same with the arm mixin). I don't have public examples of this, but some mixins don't wrap a CLI at all and execute internal logic instead, or call an API, etc. Feel free to ask more follow-up questions, I realize that at the moment writing a mixin mostly relies upon using the skeletor template repository and then reading the code to figure out what's going on. |
Beta Was this translation helpful? Give feedback.
-
I need to develop a Mixin for Packer by Hashicorp. I'm looking at the aws cli Mixin as a guide, since my Mixin will be very simple, just execute a few commands during build, and a couple more during install. I can't figure out by reading the documentation or looking at examples, where the logic actually happens. My understanding is that the aws Mixin just defers to the exec Mixin, but even searching the entire repository of the aws Mixin, the only text containing ec2 is in a test file. Where does the actual aws command get invoked?
Beta Was this translation helpful? Give feedback.
All reactions