Skip to content

Commit

Permalink
Revert "Add rules_oci (#7568)" (#7605)
Browse files Browse the repository at this point in the history
This reverts commit 5430f7a.

Break current release flow.
  • Loading branch information
sluongng authored Sep 30, 2024
1 parent 050a0d1 commit 7ee98d9
Show file tree
Hide file tree
Showing 12 changed files with 34 additions and 302 deletions.
24 changes: 0 additions & 24 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module(name = "buildbuddy")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_proto", version = "6.0.0")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "toolchains_musl", version = "0.1.15")
bazel_dep(name = "googleapis", version = "0.0.0-20240326-1c8d509c5")
single_version_override(
Expand Down Expand Up @@ -454,26 +453,3 @@ http_archive(
"https://github.com/sluongng/nogo-analyzer/archive/refs/tags/v0.0.2.tar.gz",
],
)

bazel_dep(name = "rules_oci", version = "2.0.0")

oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull(
name = "buildbuddy_go_oci_image_base",
digest = "sha256:388145607c79313a1e49b783a7ee71e4ef3df31d87c45adb46bfb9b257b643d1",
image = "gcr.io/distroless/cc-debian12",
platforms = ["linux/amd64"],
)
oci.pull(
name = "bazel_oci_image_base",
digest = "sha256:8bb82ccf73085b71159ce05d2cc6030cbaa927b403c04774f0b22f37ab4fd78a",
image = "gcr.io/distroless/java17-debian12",
platforms = ["linux/amd64"],
)
use_repo(
oci,
"bazel_oci_image_base",
"bazel_oci_image_base_linux_amd64",
"buildbuddy_go_oci_image_base",
"buildbuddy_go_oci_image_base_linux_amd64",
)
71 changes: 17 additions & 54 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

http_archive(
name = "rules_pkg",
integrity = "sha256-0gyVGWDtd8t7NBwqWUiFNOSU1a0dMMSBjHNtV3cqn+8=",
url = "https://github.com/bazelbuild/rules_pkg/releases/download/1.0.1/rules_pkg-1.0.1.tar.gz",
)

# Proto rules

http_archive(
Expand Down Expand Up @@ -350,21 +344,6 @@ k8s_defaults(
kind = "deployment",
)

http_archive(
name = "rules_oci",
sha256 = "d007e6c96eb62c88397b68f329e4ca56e0cfe31204a2c54b0cb17819f89f83c8",
strip_prefix = "rules_oci-2.0.0",
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.0.0/rules_oci-v2.0.0.tar.gz",
)

load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")

rules_oci_dependencies()

load("@rules_oci//oci:repositories.bzl", "oci_register_toolchains")

oci_register_toolchains(name = "oci")

load("@io_bazel_rules_docker//contrib:dockerfile_build.bzl", "dockerfile_image")

dockerfile_image(
Expand All @@ -391,6 +370,23 @@ dockerfile_image(
visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")

container_pull(
name = "buildbuddy_go_image_base",
digest = "sha256:388145607c79313a1e49b783a7ee71e4ef3df31d87c45adb46bfb9b257b643d1",
registry = "gcr.io",
repository = "distroless/cc-debian12",
)

# Base image that can be used to build images that are capable of running the Bazel binary.
container_pull(
name = "bazel_image_base",
digest = "sha256:8bb82ccf73085b71159ce05d2cc6030cbaa927b403c04774f0b22f37ab4fd78a",
registry = "gcr.io",
repository = "distroless/java17-debian12",
)

dockerfile_image(
name = "rbe-ubuntu20-04_image",
dockerfile = "//dockerfiles/rbe-ubuntu20-04:Dockerfile",
Expand Down Expand Up @@ -419,39 +415,6 @@ dockerfile_image(
visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")

container_pull(
name = "buildbuddy_go_image_base",
digest = "sha256:388145607c79313a1e49b783a7ee71e4ef3df31d87c45adb46bfb9b257b643d1",
registry = "gcr.io",
repository = "distroless/cc-debian12",
)

# Base image that can be used to build images that are capable of running the Bazel binary.
container_pull(
name = "bazel_image_base",
digest = "sha256:8bb82ccf73085b71159ce05d2cc6030cbaa927b403c04774f0b22f37ab4fd78a",
registry = "gcr.io",
repository = "distroless/java17-debian12",
)

load("@rules_oci//oci:pull.bzl", "oci_pull")

oci_pull(
name = "buildbuddy_go_oci_image_base",
digest = "sha256:388145607c79313a1e49b783a7ee71e4ef3df31d87c45adb46bfb9b257b643d1",
image = "gcr.io/distroless/cc-debian12",
platforms = ["linux/amd64"],
)

oci_pull(
name = "bazel_oci_image_base",
digest = "sha256:8bb82ccf73085b71159ce05d2cc6030cbaa927b403c04774f0b22f37ab4fd78a",
image = "gcr.io/distroless/java17-debian12",
platforms = ["linux/amd64"],
)

# BuildBuddy Toolchain
# Keep up-to-date with docs/rbe-setup.md and docs/rbe-github-actions.md
http_archive(
Expand Down
34 changes: 17 additions & 17 deletions WORKSPACE.bzlmod
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,23 @@ dockerfile_image(
visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")

container_pull(
name = "buildbuddy_go_image_base",
digest = "sha256:3172df37ef8caa768ce74ebbc7f0e2b6a2641d3b35d18659d36f3815e30fe620",
registry = "gcr.io",
repository = "distroless/cc-debian11",
)

# Base image that can be used to build images that are capable of running the Bazel binary.
container_pull(
name = "bazel_image_base",
digest = "sha256:ab0c5fbe16bc01c03eb081a5724ba618110cbd24940ab123a8dbee0382a4c175",
registry = "gcr.io",
repository = "distroless/java11-debian11",
)

dockerfile_image(
name = "rbe-ubuntu20-04_image",
dockerfile = "//dockerfiles/rbe-ubuntu20-04:Dockerfile",
Expand Down Expand Up @@ -133,23 +150,6 @@ dockerfile_image(
visibility = ["//visibility:public"],
)

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")

container_pull(
name = "buildbuddy_go_image_base",
digest = "sha256:3172df37ef8caa768ce74ebbc7f0e2b6a2641d3b35d18659d36f3815e30fe620",
registry = "gcr.io",
repository = "distroless/cc-debian11",
)

# Base image that can be used to build images that are capable of running the Bazel binary.
container_pull(
name = "bazel_image_base",
digest = "sha256:ab0c5fbe16bc01c03eb081a5724ba618110cbd24940ab123a8dbee0382a4c175",
registry = "gcr.io",
repository = "distroless/java11-debian11",
)

# BuildBuddy Toolchain
# Keep up-to-date with docs/rbe-setup.md and docs/rbe-github-actions.md
http_archive(
Expand Down
24 changes: 0 additions & 24 deletions codesearch/cmd/server/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

go_library(
name = "server_lib",
Expand Down Expand Up @@ -54,25 +52,3 @@ container_push(
tag_file = "//deployment:image_tag_file",
tags = ["manual"], # Don't include this target in wildcard patterns
)

pkg_tar(
name = "tar",
srcs = [":server"],
)

oci_image(
name = "oci_image",
base = "@buildbuddy_go_oci_image_base",
entrypoint = ["/server"],
target_compatible_with = ["@platforms//os:linux"],
tars = [":tar"],
visibility = ["//visibility:public"],
)

oci_push(
name = "push",
image = ":oci_image",
# Set the image tag with the bazel run flag "--//deployment:image_tag=TAG"
remote_tags = "//deployment:oci_tag_file",
repository = "gcr.io/flame-build/codesearch-oci",
)
11 changes: 0 additions & 11 deletions deployment/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
load("@io_bazel_rules_k8s//k8s:object.bzl", "k8s_object")
load("@io_bazel_rules_k8s//k8s:objects.bzl", "k8s_objects")
load("//rules/flags:index.bzl", "write_flag_to_file")
Expand Down Expand Up @@ -40,13 +39,3 @@ write_flag_to_file(
flag = ":image_tag",
visibility = ["//visibility:public"],
)

# TODO: Get rid of this.
# Currently rules OCI only support tag file names with the ".txt" extension.
copy_file(
name = "oci_tag_file",
src = ":image_tag_file",
out = "oci_tag.txt",
allow_symlink = True,
visibility = ["//visibility:public"],
)
16 changes: 0 additions & 16 deletions enterprise/server/cmd/cache_proxy/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

package(default_visibility = ["//enterprise:__subpackages__"])

Expand Down Expand Up @@ -51,17 +49,3 @@ container_image(
tags = ["manual"],
visibility = ["//visibility:public"],
)

pkg_tar(
name = "tar",
srcs = [":cache_proxy"],
)

oci_image(
name = "oci_image",
base = "@buildbuddy_go_oci_image_base",
entrypoint = ["/cache_proxy"],
target_compatible_with = ["@platforms//os:linux"],
tars = [":tar"],
visibility = ["//visibility:public"],
)
26 changes: 0 additions & 26 deletions enterprise/server/cmd/server/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

# gazelle:default_visibility //enterprise:__subpackages__,@buildbuddy_internal//:__subpackages__
package(default_visibility = [
Expand Down Expand Up @@ -132,27 +130,3 @@ container_image(
tags = ["manual"],
visibility = ["//visibility:public"],
)

# TODO(sluongng): Verify the layering of the image.
pkg_tar(
name = "tar",
srcs = [
":buildbuddy",
],
remap_paths = {
"/buildbuddy": "/app/server/cmd/buildbuddy/buildbuddy",
},
symlinks = {
"config.yaml": "app/enterprise/server/cmd/server/buildbuddy.runfiles/buildbuddy/enterprise/config/buildbuddy.release.yaml",
"buildbuddy": "tmp",
},
)

oci_image(
name = "oci_image",
base = "@buildbuddy_go_oci_image_base",
entrypoint = ["/app/server/cmd/buildbuddy/buildbuddy"],
target_compatible_with = ["@platforms//os:linux"],
tars = [":tar"],
visibility = ["//visibility:public"],
)
24 changes: 0 additions & 24 deletions enterprise/tools/rbeperf/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

package(default_visibility = ["//enterprise:__subpackages__"])

Expand Down Expand Up @@ -59,25 +57,3 @@ container_push(
tag_file = "//deployment:image_tag_file",
tags = ["manual"], # Don't include this target in wildcard patterns
)

pkg_tar(
name = "tar",
srcs = [":rbeperf"],
)

oci_image(
name = "oci_image",
base = "@buildbuddy_go_oci_image_base",
entrypoint = ["/rbeperf"],
target_compatible_with = ["@platforms//os:linux"],
tars = [":tar"],
visibility = ["//visibility:public"],
)

oci_push(
name = "push",
image = ":oci_image",
# Set the image tag with the bazel run flag "--//deployment:image_tag=TAG"
remote_tags = "//deployment:oci_tag_file",
repository = "gcr.io/flame-build/rbeperf-oci",
)
23 changes: 0 additions & 23 deletions tools/cacheload/BUILD
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
load("@io_bazel_rules_docker//container:container.bzl", "container_push")
load("@io_bazel_rules_docker//go:image.bzl", "go_image")
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push")
load("@rules_pkg//pkg:tar.bzl", "pkg_tar")

go_library(
name = "cacheload_lib",
Expand Down Expand Up @@ -57,24 +55,3 @@ container_push(
tag_file = "//deployment:image_tag_file",
tags = ["manual"], # Don't include this target in wildcard patterns
)

pkg_tar(
name = "tar",
srcs = [":cacheload"],
)

oci_image(
name = "oci_image",
base = "@buildbuddy_go_oci_image_base",
entrypoint = ["/cacheload"],
target_compatible_with = ["@platforms//os:linux"],
tars = [":tar"],
)

oci_push(
name = "push",
image = ":oci_image",
# Set the image tag with the bazel run flag "--//deployment:image_tag=TAG"
remote_tags = "//deployment:oci_tag_file",
repository = "gcr.io/flame-build/cacheload-oci",
)
Loading

0 comments on commit 7ee98d9

Please sign in to comment.