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

migration for github.com/hashicorp/packer/packer-plugin-sdk plugins? #1

Open deric4 opened 3 years ago

deric4 commented 3 years ago

This may have been documented somewhere along the way not to use the intermediate sdk path, but when trying to run the check command I get the following output:

$ packer-sdk-migrator check 
Checking Go runtime version ...
Go version 1.14.1: OK.
Checking whether plugin uses Go modules...
Go modules in use: OK.
Checking version of github.com/hashicorp/packer-plugin-sdk to determine if plugin was already migrated...
plugin already migrated, but SDK version 0.0.6 does not satisfy constraint >=0.1.0.

Hoping a find/replace to convert all those back to the "original" path and then run the migration will work 🤞

SwampDragons commented 3 years ago

Sorry, this one's my bad. I will push a fix that'll fix the check (v0.1.0 doesn't exist yet).

SwampDragons commented 3 years ago

Ok, you should at least use SDK version 0.0.11; probably this is as simple as updating your go.mod file, rather than having to re-migrate; the API versioning changed in that SDK version, and that API is going to be following semantic versioning between core and plugins from here on out.

If you link me to your repo I can help you finish the migration.

deric4 commented 3 years ago

@SwampDragons thanks for the quick response! My production CI pipelines were failing so ended up just ended up doing it the hard way and migrated back to v1.6.5 , then forward without too much of a problem and at least the trains are moving now 🚂 😄

I may have gotten a little greedy wanting to use some of the newer features when i saw the v1.6.6. CHANGELOG and had scattered github.com/hashicorp/packer/packer-plugin-sdk and github.com/hashicorp/packer-plugin-sdk around in a few places so I could reconstruct a StateBag from a previous build and only run the copying/sharing/tag steps lol 🌀

import (
     packersdk "github.com/hashicorp/packer/packer-plugin-sdk/packer"
    "github.com/hashicorp/packer-plugin-sdk/template/interpolate"
)

The path_conversions.go file was a huge help: https://github.com/hashicorp/packer-sdk-migrator/blob/bd62e673d9f9b19cd3fe9dfb0838155c743c8103/util/path_coversions.go#L44-L52

Thanks for making cool stuff!

SwampDragons commented 3 years ago

Thanks! Glad it was helpful.