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

Discuss: a meta-package for buildpacks? #80

Open
jonjohnsonjr opened this issue Dec 9, 2019 · 5 comments
Open

Discuss: a meta-package for buildpacks? #80

jonjohnsonjr opened this issue Dec 9, 2019 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@jonjohnsonjr
Copy link
Collaborator

Dropping a rough sketch of what I had in mind so we can collect thoughts here.

Buildpacks don't currently have a way for users to specify which OS packages they require for their image. There is a related RFC, but I had an idea for how we could "solve" this with nixery in the short term. In the long term, we'll probably want to maintain a NixOS "stack", which would probably also involve nixery in some way :)

I'm not familiar with the implementation of the shell meta-package, but if the mechanism is reasonably extensible, I'd like to propose a buildpacks meta-package that sets sufficient config metadata to use nixery for a buildpacks run image.

tl;dr at a minimum:

  • Add a label with a globally unique Stack ID representing nixery.
  • Set the UID/GID to a specific value (let's pick something arbitrary, say 1000) that matches the build image.

One thing to consider is how this affects rebasing of the produced images. It's unclear if there are ABI compatibility guarantees for updated nix packages, but my overall impression is that it's probably a non-issue?

@tazjin tazjin added the enhancement New feature or request label Dec 9, 2019
@tazjin
Copy link
Owner

tazjin commented Dec 9, 2019

if the mechanism is reasonably extensible, I'd like to propose a buildpacks meta-package that sets sufficient config metadata to use nixery for a buildpacks run image

This is reasonably easy to do. The mechanism is extensible (not yet in an ideal way, but this would be the third meta-package so it's not too bad). I'll need to understand how the stack IDs work etc. before making a concrete complexity judgement.

It's unclear if there are ABI compatibility guarantees for updated nix packages, but my overall impression is that it's probably a non-issue

It's a non-issue for packages built by Nix, because those are linking absolute dependency paths in the Nix store. Users running arbitrary other software on top might face more of an issue with this.

One way to work around this would potentially be the introduction of FHS-compatible symlink layers (see #58). I suspect that the requirement for ABI compatibility here stems from legacy build systems which make it difficult to separate build & runtime dependencies, but need to read a bit more about the Buildpack setup!

@jonjohnsonjr
Copy link
Collaborator Author

The ABI compatibility is mostly about upgrading packages within a stack, which is why defining a stack ID is required. As part of post-deployment image lifecycle, buildpacks can "rebase" images on top of a new run image (e.g. when vulnerabilities are detected). It doesn't actually do a complete rebuild of the image, just swap out the layers in-registry, so doing this safely requires that anything depending on the original layers isn't broken by the newly rebased layers.

The whole talk is worth watching, but here's a good timestamp from a kubecon talk: https://youtu.be/j9Ak5YLrihU?t=1333

@tazjin
Copy link
Owner

tazjin commented Dec 9, 2019

Thanks, I'll take a look!

@tazjin tazjin self-assigned this Dec 13, 2019
@tazjin
Copy link
Owner

tazjin commented Dec 13, 2019

I've started looking into this and it seems like I need to switch Nixery over to using the OCI image specification, as I can't find any references to the label fields in the spec for the vnc.docker.container.* types.

This might be the point where Nixery should switch to using ggcr for the image types instead of maintaining this stuff separately.

@jonjohnsonjr
Copy link
Collaborator Author

Labels are defined here, but I won't stop you from switching over to using ggcr :)

tazjin added a commit that referenced this issue Dec 15, 2019
Adds a meta-package called `bp.run` that sets the labels and user
configuration required by Buildpack run images.

This implements a MVP of what is being discussed in #80.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants