Skip to content

Commit bf40c15

Browse files
committed
fix: set created property for scratch base
1 parent e822897 commit bf40c15

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

examples/assert.bzl

+5-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ def assert_oci_config(
3030
architecture_eq = None,
3131
os_eq = None,
3232
variant_eq = None,
33-
labels_eq = None):
33+
labels_eq = None,
34+
created_eq = None):
3435
"assert that an oci_image has specified config metadata according to https://github.com/opencontainers/image-spec/blob/main/config.md"
3536
pick = []
3637

@@ -66,6 +67,9 @@ def assert_oci_config(
6667
if variant_eq:
6768
config_json["variant"] = variant_eq
6869

70+
if created_eq:
71+
config_json["created"] = created_eq
72+
6973
pick += ["." + k for k in config_json.keys()]
7074

7175
if len(config.keys()):

examples/assertion/BUILD.bazel

+13
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,19 @@ sh_test(
385385
data = [":case12"],
386386
)
387387

388+
# Case 14: created property should be epoch start
389+
oci_image(
390+
name = "case14",
391+
architecture = "arm64",
392+
os = "linux",
393+
)
394+
395+
assert_oci_config(
396+
name = "test_case14",
397+
created_eq = "1970-01-01T00:00:00Z",
398+
image = ":case14",
399+
)
400+
388401
# build them as test.
389402
build_test(
390403
name = "test",

oci/private/image.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function base_from_scratch() {
2727
layers: []
2828
}' | update_manifest
2929
# Create the image config when there is annotations
30-
jq -n --argjson platform "$platform" '{config:{}, rootfs:{type: "layers", diff_ids:[]}} + $platform' | update_config >/dev/null
30+
jq -n --argjson platform "$platform" '{created: "1970-01-01T00:00:00Z", config:{}, rootfs:{type: "layers", diff_ids:[]}} + $platform' | update_config >/dev/null
3131
}
3232

3333
function base_from() {

0 commit comments

Comments
 (0)