Skip to content

Commit

Permalink
Build ARM64 bb_runner_installer images
Browse files Browse the repository at this point in the history
  • Loading branch information
EdSchouten committed Mar 27, 2024
1 parent 1d1c651 commit 150c932
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 17 deletions.
14 changes: 11 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ oci_pull(

oci_pull(
name = "busybox",
digest = "sha256:a2490cec4484ee6c1068ba3a05f89934010c85242f736280b35343483b2264b6", # 1.31.1-uclibc
digest = "sha256:97e3873d1f61ba651b632e4755fc52e1d90c9f6e4f01d9b720f37af5efed17e5", # 1.36.1-uclibc
image = "docker.io/library/busybox",
platforms = [
"linux/amd64",
Expand Down Expand Up @@ -144,8 +144,16 @@ http_file(
name = "com_github_krallin_tini_tini_static_amd64",
downloaded_file_path = "tini",
executable = True,
sha256 = "eadb9d6e2dc960655481d78a92d2c8bc021861045987ccd3e27c7eae5af0cf33",
urls = ["https://github.com/krallin/tini/releases/download/v0.18.0/tini-static-amd64"],
sha256 = "c5b0666b4cb676901f90dfcb37106783c5fe2077b04590973b885950611b30ee",
urls = ["https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-amd64"],
)

http_file(
name = "com_github_krallin_tini_tini_static_arm64",
downloaded_file_path = "tini",
executable = True,
sha256 = "eae1d3aa50c48fb23b8cbdf4e369d0910dfc538566bfd09df89a774aa84a48b9",
urls = ["https://github.com/krallin/tini/releases/download/v0.19.0/tini-static-arm64"],
)

http_archive(
Expand Down
59 changes: 45 additions & 14 deletions cmd/bb_runner/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official", "multiarch_go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

go_library(
Expand Down Expand Up @@ -35,6 +36,17 @@ go_binary(
visibility = ["//visibility:public"],
)

multiarch_go_image(
name = "bb_runner_bare_container",
binary = ":bb_runner",
)

container_push_official(
name = "bb_runner_bare_container_push",
component = "bb-runner-bare",
image = ":bb_runner_bare_container",
)

pkg_tar(
name = "bb_runner_layer",
files = [":bb_runner"],
Expand All @@ -43,41 +55,60 @@ pkg_tar(

pkg_tar(
name = "tini_layer",
files = ["@com_github_krallin_tini_tini_static_amd64//file"],
files = select({
"@io_bazel_rules_go//go/platform:amd64": [
"@com_github_krallin_tini_tini_static_amd64//file",
],
"@io_bazel_rules_go//go/platform:arm64": [
"@com_github_krallin_tini_tini_static_arm64//file",
],
}),
tags = ["manual"],
)

pkg_tar(
name = "install_layer",
files = ["install"],
)

# TODO: Provide a multi-arch image for bb_runner_installer.
oci_image(
name = "bb_runner_installer",
name = "bb_runner_installer_image",
base = "@busybox",
cmd = ["/bb"],
entrypoint = ["/install"],
tags = ["manual"],
tars = [
":install_layer",
":bb_runner_layer",
":tini_layer",
],
visibility = ["//visibility:public"],
)

multiarch_go_image(
name = "bb_runner_bare_container",
binary = ":bb_runner",
)
[
platform_transition_filegroup(
name = "bb_runner_installer_image_" + arch,
srcs = ["bb_runner_installer_image"],
target_platform = "@io_bazel_rules_go//go/toolchain:linux_" + arch,
)
for arch in [
"amd64",
"arm64",
]
]

container_push_official(
name = "bb_runner_bare_container_push",
component = "bb-runner-bare",
image = ":bb_runner_bare_container",
oci_image_index(
name = "bb_runner_installer_container",
images = [
"bb_runner_installer_image_" + arch
for arch in [
"amd64",
"arm64",
]
],
)

container_push_official(
name = "bb_runner_installer_container_push",
component = "bb-runner-installer",
image = ":bb_runner_installer",
image = ":bb_runner_installer_container",
)

0 comments on commit 150c932

Please sign in to comment.