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

packer 1.7 requires a sha256 checksum #53

Closed
wants to merge 6 commits into from

Conversation

caulagi
Copy link

@caulagi caulagi commented May 22, 2021

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

```
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

Signed-off-by: Pradip Caulagi <caulagi@gmail.com>
Signed-off-by: Pradip Caulagi <caulagi@gmail.com>
Signed-off-by: Pradip Caulagi <caulagi@gmail.com>
@caulagi
Copy link
Author

caulagi commented May 22, 2021

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
Copy link
Contributor

fishnix commented May 24, 2021

@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?

Copy link
Contributor

@fishnix fishnix left a comment

Choose a reason for hiding this comment

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

Just a couple comments on the review, I want to let some users weigh in as well. Are you saying this will fail to build in the current state of our repo because the SDK needs updating?

github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
go-version: 1.15
Copy link
Contributor

Choose a reason for hiding this comment

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

I thought this required go 1.16?

Copy link
Author

@caulagi caulagi May 24, 2021

Choose a reason for hiding this comment

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

Hi - I skipped using 1.16 here because go.mod still uses 1.15 and I see you have a PR for changing this in go.mod. I can change if #54 gets merged first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sounds good

.goreleaser.yml Outdated Show resolved Hide resolved
@jsturtevant
Copy link
Contributor

@fishnix
Copy link
Contributor

fishnix commented May 25, 2021

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
Copy link
Contributor

fishnix commented Jun 15, 2021

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

@caulagi
Copy link
Author

caulagi commented Jun 16, 2021

@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.

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`

Signed-off-by: Pradip Caulagi <caulagi@gmail.com>
Signed-off-by: Pradip Caulagi <caulagi@gmail.com>
@caulagi
Copy link
Author

caulagi commented Jun 29, 2021

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
Copy link
Contributor

fishnix commented Sep 11, 2021

@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!

@fishnix fishnix closed this Sep 11, 2021
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.

3 participants