forked from mirrors/nixpkgs
dockerTools.buildLayeredImage: fix created=now
This commit is contained in:
parent
0dbc88331f
commit
66737168a4
|
@ -90,13 +90,22 @@ import ./make-test-python.nix ({ pkgs, ... }: {
|
|||
|
||||
with subtest("Ensure Docker images can use an unstable date"):
|
||||
docker.succeed(
|
||||
"docker load --input='${examples.bash}'"
|
||||
"docker load --input='${examples.unstableDate}'"
|
||||
)
|
||||
assert unix_time_second1 not in docker.succeed(
|
||||
"docker inspect ${examples.unstableDate.imageName} "
|
||||
+ "| ${pkgs.jq}/bin/jq -r .[].Created"
|
||||
)
|
||||
|
||||
with subtest("Ensure Layered Docker images can use an unstable date"):
|
||||
docker.succeed(
|
||||
"docker load --input='${examples.unstableDateLayered}'"
|
||||
)
|
||||
assert unix_time_second1 not in docker.succeed(
|
||||
"docker inspect ${examples.unstableDateLayered.imageName} "
|
||||
+ "| ${pkgs.jq}/bin/jq -r .[].Created"
|
||||
)
|
||||
|
||||
with subtest("Ensure Layered Docker images work"):
|
||||
docker.succeed(
|
||||
"docker load --input='${examples.layered-image}'",
|
||||
|
|
|
@ -354,4 +354,14 @@ rec {
|
|||
Env = [ "USER=root" ];
|
||||
};
|
||||
};
|
||||
|
||||
# 20. Ensure that setting created to now results in a date which
|
||||
# isn't the epoch + 1 for layered images.
|
||||
unstableDateLayered = pkgs.dockerTools.buildLayeredImage {
|
||||
name = "unstable-date-layered";
|
||||
tag = "latest";
|
||||
contents = [ pkgs.coreutils ];
|
||||
created = "now";
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ import pathlib
|
|||
import tarfile
|
||||
import itertools
|
||||
import threading
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timezone
|
||||
from collections import namedtuple
|
||||
|
||||
|
||||
|
@ -242,7 +242,7 @@ def main():
|
|||
conf = json.load(f)
|
||||
|
||||
created = (
|
||||
datetime.now(tz=datetime.timezone.utc)
|
||||
datetime.now(tz=timezone.utc)
|
||||
if conf["created"] == "now"
|
||||
else datetime.fromisoformat(conf["created"])
|
||||
)
|
||||
|
@ -280,7 +280,7 @@ def main():
|
|||
},
|
||||
"history": [
|
||||
{
|
||||
"created": conf["created"],
|
||||
"created": datetime.isoformat(created),
|
||||
"comment": f"store paths: {layer.paths}"
|
||||
}
|
||||
for layer in layers
|
||||
|
|
Loading…
Reference in a new issue