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

Cannot docker COPY binary with - in the name? #3545

Closed
3 tasks done
josvazg opened this issue Nov 11, 2022 · 12 comments · Fixed by #3552
Closed
3 tasks done

Cannot docker COPY binary with - in the name? #3545

josvazg opened this issue Nov 11, 2022 · 12 comments · Fixed by #3552
Assignees
Labels
bug Something isn't working

Comments

@josvazg
Copy link

josvazg commented Nov 11, 2022

What happened?

Our Dockerfile used this COPY command:

COPY refs-controller /bin/

But we were getting an error like this:

#6 ERROR: "/refs-controller" not found: not found
------
 > [2/3] COPY refs-controller /bin/:
------
error: failed to solve: failed to compute cache key: "/refs-controller" not found: not found

How can we reproduce this?

Maybe it happens with any binary that includes a - in the name?

We tried this instead:

COPY * /bin/

And we got this in bin:

bin/Dockerfile
bin/refs-controller

So basically we knew that refs-controller was there.

We end up tricking goreleaser with:

COPY *controller /bin/

goreleaser version

goreleaser version dev
goos: linux
goarch: amd64
module version: v1.12.3, checksum: h1:sTJXdkGQO9eAP6pwEUazaD6ERJewZ7yzQexWEGPUVg4=

https://goreleaser.com

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

No response

@josvazg josvazg added bug Something isn't working triage Issue pending triage by one of the maintainers labels Nov 11, 2022
@josvazg
Copy link
Author

josvazg commented Nov 11, 2022

BTW we tried version 1.1.0 and the error was not happening there. We need to use 1.2.x as it is the one the CI pipeline will grab.

@caarlos0
Copy link
Member

goreleaser simply calls docker build, if copy * works, and copy name doesn't, that seems like a docker bug to me...

@josvazg
Copy link
Author

josvazg commented Nov 11, 2022

Weird.
How come then that doing it manually with docker works fine and also that the older goreleaser (1.1) version did not experience the same issue?

@caarlos0
Copy link
Member

I have no idea... is it possible you have a space or some "invisible" char in the binary name? its the only thing that comes to mind...

fwiw if this is a bug in goreleaser since v1.3, a lot of people would be having it... even goreleaser itself probably... so, I'm suspicious its something else entirely

@josvazg
Copy link
Author

josvazg commented Nov 11, 2022

uhm I need to double check that weird character theory... but I think I rewrote that name several times.
I will get back here once tested.

@caarlos0
Copy link
Member

if you have a reproducible repo, I can try here as well..

@josvazg
Copy link
Author

josvazg commented Nov 14, 2022

Reproduced:
https://github.com/josvazg/grfail

Did not need a - in the name. Seems it fails in multi-arch.

@caarlos0
Copy link
Member

ahh, you're missing the goarm option... probably this could be better handled though...

if you add goarm: 6 to line 27 it should work just fine

https://github.com/josvazg/grfail/blob/main/goreleaser.yml#LL26

@caarlos0 caarlos0 removed the triage Issue pending triage by one of the maintainers label Nov 14, 2022
@caarlos0
Copy link
Member

see #3552

@josvazg
Copy link
Author

josvazg commented Nov 14, 2022

Oh I see. Basically the error message was throwing me in a totally wrong direction.

I guess the issue was that, as the goarm version was not selected, then the preparation of the context for ARM was not being done properly and the copy did not find the expected binary name.

But then I still do not understand why the copy with asterisks did work.

caarlos0 added a commit that referenced this issue Nov 14, 2022
fixes #3545

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

probably it worked in the sense that it didn't failed, but the binary was not in the image, just license and other files... maybe you looked into the wrong image later?

@caarlos0
Copy link
Member

fwiw: now it'll default to 6, so it should be a bit better... thinking about it a bit more now, I'll also add a warning if nothing is matched...

caarlos0 added a commit that referenced this issue Nov 14, 2022
refs #3545

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
caarlos0 added a commit that referenced this issue Nov 14, 2022
refs #3545

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants