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

Switch container image builds to rules_oci #13

Merged
merged 1 commit into from
Mar 27, 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
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
54 changes: 35 additions & 19 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 All @@ -35,7 +47,7 @@ http_archive(
],
)

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

# Override the version of gomock to one that includes support for
# generating mocks for function types. We can't do this through go.mod,
Expand Down Expand Up @@ -63,21 +75,25 @@ 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")

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

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 @@ -154,9 +170,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_clientd/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")

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

go_image(
multiarch_go_image(
name = "bb_clientd_container",
embed = [":bb_clientd_lib"],
pure = "on",
visibility = ["//visibility:public"],
binary = ":bb_clientd",
)

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
golang.org/x/sync v0.6.0
google.golang.org/genproto/googleapis/bytestream v0.0.0-20240228224816-df926f6c8641
google.golang.org/grpc v1.62.0
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ github.com/buildbarn/bb-remote-execution v0.0.0-20240308103551-b4cdefde2e35 h1:b
github.com/buildbarn/bb-remote-execution v0.0.0-20240308103551-b4cdefde2e35/go.mod h1:eWUQ51dc8XX2eKM4re9wD8VBzJ8D21JZi87L7mfttus=
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-20240307194821-4d0d7a3d85b5 h1:tBbub4L03HT0PNKToki245kaXjwb+AOzyhfy8oosL6w=
Expand All @@ -73,6 +75,8 @@ github.com/buildbarn/bb-storage v0.0.0-20240308085957-e8fd6935d2ef h1:4Mq41hEzT6
github.com/buildbarn/bb-storage v0.0.0-20240308085957-e8fd6935d2ef/go.mod h1:0uISGKJD6Owt29w2sUlK0TeLtYdLWtBiC43yVHdgMAY=
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/buildbarn/go-xdr v0.0.0-20231115101217-a9e2aa4cf64b h1:/sKWC0Fs5fXNo/t72BRZRLERg4v2gFoEeg2Mk+a8xak=
github.com/buildbarn/go-xdr v0.0.0-20231115101217-a9e2aa4cf64b/go.mod h1:VwInghBSUyPtNBhl7o2oCUnxOCTGgySJnRTO1Kh7XuI=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
Expand Down
8 changes: 4 additions & 4 deletions go_dependencies.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,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