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

dockerTools.buildLayeredImage: restore layer sharing #62719

Merged
merged 1 commit into from Jun 6, 2019

Conversation

danieldk
Copy link
Contributor

@danieldk danieldk commented Jun 5, 2019

Motivation for this change

PR #58431 added /nix/store to each layer.tar. However, the timestamp was
not explicitly set while adding /nix and /nix/store to the archive. This
resulted in different SHA256 hashes of layer.tar between image builds.

This change sets time and owner when tar'ing /nix/store.

Since #58431 was also backported to 19.03, this change should probably also be backported.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • 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 nix-review --run "nix-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@danieldk
Copy link
Contributor Author

danieldk commented Jun 5, 2019

@GrahamcOfBorg test docker-tools

@danieldk
Copy link
Contributor Author

danieldk commented Jun 5, 2019

cc @grahamc @nlewo

PR NixOS#58431 added /nix/store to each layer.tar. However, the timestamp was
not explicitly set while adding /nix and /nix/store to the archive. This
resulted in different SHA256 hashes of layer.tar between image builds.

This change sets time and owner when tar'ing /nix/store.
@nlewo
Copy link
Member

nlewo commented Jun 6, 2019

@GrahamcOfBorg test docker-tools

@danieldk
Copy link
Contributor Author

danieldk commented Jun 6, 2019

@nlewo I have now also written a NixOS test that checks for two small images that layers are shared. Should I add a commit to this PR or open a new PR after this one is accepted?

@nlewo
Copy link
Member

nlewo commented Jun 6, 2019

Oh, that's really cool if you have a test!

Since this PR fixes a bug, I think it would be better to merge it quickly.
So, could you open another PR with the test?

@danieldk
Copy link
Contributor Author

danieldk commented Jun 6, 2019

Will do!

@nlewo
Copy link
Member

nlewo commented Jun 6, 2019

The test docker-tools passed locally.
Thx!

@nlewo nlewo merged commit b0f4499 into NixOS:master Jun 6, 2019
@nlewo
Copy link
Member

nlewo commented Jun 6, 2019

Backport to 19.03: 09d1200

@danieldk danieldk deleted the docker-fix-shared-layers branch July 6, 2020 17:04
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

2 participants