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

add pkr plugin check cmd from packer core #85

Merged
merged 12 commits into from
Oct 11, 2021
Merged

Conversation

azr
Copy link
Contributor

@azr azr commented Oct 8, 2021

This is simplified to not pull in core as a dep. The drawback is that we don't actually start plugins to verify that it works with Packer and has a ConfigSpec func. We do start a binary though.

But I think this is fine since if a plugin implements describe then we can be pretty sure it uses the SDK's function and interfaces.

Related to hashicorp/packer#11317

closes hashicorp/packer#11309

@azr azr requested a review from a team as a code owner October 8, 2021 14:45
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great. I like the approach of checking the describe output. In the future we might be able to extended it a bit to catch any potential name issues. For example some plugin not using plugin.DEFAULT_NAME for a single component.

Nice work.

cmd/packer-sdc/internal/plugincheck/cmd.go Outdated Show resolved Hide resolved
cmd/packer-sdc/internal/plugincheck/cmd.go Show resolved Hide resolved
Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When testing against a built plugin not in my GoPath I get an error.

~>  tree 
├── packer-plugin-azure
├── packer-plugin-upcloud_v1.2.0_x5.0_darwin_amd64
└── packer-sdc

~>  ./packer-sdc plugin-check packer-plugin-upcloud_v1.2.0_x5.0_darwin_amd64
2021/10/08 12:09:50 failed to describe plugin: exec: "packer-plugin-upcloud_v1.2.0_x5.0_darwin_amd64": executable file not found in $PATH

When we execute describe we might need to determine the absolute path of the binary.

Co-authored-by: Wilken Rivera <wilken@hashicorp.com>
@azr
Copy link
Contributor Author

azr commented Oct 11, 2021

When testing against a built plugin not in my GoPath I get an error.

Good catch, that's weird, I wonder why. It's fixed using the absolute path.

@azr azr merged commit fef2ec6 into main Oct 11, 2021
@azr azr deleted the azr/add-pkr-plugin-check-cmd branch October 11, 2021 09:13
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.

Move packer-plugin-check cmd from Packer to packer-sdc
2 participants