Skip to content

Commit

Permalink
Switch container image builds to rules_oci
Browse files Browse the repository at this point in the history
This causes bb_browser to be built for ARM64 as well.
  • Loading branch information
EdSchouten committed Mar 27, 2024
1 parent 10b339d commit 4bd1ea1
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 36 deletions.
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6.4.0
8 changes: 4 additions & 4 deletions .github/workflows/master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"build_and_test": {
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Installing Bazel",
"run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
},
{
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"name": "Installing Bazel",
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
"build_and_test": {
"runs-on": "ubuntu-latest",
"steps": [
{
"name": "Installing Bazel",
"run": "curl -L https://github.com/bazelbuild/bazel/releases/download/6.0.0/bazel-6.0.0-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
},
{
"name": "Check out source code",
"uses": "actions/checkout@v1"
},
{
"name": "Installing Bazel",
"run": "v=$(cat .bazelversion) && curl -L https://github.com/bazelbuild/bazel/releases/download/${v}/bazel-${v}-linux-x86_64 > ~/bazel && chmod +x ~/bazel && echo ~ >> ${GITHUB_PATH}"
},
{
"name": "Gazelle",
"run": "bazel run //:gazelle -- update-repos -from_file=go.mod -to_macro go_dependencies.bzl%go_dependencies -prune && bazel run //:gazelle"
Expand Down
50 changes: 34 additions & 16 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,21 @@ http_archive(
)

http_archive(
name = "io_bazel_rules_docker",
sha256 = "b1e80761a8a8243d03ebca8845e9cc1ba6c82ce7c5179ce2b295cd36f7e394bf",
urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.25.0/rules_docker-v0.25.0.tar.gz"],
name = "aspect_bazel_lib",
sha256 = "6c25c59581041ede31e117693047f972cc4700c89acf913658dc89d04c338f8d",
strip_prefix = "bazel-lib-2.5.3",
url = "https://github.com/aspect-build/bazel-lib/releases/download/v2.5.3/bazel-lib-v2.5.3.tar.gz",
)

load("@aspect_bazel_lib//lib:repositories.bzl", "register_expand_template_toolchains")

register_expand_template_toolchains()

http_archive(
name = "rules_oci",
sha256 = "4a276e9566c03491649eef63f27c2816cc222f41ccdebd97d2c5159e84917c3b",
strip_prefix = "rules_oci-1.7.4",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v1.7.4/rules_oci-v1.7.4.tar.gz",
)

http_archive(
Expand Down Expand Up @@ -46,21 +58,27 @@ go_rules_dependencies()

go_register_toolchains(version = "1.21.5")

load("@io_bazel_rules_docker//repositories:repositories.bzl", container_repositories = "repositories")

container_repositories()

load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps")

container_deps()

load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies()

load("@io_bazel_rules_docker//go:image.bzl", _go_image_repos = "repositories")
load("@rules_oci//oci:pull.bzl", "oci_pull")
load("@rules_oci//oci:repositories.bzl", "LATEST_CRANE_VERSION", "oci_register_toolchains")

oci_register_toolchains(
name = "oci",
crane_version = LATEST_CRANE_VERSION,
)

_go_image_repos()
oci_pull(
name = "distroless_static",
digest = "sha256:7e5c6a2a4ae854242874d36171b31d26e0539c98fc6080f942f16b03e82851ab",
image = "gcr.io/distroless/static",
platforms = [
"linux/amd64",
"linux/arm64/v8",
],
)

load("@com_github_bazelbuild_remote_apis//:repository_rules.bzl", "switched_rules_by_language")

Expand Down Expand Up @@ -137,9 +155,9 @@ http_archive(

http_archive(
name = "aspect_rules_js",
sha256 = "00e7b97b696af63812df0ca9e9dbd18579f3edd3ab9a56f227238b8405e4051c",
strip_prefix = "rules_js-1.23.0",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.23.0/rules_js-v1.23.0.tar.gz",
sha256 = "63cf42b07aae34904447c74f5b41652c4933984cc325726673a5e4561d9789e7",
strip_prefix = "rules_js-1.39.1",
url = "https://github.com/aspect-build/rules_js/releases/download/v1.39.1/rules_js-v1.39.1.tar.gz",
)

load("@aspect_rules_js//js:repositories.bzl", "rules_js_dependencies")
Expand Down
9 changes: 3 additions & 6 deletions cmd/bb_browser/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@com_github_buildbarn_bb_storage//tools:container.bzl", "container_push_official")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
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("@npm//:purgecss/package_json.bzl", purgecss_bin = "bin")

Expand Down Expand Up @@ -104,11 +103,9 @@ go_binary(
visibility = ["//visibility:public"],
)

go_image(
multiarch_go_image(
name = "bb_browser_container",
embed = [":bb_browser_lib"],
pure = "on",
visibility = ["//visibility:public"],
binary = ":bb_browser",
)

container_push_official(
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ replace github.com/grpc-ecosystem/grpc-gateway/v2 => github.com/grpc-ecosystem/g

require (
github.com/bazelbuild/remote-apis v0.0.0-20240215191509-9ff14cecffe5
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294
github.com/buildbarn/bb-remote-execution v0.0.0-20240327120038-7bcf9b5f081f
github.com/buildbarn/bb-storage v0.0.0-20240326045855-53c12526d34e
github.com/buildkite/terminal-to-html v3.2.0+incompatible
github.com/dustin/go-humanize v1.0.1
github.com/gorilla/mux v1.8.1
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,14 @@ github.com/buildbarn/bb-remote-execution v0.0.0-20240222085313-f5b199467dd6 h1:d
github.com/buildbarn/bb-remote-execution v0.0.0-20240222085313-f5b199467dd6/go.mod h1:qwNvc1PxPWzRzcKiQ/Hq1MQmxB8fjWQ+Lv0h9r8aysU=
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0 h1:wcGel3yU3FAENqRLzgZkg7xzuwlaY9H+Lphd46u5tyI=
github.com/buildbarn/bb-remote-execution v0.0.0-20240310090416-28dbdbb0a6b0/go.mod h1:q3TGK8PD/HoADYpaOU0lup48IOusUuCoP0ilLi+BX7A=
github.com/buildbarn/bb-remote-execution v0.0.0-20240327120038-7bcf9b5f081f h1:rFKH1HdOh6t2qqnYr/EWbP9Md4OuqiyUySPoYbgVkkg=
github.com/buildbarn/bb-remote-execution v0.0.0-20240327120038-7bcf9b5f081f/go.mod h1:k4EPiIu814IXfvkXH89AQMyDZmFOcpt4KwihDNA4shs=
github.com/buildbarn/bb-storage v0.0.0-20240227100204-0aa40dfdbead h1:fHapKnQQLgJaMxGiBAUCPVHNfD5vV1LDfXqmyClJ6Lc=
github.com/buildbarn/bb-storage v0.0.0-20240227100204-0aa40dfdbead/go.mod h1:gHT0PInDFOV/JZjeeNwvqmn33MKHHyk3V18e4/Cs/jM=
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294 h1:Gs3nP150dcZ7Utk7OrYPpoV9/7oGZ9y1It0BGPonDnk=
github.com/buildbarn/bb-storage v0.0.0-20240310075825-20598f43e294/go.mod h1:0uISGKJD6Owt29w2sUlK0TeLtYdLWtBiC43yVHdgMAY=
github.com/buildbarn/bb-storage v0.0.0-20240326045855-53c12526d34e h1:9akyMjvUsqodoCvKKdUlN5i+GxfYa9OeZnNuenPBLfE=
github.com/buildbarn/bb-storage v0.0.0-20240326045855-53c12526d34e/go.mod h1:0uISGKJD6Owt29w2sUlK0TeLtYdLWtBiC43yVHdgMAY=
github.com/buildkite/terminal-to-html v3.2.0+incompatible h1:WdXzl7ZmYzCAz4pElZosPaUlRTW+qwVx/SkQSCa1jXs=
github.com/buildkite/terminal-to-html v3.2.0+incompatible/go.mod h1:BFFdFecOxCgjdcarqI+8izs6v85CU/1RA/4Bqh4GR7E=
github.com/campoy/embedmd v1.0.0 h1:V4kI2qTJJLf4J29RzI/MAt2c3Bl4dQSYPuflzwFH2hY=
Expand Down
8 changes: 4 additions & 4 deletions go_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,14 @@ def go_dependencies():
go_repository(
name = "com_github_buildbarn_bb_remote_execution",
importpath = "github.com/buildbarn/bb-remote-execution",
sum = "h1:wcGel3yU3FAENqRLzgZkg7xzuwlaY9H+Lphd46u5tyI=",
version = "v0.0.0-20240310090416-28dbdbb0a6b0",
sum = "h1:rFKH1HdOh6t2qqnYr/EWbP9Md4OuqiyUySPoYbgVkkg=",
version = "v0.0.0-20240327120038-7bcf9b5f081f",
)
go_repository(
name = "com_github_buildbarn_bb_storage",
importpath = "github.com/buildbarn/bb-storage",
sum = "h1:Gs3nP150dcZ7Utk7OrYPpoV9/7oGZ9y1It0BGPonDnk=",
version = "v0.0.0-20240310075825-20598f43e294",
sum = "h1:9akyMjvUsqodoCvKKdUlN5i+GxfYa9OeZnNuenPBLfE=",
version = "v0.0.0-20240326045855-53c12526d34e",
)
go_repository(
name = "com_github_buildbarn_go_xdr",
Expand Down

0 comments on commit 4bd1ea1

Please sign in to comment.