Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No-gob PoC #229

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

No-gob PoC #229

wants to merge 2 commits into from

Conversation

lbajolet-hashicorp
Copy link
Contributor

This PR aims to be a PoC/base for later developments on the wire-protocol for all the components that plugin expose.

We introduce a protobuf-serialisable data structure for hcldec.HCLSpec, which is used by all components of a plugin for describing the schema of what the plugin uses, and offers Packer a type to use to decode cty values from HCL code.

In doing so, we also explored using alternative serialisation formats for datasources, which were the only components leveraging cty's gob serialisation capabilities, and replace them with JSON/msgpack.

These changes make the SDK capable to communicate over-the-wire on recent hcl/cty versions, without needing to use the fork/replace for gob support.

This commit introduces a protobuf-serialisable type for hcldec.Spec
types. We need this be able to use another format to serialise them
without using gob, as gob isn't supported anymore for cty.Type.

The HCL2Spec function, implemented by all the plugins, are the ones
responsible for transmitting the schema of their configurations to
Packer, which as of v0.5.1 of the SDK, is using gob for serialisation,
which has been removed from the cty library.
As follow-up to the introduction of the protobufs for HCLSpec, we
introduce a new environment variable and code to use those structures,
so we don't use gob for serialising HCLSpecs.

This should make the plugins and packer able to transmit data
over-the-wire without using gob for the most part (the communicators
still use it, and will probably need some work to replace).
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.

None yet

1 participant