From ae1c79dd4670a5ca6391d197a57233eb89f4f339 Mon Sep 17 00:00:00 2001 From: Son Luong Ngoc Date: Fri, 27 Sep 2024 17:10:01 +0200 Subject: [PATCH] Add more images --- codesearch/cmd/server/BUILD | 24 ++++++++++++++++++++++++ enterprise/server/cmd/cache_proxy/BUILD | 16 ++++++++++++++++ enterprise/server/cmd/server/BUILD | 25 +++++++++++++++++++++++++ enterprise/tools/rbeperf/BUILD | 24 ++++++++++++++++++++++++ tools/cacheload/BUILD | 23 +++++++++++++++++++++++ tools/smarter_device_manager/BUILD | 24 ++++++++++++++++++++++++ tools/tcpproxy/BUILD | 24 ++++++++++++++++++++++++ 7 files changed, 160 insertions(+) diff --git a/codesearch/cmd/server/BUILD b/codesearch/cmd/server/BUILD index 1a992bc1a093..73c20efc54a0 100644 --- a/codesearch/cmd/server/BUILD +++ b/codesearch/cmd/server/BUILD @@ -1,6 +1,8 @@ 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_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") go_library( name = "server_lib", @@ -51,3 +53,25 @@ 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", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/server"], + visibility = ["//visibility:public"], +) + +oci_push( + name = "push", + image = ":oci_image", + repository = "gcr.io/flame-build/codesearch-oci", + # Set the image tag with the bazel run flag "--//deployment:image_tag=TAG" + remote_tags = "//deployment:oci_tag_file", +) diff --git a/enterprise/server/cmd/cache_proxy/BUILD b/enterprise/server/cmd/cache_proxy/BUILD index d1241f3cfecf..eeeead6fdfba 100644 --- a/enterprise/server/cmd/cache_proxy/BUILD +++ b/enterprise/server/cmd/cache_proxy/BUILD @@ -1,5 +1,7 @@ load("@io_bazel_rules_docker//container:container.bzl", "container_image") load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") package(default_visibility = ["//enterprise:__subpackages__"]) @@ -49,3 +51,17 @@ container_image( tags = ["manual"], visibility = ["//visibility:public"], ) + +pkg_tar( + name = "tar", + srcs = [":cache_proxy"], +) + +oci_image( + name = "oci_image", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/cache_proxy"], + visibility = ["//visibility:public"], +) diff --git a/enterprise/server/cmd/server/BUILD b/enterprise/server/cmd/server/BUILD index 44b3a5f359ba..47e5cebb45fe 100644 --- a/enterprise/server/cmd/server/BUILD +++ b/enterprise/server/cmd/server/BUILD @@ -1,6 +1,8 @@ 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_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") # gazelle:default_visibility //enterprise:__subpackages__,@buildbuddy_internal//:__subpackages__ package(default_visibility = [ @@ -130,3 +132,26 @@ container_image( tags = ["manual"], visibility = ["//visibility:public"], ) + +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", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/app/server/cmd/buildbuddy/buildbuddy"], + visibility = ["//visibility:public"], +) diff --git a/enterprise/tools/rbeperf/BUILD b/enterprise/tools/rbeperf/BUILD index 15e195a791dd..571143fcdd41 100644 --- a/enterprise/tools/rbeperf/BUILD +++ b/enterprise/tools/rbeperf/BUILD @@ -1,6 +1,8 @@ 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_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") package(default_visibility = ["//enterprise:__subpackages__"]) @@ -57,3 +59,25 @@ 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", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/rbeperf"], + visibility = ["//visibility:public"], +) + +oci_push( + name = "push", + image = ":oci_image", + repository = "gcr.io/flame-build/rbeperf-oci", + # Set the image tag with the bazel run flag "--//deployment:image_tag=TAG" + remote_tags = "//deployment:oci_tag_file", +) diff --git a/tools/cacheload/BUILD b/tools/cacheload/BUILD index aa22d1b8804f..156b1bcaf0b6 100644 --- a/tools/cacheload/BUILD +++ b/tools/cacheload/BUILD @@ -1,6 +1,8 @@ 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_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") go_library( name = "cacheload_lib", @@ -55,3 +57,24 @@ 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", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/cacheload"], +) + +oci_push( + name = "push", + image = ":oci_image", + repository = "gcr.io/flame-build/cacheload-oci", + # Set the image tag with the bazel run flag "--//deployment:image_tag=TAG" + remote_tags = "//deployment:oci_tag_file", +) diff --git a/tools/smarter_device_manager/BUILD b/tools/smarter_device_manager/BUILD index 4b94dfcab2e4..5985dfda0511 100644 --- a/tools/smarter_device_manager/BUILD +++ b/tools/smarter_device_manager/BUILD @@ -1,5 +1,7 @@ load("@io_bazel_rules_docker//container:container.bzl", "container_push") load("@io_bazel_rules_docker//go:image.bzl", "go_image") +load("@rules_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") # We use this internally so create an alias here to # ensure our changes don't break the internal build. @@ -27,3 +29,25 @@ container_push( "manual", ], ) + +pkg_tar( + name = "tar", + srcs = [":smarter-device-manager"], +) + +oci_image( + name = "oci_image", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/smarter-device-manager"], + visibility = ["//visibility:public"], +) + +oci_push( + name = "push", + image = ":oci_image", + repository = "gcr.io/flame-build/smarter-device-manager-oci", + # Set the image tag with the bazel run flag "--//deployment:image_tag=TAG" + remote_tags = "//deployment:oci_tag_file", +) diff --git a/tools/tcpproxy/BUILD b/tools/tcpproxy/BUILD index 93828184a6dc..4409ede17903 100644 --- a/tools/tcpproxy/BUILD +++ b/tools/tcpproxy/BUILD @@ -1,6 +1,8 @@ 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_pkg//pkg:tar.bzl", "pkg_tar") +load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push") go_library( name = "tcpproxy_lib", @@ -35,3 +37,25 @@ container_push( tag_file = "//deployment:image_tag_file", tags = ["manual"], # Don't include this target in wildcard patterns ) + +pkg_tar( + name = "tar", + srcs = [":tcpproxy"], +) + +oci_image( + name = "oci_image", + target_compatible_with = ["@platforms//os:linux"], + base = "@buildbuddy_go_oci_image_base", + tars = [":tar"], + entrypoint = ["/tcpproxy"], + visibility = ["//visibility:public"], +) + +oci_push( + name = "push", + image = ":oci_image", + repository = "gcr.io/flame-build/tcpproxy-oci", + # Set the image tag with the bazel run flag "--//deployment:image_tag=TAG" + remote_tags = "//deployment:oci_tag_file", +)