Skip to content

Commit e8d8188

Browse files
authored
refactor: use the new oci_image_index transitions (#242)
1 parent a70ceac commit e8d8188

File tree

3 files changed

+14
-247
lines changed

3 files changed

+14
-247
lines changed

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bazel_dep(name = "opentelemetry-proto", version = "1.5.0")
1010
bazel_dep(name = "protobuf", version = "29.3")
1111
bazel_dep(name = "rules_go", version = "0.53.0")
1212
bazel_dep(name = "rules_jsonnet", version = "0.6.0")
13-
bazel_dep(name = "rules_oci", version = "2.2.2")
13+
bazel_dep(name = "rules_oci", version = "2.2.5")
1414
bazel_dep(name = "rules_pkg", version = "1.0.1")
1515
bazel_dep(name = "rules_proto", version = "7.1.0")
1616
bazel_dep(name = "toolchains_llvm", version = "1.3.0")

MODULE.bazel.lock

Lines changed: 7 additions & 233 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tools/container.bzl

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
21
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index", "oci_push")
32
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")
43

@@ -9,7 +8,7 @@ def multiarch_go_image(name, binary):
98
name: resulting oci_image_index target
109
binary: label of a go_binary target; it may be transitioned to another architecture
1110
"""
12-
images = []
11+
1312
tar_target = "_{}.tar".format(name)
1413
image_target = "_{}.image".format(name)
1514

@@ -30,19 +29,13 @@ def multiarch_go_image(name, binary):
3029
tags = ["manual"],
3130
)
3231

33-
for arch in ["amd64", "arm64"]:
34-
arch_image_target = "{}_{}_image".format(name, arch)
35-
target_platform = "@rules_go//go/toolchain:linux_" + arch
36-
images.append(arch_image_target)
37-
platform_transition_filegroup(
38-
name = arch_image_target,
39-
srcs = [image_target],
40-
target_platform = target_platform,
41-
)
42-
4332
oci_image_index(
4433
name = name,
45-
images = images,
34+
images = [image_target],
35+
platforms = [
36+
"@rules_go//go/toolchain:linux_amd64",
37+
"@rules_go//go/toolchain:linux_arm64",
38+
],
4639
)
4740

4841
def container_push_official(name, image, component):

0 commit comments

Comments
 (0)