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

fix: set created property for scratch base #655

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e/assertion/wksp/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local_path_override(
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "empty_image",
digest = "sha256:e40e202a677ddddeaaf4603df278a6da42130d750622f1b1130bdafe6876a6e0",
digest = "sha256:2515b821f7cc895283a961ea6548a29f7eb340a0b8d29f79a0feb3825d31caa9",
image = "http://localhost:1447/empty_image",
)
use_repo(oci, "empty_image")
Expand Down
2 changes: 1 addition & 1 deletion e2e/assertion/wksp/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ load("@rules_oci//oci:pull.bzl", "oci_pull")

oci_pull(
name = "empty_image",
digest = "sha256:e40e202a677ddddeaaf4603df278a6da42130d750622f1b1130bdafe6876a6e0",
digest = "sha256:2515b821f7cc895283a961ea6548a29f7eb340a0b8d29f79a0feb3825d31caa9",
image = "http://localhost:1447/empty_image",
)

Expand Down
6 changes: 5 additions & 1 deletion examples/assert.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def assert_oci_config(
architecture_eq = None,
os_eq = None,
variant_eq = None,
labels_eq = None):
labels_eq = None,
created_eq = None):
"assert that an oci_image has specified config metadata according to https://github.com/opencontainers/image-spec/blob/main/config.md"
pick = []

Expand Down Expand Up @@ -68,6 +69,9 @@ def assert_oci_config(
if variant_eq:
config_json["variant"] = variant_eq

if created_eq:
config_json["created"] = created_eq

pick += ["." + k for k in config_json.keys()]

if len(config.keys()):
Expand Down
13 changes: 13 additions & 0 deletions examples/assertion/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,19 @@ sh_test(
data = [":case12"],
)

# Case 14: created property should be epoch start
oci_image(
name = "case14",
architecture = "arm64",
os = "linux",
)

assert_oci_config(
name = "test_case14",
created_eq = "1970-01-01T00:00:00Z",
image = ":case14",
)

# Case 15: Setting entrypoint resets cmd
oci_image(
name = "case15_base",
Expand Down
2 changes: 1 addition & 1 deletion oci/private/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function base_from_scratch() {
layers: []
}' | update_manifest
# Create the image config when there is annotations
jq -n --argjson platform "$platform" '{config:{}, rootfs:{type: "layers", diff_ids:[]}} + $platform' | update_config >/dev/null
jq -n --argjson platform "$platform" '{created: "1970-01-01T00:00:00Z", config:{}, rootfs:{type: "layers", diff_ids:[]}} + $platform' | update_config >/dev/null
}

function base_from() {
Expand Down
Loading