packer-cn/packer-plugin-sdk
Adrien Delorme 72c1912b60
allow to discover & start packer-plugin-* muliplugin binaries (#10277)
This add :
* discovery of `packer-plugin-*` binaries from the known folders and ask them to describe themselves
* tests

For testing: in go we create a bash script that in turn calls back to Go. I could not make the tests to work on windows and then would like to postpone testing this for when we know more about the finite layout of this feature. That is mainly: how things are going to work with init, versioning and such.
2020-12-15 10:58:09 +01:00
..
acctest fix var naming and docs in acctest package 2020-12-11 15:23:12 -08:00
adapter remove unused tools, add some docs 2020-12-11 15:15:08 -08:00
bootcommand update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
chroot fix tests by moving mock hooks and communicators, and BasicUi definition, into SDK 2020-11-30 14:30:30 -08:00
common move packer config constants next to the packer config 2020-12-03 10:17:35 -08:00
communicator fix pathing 2020-12-03 10:39:21 -08:00
filelock update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
guestexec move plugin and rpc code into sdk; other minor tweaks (#10359) 2020-12-09 12:39:54 +01:00
iochan update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
json update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
multistep move plugin and rpc code into sdk; other minor tweaks (#10359) 2020-12-09 12:39:54 +01:00
net move plugin and rpc code into sdk; other minor tweaks (#10359) 2020-12-09 12:39:54 +01:00
packer move plugin and rpc code into sdk; other minor tweaks (#10359) 2020-12-09 12:39:54 +01:00
packerbuilderdata move multistep into the plugin sdk 2020-11-17 16:31:03 -08:00
pathing fix pathing 2020-12-03 10:39:21 -08:00
plugin allow to discover & start packer-plugin-* muliplugin binaries (#10277) 2020-12-15 10:58:09 +01:00
random update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
retry update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
rpc move plugin and rpc code into sdk; other minor tweaks (#10359) 2020-12-09 12:39:54 +01:00
sdk-internals/communicator move helper/communicator dir into packer-plugin-sdk 2020-12-02 08:41:32 -08:00
shell update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
shell-local Move hook and communicator definitions to packer-plugin-sdk 2020-11-30 14:30:30 -08:00
shutdowncommand update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
template move hcl2template kv types into the config/custom_types with trilean definitions 2020-11-18 15:46:59 -08:00
test-fixtures update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
tmp move tmp helper func into packer-plugin-sdk 2020-11-16 15:13:08 -08:00
useragent move version and useragent definitions into sdk 2020-11-18 11:42:02 -08:00
uuid update tests and website and generated partials to reflect new package format 2020-11-17 10:36:01 -08:00
version move version and useragent definitions into sdk 2020-11-18 11:42:02 -08:00
Makefile add makefile and go.mod file to sdk subdir. this'll make it easier to extract when we're ready. TODO: readme 2020-12-11 13:51:10 -08:00
README.md add readme to plugin-sdk subdir 2020-12-11 14:02:41 -08:00
go.mod.example add makefile and go.mod file to sdk subdir. this'll make it easier to extract when we're ready. TODO: readme 2020-12-11 13:51:10 -08:00

README.md

Packer Plugin SDK

This SDK enables building Packer plugins. This allows Packer's users to use both the officially-supported builders, provisioners, and post-processors, and custom in-house solutions.

Packer itself is a tool for building identical machine images for multiple platforms from a single source configuration. You can find more about Packer on its website and its GitHub repository.

Packer CLI Compatibility

Packer v1.7.0 or later is needed for this SDK. Versions of Packer prior to that release are still compatible with third-party plugins, but the plugins should use the plugin tooling from inside earlier versions of Packer to ensure complete API compatibility.

Go Compatibility

The Packer Plugin SDK is built in Go, and uses the support policy of Go as its support policy. The two latest major releases of Go are supported by the SDK.

Currently, that means Go 1.14 or later must be used when building a provider with the SDK.

Getting Started

See the Extending Packer docs for a guided tour of plugin development.

Documentation

See the Extending Packer section on the Packer website.

Packer Scope (Plugins VS Core)

Packer Core

  • acts as an RPC client
  • interacts with the user
  • parses (HCL/JSON) configuration
  • manages build as whole, asks plugin(s) to manage the image lifecycle and modify the image being built.
  • discovers plugin(s) and their versions per configuration
  • manages plugin lifecycles (i.e. spins up & tears down plugin process)
  • passes relevant parts of parsed (valid JSON/HCL) and interpolated configuration to plugin(s)

Packer Provider (via this SDK)

  • acts as RPC server
  • executes any domain-specific logic based on received parsed configuration. For builders this includes managing the vm lifecycle on a give hypervisor or cloud; for provisioners this involves calling the operation on the remote instance.
  • tests domain-specific logic via provided acceptance test framework
  • provides Core with template validation, artifact information, and information about whether the plugin process succeeded or failed.

Migrating to SDK from built-in SDK

Migrating to the standalone SDK v1 is covered on the Plugin SDK section of the website.

Versioning

The Packer Plugin SDK is a Go module versioned using semantic versioning.

Contributing

See .github/CONTRIBUTING.md

License

Mozilla Public License v2.0