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

invalid archive error when using goreleaser-pro #3383

Closed
3 tasks done
ryancurrah opened this issue Sep 16, 2022 · 5 comments · Fixed by #3385
Closed
3 tasks done

invalid archive error when using goreleaser-pro #3383

ryancurrah opened this issue Sep 16, 2022 · 5 comments · Fixed by #3385
Assignees
Labels
bug Something isn't working

Comments

@ryancurrah
Copy link
Contributor

ryancurrah commented Sep 16, 2022

What happened?

When using goreleaser-pro's includes feature and generating multiple binaries and a single archive we get an error.

╰─ goreleaser release --skip-publish --rm-dist
  • by using this software you agree with its EULA, available at https://goreleaser.com/eula
  • running goreleaser v1.11.3-pro (outdated, latest is v1.11.2-pro)
  • starting release...
  • loading config file                              file=.goreleaser.yaml
  • importing .goreleaser.common.yml
  • loading environment variables
  • getting and validating git state
    • couldn't find any tags before "v0.1.1"
    • building...                                    commit=e1282a48bb70ae920118492137d979f0a18317e7 latest tag=v0.1.1
  • parsing tag
  • setting defaults
  • checking distribution directory
    • --rm-dist is set, cleaning it up
  • loading go mod information
  • build prerequisites
  • writing effective config file
    • writing                                        config=dist/config.yaml
  • generating changelog
    • writing                                        changelog=dist/CHANGELOG.md
  • building binaries
    • building                                       binary=dist/cli_darwin_amd64_v1/helloworld
    • building                                       binary=dist/worker_linux_amd64_v1/helloworld
    • building                                       binary=dist/api_linux_amd64_v1/helloworld
    • took: 5s
  • archives
  ⨯ release failed after 5s                  error=invalid archive: 1: archive has different count of built binaries for each platform, which may cause your users confusion. Please make sure all builds used have the same set of goos/goarch/etc or split it into multiple archives

The error is invalid archive: 1: archive has different count of built binaries for each platform, which may cause your users confusion. Please make sure all builds used have the same set of goos/goarch/etc or split it into multiple archives.

At our company we use a common .goreleaser.common.yml file across all modules with sane defaults for us. One of those common configs is to not generate any archives (we do not need them generally and creating archives increases the build times due to time spent compressing the binaries).

You can see how we configure that here in my replication of the issue: https://github.com/ryancurrah/goreleaser-pro-bug/blob/main/.goreleaser.common.yml.

Using that common config and then creating an archive in the .goreleaser.yml for a CLI we get the above error. Example .goreleaser.yml here: https://github.com/ryancurrah/goreleaser-pro-bug/blob/main/.goreleaser.yaml.

Important note it is only when there is more than two builds this error occurs. If you comment out the api build in my example we will not run in to the error.

How can we reproduce this?

I have created simple replication of the issue in a git repository located here: https://github.com/ryancurrah/goreleaser-pro-bug.

Run the following commands to reproduce the error.

export GORELEASER_KEY="<YOUR_PRO_KEY_HERE>"
git clone https://github.com/ryancurrah/goreleaser-pro-bug.git
cd goreleaser-pro-bug
goreleaser release --skip-publish --rm-dist

goreleaser version

v1.11.3-pro

GoReleaser Check

  • goreleaser check shows no errors

Search

  • I did search for other open and closed issues before opening this.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Additional context

This has been an issue for a while I just haven't had the time to report it. So it's not something new that broke.

@ryancurrah ryancurrah added bug Something isn't working triage Issue pending triage by one of the maintainers labels Sep 16, 2022
@caarlos0
Copy link
Member

not specific to goreleaser pro, I'm afraid.

If you just merge the two config files manually (like so), and run goreleaser (either pro or oss), it will fail as well.

The problem seems to be in an error handling for different binary counts, not taking into account that the second archive (idx 1) is binary format... I'll if its fixable, and either way will make the error clearer...

@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Sep 17, 2022
caarlos0 added a commit that referenced this issue Sep 17, 2022
closes #3383

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member

fixed in #3385

caarlos0 added a commit that referenced this issue Sep 17, 2022
closes #3383

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
@caarlos0
Copy link
Member

caarlos0 commented Sep 17, 2022

fwiw, I'm planning to release this late sunday (gmt-3), but I'll release a pro nightly right now.

you can also work around it by adding multiple archive configs (one for each build id) as a workaround.

thanks for reporting this, it has been a bug for a long time :D


edit: link: https://github.com/goreleaser/goreleaser-pro/releases/tag/nightly

@ryancurrah
Copy link
Contributor Author

Thanks @caarlos0 devs here are going to appreciate this a lot!

@github-actions
Copy link
Contributor

github-actions bot commented Dec 5, 2022

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants