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.buildImage: support impure dates #47005
dockerTools.buildImage: support impure dates #47005
Conversation
Because dates are an impurity, by default buildImage will use a static date of one second past the UNIX Epoch. This can be a bit frustrating when listing docker images in the CLI: $ docker image list REPOSITORY TAG IMAGE ID CREATED SIZE hello latest 08c791c7846e 48 years ago 25.2MB If you want to trade the purity for a better user experience, you can set created to now. pkgs.dockerTools.buildImage { name = "hello"; tag = "latest"; created = "now"; contents = pkgs.hello; config.Cmd = [ "/bin/hello" ]; } and now the Docker CLI will display a reasonable date and sort the images as expected: $ docker image list REPOSITORY TAG IMAGE ID CREATED SIZE hello latest de2bf4786de6 About a minute ago 25.2MB
amazing nerdsnipe! Thank you so much, @graham-at-target !! |
'' | ||
jq ".created = \"$(TZ=utc date --iso-8601="seconds")\"" ${pure} > $out | ||
''; | ||
in if created == "now" then impure else pure; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there was some question about why not just use builtins.currentTime
.
builtins.currentTime
will never be a cache hit, whereas this method will cache while still achieving the intended effect.
I like it! |
This seems like a bad idea because it breaks binary reproducibility. |
@edolstra do you think it is bad to have the ability to break binary reproducibility? This change keeps the reproducibility by default, and but does allow users to make a trade-off. |
It doesn't just provide the ability, but advertises it in the manual as "providing better user experience" (so nudges the user in that direction). BTW, apart from the minor cosmetic aspect of improving the "CREATED" column, how does this improve user experience? |
Well it does provide a better user experience if you're looking at the output of |
what if the docs said:
edit: changed and to but |
This isn't enabled by default right? I don't see a big problem with providing an option that has a small (cosmetic) impurity. |
My impression is the biggest concern is in the too-positive nudge for users to turn it on without understanding the cost. |
@grahamc Yeah something like that sounds good. |
Great! Improved in
7736337
…On Thu, Sep 20, 2018 at 5:05 PM Eelco Dolstra ***@***.***> wrote:
@grahamc <https://github.com/grahamc> Yeah something like that sounds
good.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#47005 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAErrBnIeOmRVzx6Khk5F5gREY1Pl9nLks5udAMBgaJpZM4WybeQ>
.
|
Sounds good! As long as we keep binary reproducibility by default and set up big warning signs, I don’t see why that shouldn’t be an option. |
That's nice. |
Because dates are an impurity, by default buildImage will use a static
date of one second past the UNIX Epoch. This can be a bit frustrating
when listing docker images in the CLI:
If you want to trade the purity for a better user experience, you can
set created to now.
and now the Docker CLI will display a reasonable date and sort the
images as expected:
Motivation for this change
-- https://twitter.com/StewOConnor/status/1042671588447936512
cc @stew
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nox --run "nox-review wip"
./result/bin/
)nix path-info -S
before and after)