Navigation Menu

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

buildLayeredImage: Allow empty store, no paths to add #80921

Merged

Conversation

roberth
Copy link
Member

@roberth roberth commented Feb 23, 2020

This is useful when buildLayeredImage is called in a generic way
that should allow simple (base) images to be built, which may not
reference any store paths.

For example arion uses it to build a very bare base image for use with the host's Nix store.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@nlewo
Copy link
Member

nlewo commented Feb 24, 2020

It would be nice to add a test case (building and loading such image) because I'm pretty sure nobody will test this behavior in case of refactoring ;)
What do you think?

@roberth
Copy link
Member Author

roberth commented Feb 24, 2020

I agree it would be nice to have a test. I did look for existing tests to add to, but I didn't find any. Or are these supposed to be used as tests? https://github.com/NixOS/nixpkgs/blob/f9388a76344479c3a1855f45a69fc3676905a4e7/pkgs/build-support/docker/examples.nix

@nlewo
Copy link
Member

nlewo commented Feb 25, 2020

@roberth that's not ideally at all, but currently, we add an example image in pkgs/build-support/docker/examples.nix and we use this image in the NixOS test nixos/tests/docker-tools.nix.
Basically, you'd have to add an example image without any path and docker load this image in the test to ensure the image can be loaded by Docker.
The commit baa78de can be used as example.

@roberth roberth force-pushed the buildLayeredImage-allow-empty-store branch from 0115dbc to 9cf1b35 Compare February 28, 2020 10:43
@roberth roberth force-pushed the buildLayeredImage-allow-empty-store branch from 9cf1b35 to 8b2d61a Compare February 28, 2020 10:59
@roberth
Copy link
Member Author

roberth commented Feb 28, 2020

@nlewo I've added a test case.

@nlewo
Copy link
Member

nlewo commented Feb 28, 2020

@roberth Arf, we just merged to Python migration of the test:/ Could you rebase your test?

This is useful when buildLayeredImage is called in a generic way
that should allow simple (base) images to be built, which may not
reference any store paths.
@roberth roberth force-pushed the buildLayeredImage-allow-empty-store branch from 8b2d61a to 6dab1b5 Compare February 28, 2020 13:59
@roberth
Copy link
Member Author

roberth commented Feb 28, 2020

@nlewo rebased.

@flokli flokli requested a review from nlewo March 1, 2020 06:32
@roberth
Copy link
Member Author

roberth commented Mar 2, 2020

This also solves hercules-ci/arion#91 according to manveru.

@nlewo
Copy link
Member

nlewo commented Mar 2, 2020

@GrahamcOfBorg test docker-tools

Copy link
Member

@nlewo nlewo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the test!
I'm just waiting for the bot feedback;)

@roberth
Copy link
Member Author

roberth commented Mar 4, 2020

@GrahamcOfBorg test docker-tools

I'm surprised by the timeout. Output seems to have stopped around here https://github.com/NixOS/nixpkgs/pull/80921/files#diff-1635c3330be60719346294be6c07f88fR153

The preceding test produced output and it should return immediately.
I've tested this locally. (exec -a custom-true busybox) |& grep custom-true and docker run --rm no-store-paths:latest custom-true |& grep custom-true return immediately. Local testing was on 19.09 though.

@domenkozar
Copy link
Member

@GrahamcOfBorg test docker-tools

@domenkozar
Copy link
Member

Seems to pass on rerun.

@domenkozar domenkozar merged commit 508a2c6 into NixOS:master Mar 8, 2020
@domenkozar
Copy link
Member

Backported to 20.03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants