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

Publish binary releases to GitHub #1478

Closed
jawnsy opened this issue Oct 7, 2021 · 26 comments
Closed

Publish binary releases to GitHub #1478

jawnsy opened this issue Oct 7, 2021 · 26 comments

Comments

@jawnsy
Copy link

jawnsy commented Oct 7, 2021

This is an issue to discuss adding binaries to GitHub releases for skopeo. I've had good experience with using goreleaser for this, and since skopeo builds with the regular Go toolchain (e.g. go install github.com/containers/skopeo/cmd/skopeo@latest works great), it should be relatively straightforward to add these builds.

Would you accept a pull request to add release builds?

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 7, 2021

Thanks for your report.

Historically we’ve resisted that, because various Linux distributions are not actually binary compatible enough to make a single binary that runs everywhere and integrates correctly, compare e.g. #1336 .

Instead, we provide container images, see https://github.com/containers/skopeo/tree/main/contrib/skopeoimage — that seems to be missing in the installation instructions; ⚠️ note to self: we should fix that.

Podman / Buildah might have more experience in this area; AFAICS they don’t currently publish stand-alone binaries either (apart from Podman-remote). @lsm5 do you know if there is anything Skopeo can/should reuse?

@jawnsy
Copy link
Author

jawnsy commented Oct 7, 2021

Would compiling with the Go compiler instead of cgo help? (as @davidhay1969 mentions in that issue - what a wonderful coincidence to see a familiar name from my IBM life!) Of course, I'm not sure what those libraries are needed for with skopeo, so don't know if compiling with the Go compiler breaks some key functionality.

It also seems that binary builds that work on most recent platforms would still be useful, even if they don't work correctly on an old version of Fedora or similar.

Also, is it possible to statically link the dependencies like devmapper, or is that a very bad idea?

@rhatdan
Copy link
Member

rhatdan commented Oct 8, 2021

I think we go through this statically linking idea every year or two. Just 10 days ago we closed.

#755
#932
#670

Please read these issues, before asking any questions.

We prefer distro based versions of the skopeo or to run a containerized version of skopeo from your favorite distro.

podman run quay.io/skopeo/stable:latest ...

We had a nix version which was eventually removed.

@lsm5
Copy link
Member

lsm5 commented Oct 8, 2021

@mtrmac podman only releases the linux remote client as a static binary, https://github.com/containers/podman/releases/tag/v3.4.0 . Buildah doesn't publish any static assets https://github.com/containers/podman/releases/tag/v3.4.0 .

I see a comment in podman's Makefile saying podman doesn't work well w/o CGO_ENABLED, so that's why only the podman-remote-static target is built without CGO and published.

@jawnsy If you're signing up to maintain the binary release part going forward and have reasonable certainty of goreleaser not breaking/blocking release, I'm cool with it.

The skopeo Makefile does use a DISABLE_CGO variable, but I'd defer to @mtrmac @vrothberg @rhatdan on its impact.

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 8, 2021

DISABLE_CGO loses at least signing, and I don’t know the impact on c/storage.


In general I think everyone can use either containers, or distribution packages that can be installed using distribution tools instead of downloading random binaries from the web, almost all of the time. The one somewhat frequent exception is a recent contributor of, or benefactor from, a specific new Skopeo feature who wants that feature to be available faster than a distribution packages a release — it does happen at least once every year, but it’s also, for most users who want that one new feature, a one-time occurrence.

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 8, 2021

Instead, we provide container images, see https://github.com/containers/skopeo/tree/main/contrib/skopeoimage — that seems to be missing in the installation instructions; ⚠️ note to self: we should fix that.

#1481 .

@jawnsy
Copy link
Author

jawnsy commented Oct 12, 2021

Thanks all for the links and references! I appreciate the context and I understand better the complexity of binary builds given the need to link against various C libraries. Sorry about not searching the issue history first.

Distro packages and building from source seems like a reasonable approach to me, and I understand the extra maintenance associated with maintaining this stuff.

One thing to note is that Skopeo is not currently available as a distro package on Ubuntu 20.04 (LTS), though an alternative is to pin the new version instead. Would you consider a doc PR explaining how to add that pin? I'd be happy to open one.

Thanks for the awesome libraries and tool!

@lsm5
Copy link
Member

lsm5 commented Oct 12, 2021

One thing to note is that Skopeo is not currently available as a distro package on Ubuntu 20.04 (LTS), though an alternative is to pin the new version instead. Would you consider a doc PR explaining how to add that pin? I'd be happy to open one.

would this help: https://build.opensuse.org/package/show/devel:kubic:libcontainers:stable/skopeo ?

@jpetazzo
Copy link
Contributor

I would also appreciate a lot to have static binaries (or pseudo-static binaries that only depend on the glibc[1]), for the following use-cases:

  • teaching (in a short workshop it's easier if folks can download a binary that "just works" rather than wasting 10-15 minutes for everyone to figure out the steps specific to their environments; especially as there are no packages for Windows for now)
  • CI/CD tooling images (it's best if each tool can be installed as a single binary as well, to minimize image size and simplify the maintenance of these images)

But I also understand the associated technical difficulties; when building the Docker Engine as a static binary, devmapper was a regular pain point, indeed.

Rather than completely dropping static binary support, would you be OK with having e.g. instructions (perhaps even a Dockerfile or similar) to build a static binary, coming with a big warning informing of the potential issues?

[1] Most of the "cloud native tools" that I use daily, or in CI/CD pipelines, are dynamic Go programs that only depend on the glibc and a reasonably recent linker. They won't work on Alpine, but they typically work on any recent glibc-based system (including some Ubuntu 18.04, and sometimes 16.04, environments). They're not truly static, but they "just work" on the vast majority of systems out there.

@vrothberg
Copy link
Member

Rather than completely dropping static binary support, would you be OK with having e.g. instructions (perhaps even a Dockerfile or similar) to build a static binary, coming with a big warning informing of the potential issues?

I think that is a nice compromise, @jpetazzo.

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 13, 2021

I would also appreciate a lot to have static binaries (or pseudo-static binaries that only depend on the glibc[1]), for the following use-cases:

  • teaching (in a short workshop it's easier if folks can download a binary that "just works" rather than wasting 10-15 minutes for everyone to figure out the steps specific to their environments

Don’t the containers serve that purpose, especially in a container-focused course?

; especially as there are no packages for Windows for now)

(FWIW with Windows-native, the binary compatibility is probably not an issue, but to my knowledge no-one has worked on making Skopeo a good Windows citizen, e.g. looking for configuration files in the right places.)

  • CI/CD tooling images (it's best if each tool can be installed as a single binary as well, to minimize image size and simplify the maintenance of these images)

Presumably the CI/CD system is not a personal Linux-from-scratch, so can it use a distribution package?


Rather than completely dropping static binary support, would you be OK with having e.g. instructions (perhaps even a Dockerfile or similar) to build a static binary, coming with a big warning informing of the potential issues?

We’ve had that, using various approaches, in the Makefile, during most of the history of the project, but they were always replaced (or ultimately removed) after someone noticed, usually after months, that the make rules don’t actually work. (That’s why the Nix-based last version was removed recently.)

So I think we’re open to a contributor maintaining such build rules, but it’s also, based on how rarely they have been used in the past, not something that warrants us investing extra maintenance effort.

@jpetazzo
Copy link
Contributor

@vrothberg: Thanks a lot for the feedback!

@mtrmac: I'll give you a couple of real-life examples.

Recently, during a Kubernetes training, we hit the Docker Hub rate limits; so I showed the students how to set up and use registry mirrors. We copied some images around using docker pull/tag/push, but I thought it would be better to show the students how to do it with Skopeo. Our lab environments use Ubuntu LTS. We were using a local registry that we quickly deployed using a NodePort, allowing us to hit the registry over localhost (thus not requiring a TLS cert). We ran Skopeo in a container, but then it couldn't access the cluster's NodePort on localhost. Finally we ran Skopeo in a container with host network, and it worked; but it was a lot of extra steps - not a problem at all if you're an experienced engineer who is familiar with all these components, but definitely confusing for some of the students.

Now, for CI/CD tools, it's pretty common to use someone's image and add the tool(s) that you need on top of that. If the extra tools are all static binaries, it works without any particular work. Otherwise, I have to think about "which packaging system is used here?" and that adds dependency and coupling. Furthermore, if I try to produce smaller images, a tool that carries dynamic libraries is harder to deal with.

Please don't get me wrong; I'm not saying "HEY YOU SHOULD SUPPORT THIS RIGHT NOW!!!" 😃 I'm just giving you the "user stories" behind that particular need. (We had very similar conversations with the Docker core team in 2013 when figuring out how to distribute the first builds of Docker, btw!)

That being said, I played a bit with the build chain tonight, and it looks like I can produce an "almost static" binary by running this from a checkout of the repo:

docker run -ti -v $PWD:/src -w /src -e CGO_ENABLED=0 golang make BUILDTAGS=containers_image_openpgp

Interestingly, ldd says it's static, but file thinks otherwise:

[jp@большой (⎈ |minikube:default) skopeo]
$ ldd bin/skopeo 
	statically linked
[jp@большой (⎈ |minikube:default) skopeo]
$ file bin/skopeo 
bin/skopeo: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=PgEimZlTOq_9gJTZ4Fku/8KQ23f8e-kzXL0H0aDSf/tmJ8847pUBISy1LyL87L/i23eSdwlzqvX3MQpbHfE, not stripped

But it runs in a bare Ubuntu container:

[jp@большой (⎈ |minikube:default) skopeo]
$ docker run -v $PWD/bin:/usr/local/bin ubuntu skopeo --version
skopeo version 1.5.1-dev commit: 9c9a9f3a1f6f61e4ab2f20370d80db05b96fcdcc

I'm going to do some additional testing to check that it works for me; then I'll document that somewhere (with appropriate warnings of course). I'm not very happy about the whole "ldd says it's static but file says otherwise" situation (it's probably the symptom of a deeper issue; which doesn't surprise me - I'm not a Go/CGO expert, so it's not very likely that I could come up with a solution to that build problem in an hour of hack time😆) but perhaps it can be useful to others!

@mtrmac
Copy link
Collaborator

mtrmac commented Oct 14, 2021

FWIW compare 0f458ee , which points at the last two versions of that implementation. I haven’t now tested which of the two, if any, currently works as expected.

jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 18, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 18, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 18, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
@jpetazzo
Copy link
Contributor

I gave this another try, and after removing the -buildmode=pie flag, I was able to obtain a "true" static binary. I added the instructions to the README with a bunch of red tape in #1483; I hope this helps. Happy to amend/edit if necessary!

jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 18, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 18, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
@joaompinto
Copy link

We prefer distro based versions of the skopeo or to run a containerized version of skopeo from your favorite distro.

Static binaries have well documented limitations and implications, nevertheless they have been enabling a wider adoption of many open source projects in a "distroless" fashion. I do not fully understand the technical motivation for this preference, can you please elaborate ?

Having in consideration that static binary use cases have been presented, and interested people can contribute to the maintenance of this option, can you elaborate on the actual negative impacts for the Skopeo project of providing static binaries ?

Thanks

jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 19, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
jpetazzo added a commit to jpetazzo/skopeo that referenced this issue Oct 19, 2021
Following the discussion in containers#1478, we don't want to provide
(and maintain) static binaries, but giving instructions to
produce such builds (with appropriate warnings around these
instructions) was considered acceptable, so - here we go!
@vrothberg
Copy link
Member

@joaompinto install.md mentions a list of issues and previous discussions with static binaries.

@joaompinto
Copy link

@vrothberg thanks for the info. However I could not find answers to the specific questions I presented in this open issue, can you please elaborate ?

Thanks

@jpetazzo
Copy link
Contributor

Hi @joaompinto! I was hoping that the explanations that I added at the end of the install.md file would help; but perhaps they're not detailed enough.

If I understand correctly, your two questions are:

Static binaries have well documented limitations and implications, nevertheless they have been enabling a wider adoption of many open source projects in a "distroless" fashion. I do not fully understand the technical motivation for this preference, can you please elaborate ?

The technical motivation for not having static builds is that they would lack some features, like “ .local or LDAP-based name resolution” or support for some storage backends like device mapper.

I'm going to give you a loose comparison: it would be like shipping a web browser without HTTPS. Sure, it might still be useful to lots of people; but it might also be very surprising to lots of other people to realize that the browser doesn't have HTTPS. So instead, the choice was to not provide static builds, but still provide instructions for folks who really need that.

Having in consideration that static binary use cases have been presented, and interested people can contribute to the maintenance of this option, can you elaborate on the actual negative impacts for the Skopeo project of providing static binaries ?

If I understand correctly, in the past, multiple people have contributed static builds (as illustrated by the GH issues referenced at the end of install.md) but each time, these build methods ended up failing, and the people who contributed them weren't around to fix them anymore, or couldn't fix them. So it ends up bringing additional burden on the maintainers.

This is a frequent problem in open source projects: someone wants a feature, contributes it, but doesn't maintain it; so when the feature breaks, it's extra work for the maintainers. This is something that should be avoided.

That being said, perhaps if someone wants to commit to maintaining static builds, the Skopeo maintainers would be open to merge that for good.

Or, just an idea: perhaps someone (you?) could create and maintain static builds "on the side". These builds could be linked in the install.md document along the instructions we have today. If these builds remain stable and usable for long enough, that would demonstrate that the maintainers of these builds are committed to them, and then the Skopeo maintainers may decide to make them part of the official builds. I hope that makes sense!

@mtrmac
Copy link
Collaborator

mtrmac commented Nov 2, 2021

That being said, perhaps if someone wants to commit to maintaining static builds, the Skopeo maintainers would be open to merge that for good.

Yes, even without the “commit to” part:

So I think we’re open to a contributor maintaining such build rules, but it’s also, based on how rarely they have been used in the past, not something that warrants us investing extra maintenance effort.

@mtrmac
Copy link
Collaborator

mtrmac commented Nov 2, 2021

… oh, I’m sorry, I have confused “maintaining builds” and “maintaining build rules”. We are absolutely fine with including contributed Makefile rules and the like (which is what we had in the past).

I’m reluctant to officially publish static builds (and we never did publish them), because I personally believe most users should not use them, even if they happen to be the easiest option at a first glance; so, not publishing the binaries is a way to nudge users towards a second glance. (For another reason, consider that distribution packages are usually digitally signed using long-term keys that the system already trusts, in a way binaries distributed over GitHub or whatever are not; we could have our own keys, and the consumers of the static binaries could, in principle, verify signatures, but frankly most aren’t going to do that, and it’s an extra hassle for everyone.)

@joaompinto
Copy link

I think you are being overzealous in this policy, and again debating as a general principle about the risk of distributing static binaries. But well, it's the freedom of Free software. I will try to publish/maintain the binaries own my own repo.

Thanks for the feedback.

@vrothberg
Copy link
Member

Thanks everyone for the conversation. I think we can close the issue.

@lework
Copy link

lework commented May 1, 2022

I use github action ci to generate binary files.

https://github.com/lework/skopeo-binary/releases

@willzhang
Copy link

我使用 github action ci 生成二进制文件。

https://github.com/lework/skopeo-binary/releases

in ubuntu 22.04 is work!

@ghost
Copy link

ghost commented Mar 7, 2023

I use github action ci to generate binary files.

https://github.com/lework/skopeo-binary/releases

Thank you so much for your work, you saved my problem with source build error on Centos7 with yum install only getting old version.

@koolay
Copy link

koolay commented May 7, 2023

gorelaser may be help.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

10 participants