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: #120 (and #115?) in MacOS #136

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
39 changes: 24 additions & 15 deletions examples/debian_snapshot/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ load("@aspect_bazel_lib//lib:tar.bzl", "tar")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_distroless//distroless:defs.bzl", "cacerts", "group", "passwd")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")

COMPATIBLE_WITH = select({
"@platforms//cpu:x86_64": ["@platforms//cpu:x86_64"],
"@platforms//cpu:arm64": ["@platforms//cpu:arm64"],
}) + [
"@platforms//os:linux",
]

passwd(
name = "passwd",
Expand Down Expand Up @@ -75,7 +82,10 @@ oci_image(
"SSL_CERT_FILE": "/etc/ssl/certs/ca-certificates.crt",
},
os = "linux",
tags = ["manual"],
# NOTE: this is needed because, otherwise, bazel test //... fails, even
# when container_structure_test already has target_compatible_with.
# See 136
target_compatible_with = COMPATIBLE_WITH,
tars = [
# This target contains all the installed packages.
"@bullseye//:flat",
Expand Down Expand Up @@ -111,13 +121,17 @@ platform_transition_filegroup(
}),
)

# oci_load(
# name = "tarball",
# image = ":image_platform",
# repo_tags = [
# "distroless/test:latest",
# ],
# )
oci_load(
name = "tarball",
image = ":image_platform",
repo_tags = [
"distroless/test:latest",
],
# NOTE: this is needed because, otherwise, bazel test //... fails, even
# when container_structure_test already has target_compatible_with.
# See 136
target_compatible_with = COMPATIBLE_WITH,
)

container_structure_test(
name = "test",
Expand All @@ -126,10 +140,5 @@ container_structure_test(
"@platforms//cpu:x86_64": ["test_linux_amd64.yaml"],
}),
image = ":image_platform",
target_compatible_with = select({
"@platforms//cpu:x86_64": ["@platforms//cpu:x86_64"],
"@platforms//cpu:arm64": ["@platforms//cpu:arm64"],
}) + [
"@platforms//os:linux",
],
target_compatible_with = COMPATIBLE_WITH,
)
22 changes: 16 additions & 6 deletions examples/ubuntu_snapshot/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_distroless//distroless:defs.bzl", "group", "passwd")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")

COMPATIBLE_WITH = select({
"@platforms//cpu:x86_64": ["@platforms//cpu:x86_64"],
"@platforms//cpu:arm64": ["@platforms//cpu:arm64"],
}) + [
"@platforms//os:linux",
]

passwd(
name = "passwd",
entries = [
Expand Down Expand Up @@ -52,6 +59,10 @@ oci_image(
"@platforms//cpu:x86_64": "amd64",
}),
os = "linux",
# NOTE: this is needed because, otherwise, bazel test //... fails, even
# when container_structure_test already has target_compatible_with.
# See 136
target_compatible_with = COMPATIBLE_WITH,
tars = [
":sh",
":passwd",
Expand All @@ -66,6 +77,10 @@ oci_load(
repo_tags = [
"distroless/noble:latest",
],
# NOTE: this is needed because, otherwise, bazel test //... fails, even
# when container_structure_test already has target_compatible_with.
# See 136
target_compatible_with = COMPATIBLE_WITH,
)

container_structure_test(
Expand All @@ -75,10 +90,5 @@ container_structure_test(
"@platforms//cpu:x86_64": ["test_linux_amd64.yaml"],
}),
image = ":noble",
target_compatible_with = select({
"@platforms//cpu:x86_64": ["@platforms//cpu:x86_64"],
"@platforms//cpu:arm64": ["@platforms//cpu:arm64"],
}) + [
"@platforms//os:linux",
],
target_compatible_with = COMPATIBLE_WITH,
)