diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000..19b860c --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +6.4.0 diff --git a/.github/workflows/master.yaml b/.github/workflows/master.yaml index 1463516..eb432ed 100644 --- a/.github/workflows/master.yaml +++ b/.github/workflows/master.yaml @@ -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" diff --git a/.github/workflows/pull-requests.yaml b/.github/workflows/pull-requests.yaml index d7f7409..5c9c0ec 100644 --- a/.github/workflows/pull-requests.yaml +++ b/.github/workflows/pull-requests.yaml @@ -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" diff --git a/WORKSPACE b/WORKSPACE index 576d9b8..6dc58fc 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -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( @@ -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") @@ -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") diff --git a/cmd/bb_browser/BUILD.bazel b/cmd/bb_browser/BUILD.bazel index 5ed01f7..46845e7 100644 --- a/cmd/bb_browser/BUILD.bazel +++ b/cmd/bb_browser/BUILD.bazel @@ -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") @@ -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( diff --git a/go.mod b/go.mod index 12433e2..aa186a8 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index b3692a8..4c7d242 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/go_dependencies.bzl b/go_dependencies.bzl index c7e829f..5ee3146 100644 --- a/go_dependencies.bzl +++ b/go_dependencies.bzl @@ -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",