Skip to content

Commit

Permalink
Revert "Support pushing multi-arch images in vizier_build_release.sh (p…
Browse files Browse the repository at this point in the history
…ixie-io#810)" (pixie-io#814)

Summary: This diff was landed with multiple pending changes.
This reverts commit 746ae6c.
I won't stack diffs in the future.

Type of change: /kind cleanup

Test Plan: N/A

Signed-off-by: James Bartlett <jamesbartlett@pixielabs.ai>
  • Loading branch information
JamesMBartlett authored Feb 7, 2023
1 parent 5c0a487 commit fc6ce19
Show file tree
Hide file tree
Showing 21 changed files with 19 additions and 621 deletions.
10 changes: 0 additions & 10 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,12 @@ build:linux --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
build:clang-base --//bazel/cc_toolchains:compiler=clang
build:clang-base --//bazel/cc_toolchains:libc_version=glibc_host

# We build our own chroot for the sysroot tests, which doesn't work well under bazel's sandbox.
build:sysroot_common --//bazel/test_runners:test_runner=sysroot_chroot
test:sysroot_common --strategy TestRunner=standalone
test:sysroot_common --run_under="bazel/test_runners/sysroot_chroot/test_runner.sh"

build:x86_64_sysroot --config=clang
build:x86_64_sysroot --//bazel/cc_toolchains:libc_version=glibc2_36
build:x86_64_sysroot --config=sysroot_common

build:aarch64_sysroot --config=clang
build:aarch64_sysroot --//bazel/cc_toolchains:libc_version=glibc2_36
build:aarch64_sysroot --platforms=//bazel/cc_toolchains:linux-aarch64
build:aarch64_sysroot --config=sysroot_common
# Increase test timeouts for qemu (don't increase the slowest ones because those are already very long).
test:aarch64_sysroot --test_timeout=180,600,1800,3600
test:aarch64_sysroot --test_env=QEMU_STRACE


# Build for Clang using Libc++.
Expand Down
23 changes: 3 additions & 20 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@io_bazel_rules_docker//container:container.bzl", "container_image")
load("//bazel:repositories.bzl", "list_pl_deps")
load("//bazel/cc_toolchains:llvm_libs.bzl", "llvm_variant_repo_name", "llvm_variant_setting_label", "llvm_variants")
load("//bazel/cc_toolchains/sysroots:images.bzl", "sysroot_runtime_image")
load("//bazel/external/ubuntu_packages:packages.bzl", "packages")

licenses(["restricted"])
Expand Down Expand Up @@ -143,32 +142,16 @@ filegroup(
)

container_image(
name = "pl_go_base_image_default",
base = "@base_image//image",
debs = pl_cc_base_packages,
)

container_image(
name = "pl_cc_base_image_default",
name = "pl_go_base_image",
base = "@base_image//image",
debs = pl_cc_base_packages,
visibility = ["//visibility:public"],
)

sysroot_runtime_image(
name = "pl_go_base_image",
default_image = ":pl_go_base_image_default",
visibility = ["//visibility:public"],
)

sysroot_runtime_image(
name = "pl_cc_base_image_no_extra_files",
default_image = ":pl_cc_base_image_default",
)

container_image(
name = "pl_cc_base_image",
base = ":pl_cc_base_image_no_extra_files",
base = "@base_image//image",
debs = pl_cc_base_packages,
files = [
"//:embedding.proto",
"//:sentencepiece.proto",
Expand Down
3 changes: 0 additions & 3 deletions bazel/cc_toolchains/sysroots/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
load("//bazel/cc_toolchains/sysroots:sysroots.bzl", "pl_sysroot_settings")

pl_sysroot_settings()
7 changes: 0 additions & 7 deletions bazel/cc_toolchains/sysroots/build/sysroot.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,11 @@ filegroup(
visibility = ["//visibility:public"],
)

filegroup(
name = "tar",
srcs = ["{tar_path}"],
visibility = ["//visibility:public"],
)

sysroot_toolchain(
name = "sysroot_toolchain",
architecture = "{target_arch}",
files = ":all_files",
path = "{path_to_this_repo}",
tar = ":tar",
)

toolchain(
Expand Down
83 changes: 0 additions & 83 deletions bazel/cc_toolchains/sysroots/images.bzl

This file was deleted.

16 changes: 3 additions & 13 deletions bazel/cc_toolchains/sysroots/runtime/sysroot.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ load("@px//bazel/cc_toolchains/sysroots:sysroots.bzl", "sysroot_toolchain")

filegroup(
name = "all_files",
srcs = glob(
[
"**",
],
exclude = ["{tar_path}"],
),
visibility = ["//visibility:public"],
)

filegroup(
name = "tar",
srcs = ["{tar_path}"],
srcs = glob([
"**",
]),
visibility = ["//visibility:public"],
)

Expand All @@ -38,7 +29,6 @@ sysroot_toolchain(
architecture = "{target_arch}",
files = ":all_files",
path = "{path_to_this_repo}",
tar = ":tar",
)

toolchain(
Expand Down
34 changes: 2 additions & 32 deletions bazel/cc_toolchains/sysroots/sysroots.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#
# SPDX-License-Identifier: Apache-2.0

load("@bazel_skylib//lib:selects.bzl", "selects")
load("//bazel/cc_toolchains:utils.bzl", "abi")

SYSROOT_LOCATIONS = dict(
Expand Down Expand Up @@ -64,34 +63,20 @@ def _sysroot_repo_name(target_arch, libc_version, variant):
return name
return ""

def _sysroot_setting_name(target_arch, libc_version):
return "using_sysroot_{target_arch}_{libc_version}".format(
target_arch = target_arch,
libc_version = libc_version,
)

def _sysroot_repo_impl(rctx):
loc = SYSROOT_LOCATIONS[rctx.attr.name]
tar_path = "sysroot.tar.gz"
rctx.download(
rctx.download_and_extract(
url = loc["urls"],
output = tar_path,
sha256 = loc["sha256"],
)

rctx.extract(
tar_path,
stripPrefix = loc.get("strip_prefix", ""),
)

rctx.template(
"BUILD.bazel",
Label("@px//bazel/cc_toolchains/sysroots/{variant}:sysroot.BUILD".format(variant = rctx.attr.variant)),
substitutions = {
"{abi}": abi(rctx.attr.target_arch, rctx.attr.libc_version),
"{libc_version}": rctx.attr.libc_version,
"{path_to_this_repo}": "external/" + rctx.attr.name,
"{tar_path}": tar_path,
"{target_arch}": rctx.attr.target_arch,
},
)
Expand All @@ -107,7 +92,7 @@ _sysroot_repo = repository_rule(

SysrootInfo = provider(
doc = "Information about a sysroot.",
fields = ["files", "architecture", "path", "tar"],
fields = ["files", "architecture", "path"],
)

def _sysroot_toolchain_impl(ctx):
Expand All @@ -117,7 +102,6 @@ def _sysroot_toolchain_impl(ctx):
files = ctx.attr.files.files,
architecture = ctx.attr.architecture,
path = ctx.attr.path,
tar = ctx.attr.tar.files,
),
),
]
Expand All @@ -128,7 +112,6 @@ sysroot_toolchain = rule(
"architecture": attr.string(mandatory = True, doc = "CPU architecture targeted by this sysroot"),
"files": attr.label(mandatory = True, doc = "All sysroot files"),
"path": attr.string(mandatory = True, doc = "Path to sysroot relative to execroot"),
"tar": attr.label(mandatory = True, doc = "Sysroot tar, used to avoid repacking the sysroot as a tar for docker images."),
},
)

Expand All @@ -147,20 +130,7 @@ def _pl_sysroot_deps():
toolchains.append("@{repo}//:toolchain".format(repo = repo))
native.register_toolchains(*toolchains)

def _pl_sysroot_settings():
for target_arch in _sysroot_architectures:
for libc_version in _sysroot_libc_versions:
selects.config_setting_group(
name = _sysroot_setting_name(target_arch, libc_version),
match_all = [
"@platforms//cpu:" + target_arch,
"//bazel/cc_toolchains:libc_version_" + libc_version,
],
visibility = ["//visibility:public"],
)

sysroot_repo_name = _sysroot_repo_name
sysroot_libc_versions = _sysroot_libc_versions
sysroot_architectures = _sysroot_architectures
pl_sysroot_settings = _pl_sysroot_settings
pl_sysroot_deps = _pl_sysroot_deps
16 changes: 3 additions & 13 deletions bazel/cc_toolchains/sysroots/test/sysroot.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,9 @@ load("@px//bazel/cc_toolchains/sysroots:sysroots.bzl", "sysroot_toolchain")

filegroup(
name = "all_files",
srcs = glob(
[
"**",
],
exclude = ["{tar_path}"],
),
visibility = ["//visibility:public"],
)

filegroup(
name = "tar",
srcs = ["{tar_path}"],
srcs = glob([
"**",
]),
visibility = ["//visibility:public"],
)

Expand All @@ -38,7 +29,6 @@ sysroot_toolchain(
architecture = "{target_arch}",
files = ":all_files",
path = "{path_to_this_repo}",
tar = ":tar",
)

toolchain(
Expand Down
22 changes: 0 additions & 22 deletions bazel/images.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,3 @@ image_prefix_provider = rule(
"image_prefix": attr.string(mandatory = True),
},
)

def _list_image_bundle(ctx):
exe = ctx.actions.declare_file(ctx.attr.name)
exe_content = ""
for image_tag in ctx.attr.images:
image_tag = image_tag.replace("$(IMAGE_PREFIX)", ctx.var["IMAGE_PREFIX"])
image_tag = image_tag.replace("$(BUNDLE_VERSION)", ctx.var["BUNDLE_VERSION"])
exe_content += "echo '{}'\n".format(image_tag)
ctx.actions.write(exe, exe_content)

return DefaultInfo(
files = depset([exe]),
executable = exe,
)

list_image_bundle = rule(
implementation = _list_image_bundle,
executable = True,
attrs = dict(
images = attr.string_dict(),
),
)
19 changes: 1 addition & 18 deletions bazel/pl_build_system.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def pl_cc_test(
repository + "//src/shared/version:test_version_linkstamp",
] + _default_external_deps(),
args = args,
data = data + ["//bazel/test_runners:test_runner_dep"],
data = data,
tags = tags + ["coverage_test"],
shard_count = shard_count,
size = size,
Expand Down Expand Up @@ -408,33 +408,16 @@ def _add_no_pie(kwargs):
kwargs["gc_linkopts"].append("-extldflags")
kwargs["gc_linkopts"].append("-no-pie")

def _add_test_runner(kwargs):
if "data" not in kwargs:
kwargs["data"] = []
kwargs["data"].append("//bazel/test_runners:test_runner_dep")

def _add_no_sysroot(kwargs):
if "target_compatible_with" not in kwargs:
kwargs["target_compatible_with"] = []
kwargs["target_compatible_with"] = kwargs["target_compatible_with"] + select({
"//bazel/cc_toolchains:libc_version_glibc_host": [],
"//conditions:default": ["@platforms//:incompatible"],
})

def pl_go_test(**kwargs):
_add_no_pie(kwargs)
_add_test_runner(kwargs)
go_test(**kwargs)

def pl_go_binary(**kwargs):
_add_no_pie(kwargs)
go_binary(**kwargs)

def pl_py_test(**kwargs):
_add_test_runner(kwargs)
_add_no_sysroot(kwargs)
py_test(**kwargs)

def pl_sh_test(**kwargs):
_add_test_runner(kwargs)
native.sh_test(**kwargs)
Loading

0 comments on commit fc6ce19

Please sign in to comment.