YaleUniversity / packer-plugin-goss

Goss Provisioner for Packer
MIT License
136 stars 45 forks source link

packer 1.7 requires a sha256 checksum #53

Closed caulagi closed 2 years ago

caulagi commented 3 years ago

I get an error like below with packer 1.7.2

could not get sha256 checksum file for github.com/caulagi/goss version 3.0.3. Is the file present on the release and correctly named ? GET https://github.com/caulagi/packer-plugin-goss/releases/download/v3.0.3/packer-plugin-goss_v3.0.3_SHA256SUMS: 404  []

Also, packer init expects a sha256 checksum file of form *goss_v3.0.5_SHA256SUMS. So I changed the workflow to match what is used in packer-plugin-scaffolding

caulagi commented 3 years ago

The release looks like this - https://github.com/caulagi/packer-plugin-goss/releases/tag/v3.0.4. But I had to update packer-plugin-sdk to use version 0.1.0 and go to 1.16.

fishnix commented 3 years ago

@caulagi thanks for this - my only concern is it changes the name format of the release binaries and the archive format. Although this output might be more correct, we have some projects leveraging these releases through automation.

@EleanorRigby @jsturtevant what do you think about standardizing on zip and separating the version/arch with underscores? Can you make sure these changes work for your use case?

jsturtevant commented 3 years ago

We have tooling that uses tar: https://github.com/kubernetes-sigs/image-builder/blob/6e726d0d92126f6a42d261e7241e9037e8315f9c/images/capi/hack/ensure-goss.sh#L29-L30

Is there a reason to move to zip? cc: @codenrhoden

fishnix commented 3 years ago

thanks @jsturtevant

It seems like goreleaser defaults to tar.gz. Maybe we should stick to that @caulagi

https://goreleaser.com/customization/archive/

    # Archive format. Valid options are `tar.gz`, `tar.xz`, `gz`, `zip` and `binary`.
    # If format is `binary`, no archives are created and the binaries are instead
    # uploaded directly.
    # Default is `tar.gz`.
fishnix commented 3 years ago

@caulagi any thoughts on switching to the default tar.gz for this PR?

caulagi commented 3 years ago

@fishnix I need to test this some more, but I don't think tar.gz will work for packer init - https://github.com/hashicorp/packer/blob/4ebc09f08f87bab780d6a854c05183e800d0eed9/packer/plugin-getter/plugins.go#L307. I will test my changes some more this week and get back.

caulagi commented 3 years ago

I am still working on it. It seems like I need to update the code a bit to use plugin.NewSet(). So I am testing if I need changes in this direction -

+var (
+       // The main version number that is being run at the moment.
+       Version = "3.0.4"
+
+       // A pre-release marker for the Version. If this is "" (empty string)
+       // then it means that it is a final release. Otherwise, this is a pre-release
+       // such as "dev" (in development), "beta", "rc1", etc.
+       VersionPrerelease = "dev"
+)
+
+var PluginVersion *version.PluginVersion
+
+func init() {
+       PluginVersion = version.InitializePluginVersion(
+               Version, VersionPrerelease)
+}
+
+
 func main() {
-       server, err := plugin.Server()
+       pps := plugin.NewSet()
+       pps.RegisterProvisioner(plugin.DEFAULT_NAME, new(Provisioner))
+       pps.SetVersion(PluginVersion)
+       err := pps.Run()
        if err != nil {
-               panic(err)
+               fmt.Fprintln(os.Stderr, err.Error())
+               os.Exit(1)
        }
-       server.RegisterProvisioner(new(Provisioner))
-       server.Serve()
+
 }
fishnix commented 2 years ago

@caulagi I opened PR #57 to cover the stuff we have here but also keep the existing archive format. I thought it might help to break down the effort. If you want to take a stab at the next thing we need to do for compatibility, I'd be happy to see another PR from you! In the meantime, I'm closing this one in favor of #57 . Thanks again!