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

update oci_go_image #377

Merged
merged 2 commits into from
Dec 5, 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 oci_go_image/.bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.1.0
7.4.1
17 changes: 8 additions & 9 deletions oci_go_image/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("@aspect_bazel_lib//lib:testing.bzl", "assert_archive_contains")
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@container_structure_test//:defs.bzl", "container_structure_test")
load("@rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_tarball")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
load("@rules_pkg//:pkg.bzl", "pkg_tar")

go_library(
Expand Down Expand Up @@ -51,24 +51,23 @@ platform_transition_filegroup(
}),
)

# $ bazel build :tarball
# $ docker load --input $(bazel cquery --output=files :tarball)
# $ bazel run :load
# $ docker run --rm gcr.io/example:latest
# string(
# - "Hello World",
# + "Hello Go",
# )
oci_tarball(
name = "tarball",
# Use the image built for the exec platform rather than the target platform
image = ":image",
oci_load(
name = "load",
# Use the image built for the target platform
image = ":transitioned_image",
repo_tags = ["gcr.io/example:latest"],
)

container_structure_test(
name = "test",
configs = ["test.yaml"],
# Use the image built for the exec platform rather than the target platform
image = ":image",
# Use the image built for the target platform as it runs through docker
image = ":transitioned_image",
tags = ["requires-docker"],
)
18 changes: 7 additions & 11 deletions oci_go_image/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
bazel_dep(name = "aspect_bazel_lib", version = "1.31.1")
bazel_dep(name = "container_structure_test", version = "1.15.0")
bazel_dep(name = "gazelle", version = "0.31.0")
bazel_dep(name = "platforms", version = "0.0.5")
bazel_dep(name = "rules_oci", version = "1.2.0")
bazel_dep(name = "rules_pkg", version = "0.8.1")
bazel_dep(name = "rules_go", version = "0.39.1")
bazel_dep(name = "aspect_bazel_lib", version = "2.9.4")
bazel_dep(name = "container_structure_test", version = "1.19.1")
bazel_dep(name = "gazelle", version = "0.40.0")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_oci", version = "2.0.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_go", version = "0.50.1")

go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")

go_deps.module(
path = "github.com/google/go-cmp",
sum = "h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=",
version = "v0.5.9",
)

use_repo(go_deps, "com_github_google_go_cmp")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")

oci.pull(
name = "distroless_base",
digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86",
Expand All @@ -27,5 +24,4 @@ oci.pull(
"linux/arm64",
],
)

use_repo(oci, "distroless_base")