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

Universal binaries clash between multiple ids when using the same name_template #3061

Closed
3 tasks done
lowdewijk opened this issue Apr 22, 2022 · 3 comments · Fixed by #3063
Closed
3 tasks done

Universal binaries clash between multiple ids when using the same name_template #3061

lowdewijk opened this issue Apr 22, 2022 · 3 comments · Fixed by #3063
Assignees
Labels
bug Something isn't working
Milestone

Comments

@lowdewijk
Copy link

What happened?

I have a config that specifies two different builds of the same binary (one with full capabilities and one with limited capabiities). When I use universal_binaries with two different ids, referencing the two different build ids, but with the same name_template the file paths clash. The result is that one binary overwrites the other and that I get two archives with the same build in it (the one that was specified last).

E.g.:

universal_binaries:
-
  id: my-cli-full
  ids:
  - my-cli-full
  name_template: 'cli'
  replace: true
-
  id: my-cli-limited
  ids:
  - my-cli-limited
  name_template: 'cli'
  replace: true

Will result in two universal binary artifacts, one named full and one named limited, with both only the limited binary in it. You can see why this is happening in the output of goreleaser:

   • universal binaries
      • creating from 2 binaries  binary=dist/cli_darwin_all/cli
      • creating from 2 binaries  binary=dist/cli_darwin_all/cli

How can we reproduce this?

Take any two builds and create two respective universal binary ids for them. Then give them the same name_template.

goreleaser version

1.8.3

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

I've narrowed this down to:

https://github.com/goreleaser/goreleaser/blob/02595554de30243792f4ec803338258e23bf5702/internal/pipe/universalbinary/universalbinary.go

Line 143 says: path := filepath.Join(ctx.Config.Dist, name+"_darwin_all", name)

I believe it should say path := filepath.Join(ctx.Config.Dist, unibin.Id +"_darwin_all", name)

@lowdewijk lowdewijk added bug Something isn't working triage Issue pending triage by one of the maintainers labels Apr 22, 2022
@caarlos0 caarlos0 removed the bug Something isn't working label Apr 22, 2022
@caarlos0 caarlos0 added this to the v1.9.0 milestone Apr 22, 2022
@caarlos0 caarlos0 added bug Something isn't working and removed triage Issue pending triage by one of the maintainers labels Apr 25, 2022
@caarlos0
Copy link
Member

it is this way to mimic the builds, which do the same thing.

maybe this should change, though:

  • use the id instead of the name, on both builds and universal binaries
  • the build id should probably default to the binary name to keep previous behavior

I'll look into it, thanks for reporting

caarlos0 added a commit that referenced this issue Apr 25, 2022
- on universal binaries, use the build id instead of the binary name to
  create the folder in the dist folder
- on builds, default the id the to the binary name instead of project
  name. The binary name already defaults to the project id if empty, so
  this should only prevent having to specify the id + binary name in
  some cases.

closes #3061

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
caarlos0 added a commit that referenced this issue Apr 26, 2022
- on universal binaries, use the build id instead of the binary name to
  create the folder in the dist folder
- on builds, default the id the to the binary name instead of project
  name. The binary name already defaults to the project id if empty, so
  this should only prevent having to specify the id + binary name in
  some cases.

closes #3061

Signed-off-by: Carlos A Becker <caarlos0@gmail.com>
@lowdewijk
Copy link
Author

Thank you 👍

@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