hashicorp / packer-sdk-migrator

cli tool to help plugin maintainers update from packer v1.5.0 style plugins to packer style v1.7.0 plugins
Mozilla Public License 2.0
4 stars 3 forks source link

packer-sdk-migrator

The Packer plugin plugin SDK, previously part of the github.com/hashicorp/packer "Core" Go module, has been moved to a new Go module, github.com/hashicorp/packer-plugin-sdk. Packer plugins should now import hashicorp/packer-plugin-sdk.

packer-sdk-migrator is a CLI tool which will migrate a Packer plugin to the new SDK module by rewriting import paths. packer-sdk-migrator check checks the eligibility of the plugin for migration.

Installation

go install github.com/hashicorp/packer-sdk-migrator
$GOBIN/packer-sdk-migrator

packer-sdk-migrator check: check eligibility for migration

Checks whether a Packer plugin is ready to migrate to the newly extracted Packer SDK package.

packer-sdk-migrator check [PATH] [--help]

Outputs a report containing:

Exits 0 if the plugin meets all the hard requirements, 1 otherwise.

The Go version requirement is a "soft" requirement: it is strongly recommended to upgrade to Go version 1.12+ before migrating to the new SDK, but the migration can still be performed if this requirement is not met.

packer-sdk-migrator migrate: migrate to standalone SDK

Migrates the Packer plugin to the new extracted SDK (github.com/hashicorp/packer-plugin-sdk), replacing references to the old SDK (github.com/hashicorp/packer).

Note: No backup is made before modifying files. Please make sure your VCS staging area is clean.

packer-sdk-migrator migrate [PATH] [-help]

The eligibility check will be run first: migration will not proceed if this check fails.

The migration tool will then make the following changes:

If you use vendored Go dependencies, you should run go mod vendor afterwards.