Skip to content

Commit

Permalink
Docker: Add "manual" build tag to reduce build times in CI (#12967)
Browse files Browse the repository at this point in the history
* Add manual tags to oci images. This reduces build times for build and test in CI.

* Ran buildifier on tools dir
  • Loading branch information
prestonvanloon authored Sep 28, 2023
1 parent 02ee689 commit a7361cd
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 66 deletions.
1 change: 1 addition & 0 deletions cmd/beacon-chain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/beacon-chain/beacon-chain": "/beacon-chain",
},
tags = ["manual"],
)
1 change: 1 addition & 0 deletions cmd/prysmctl/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/prysmctl/prysmctl": "/prysmctl",
},
tags = ["manual"],
)
1 change: 1 addition & 0 deletions cmd/validator/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/validator/validator": "/validator",
},
tags = ["manual"],
)
4 changes: 2 additions & 2 deletions tools/beacon-fuzz/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library(
name = "go_default_library",
srcs = ["main.go"],
importpath = "github.com/prysmaticlabs/prysm/v4/tools/beacon-fuzz",
visibility = ["//visibility:private"],
deps = [
"//io/file:go_default_library",
],
importpath = "github.com/prysmaticlabs/prysm/v4/tools/beacon-fuzz",
visibility = ["//visibility:private"],
)

go_binary(
Expand Down
9 changes: 4 additions & 5 deletions tools/cross-toolchain/darwin_cc_hack.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ def cc_autoconf_toolchains_impl(repository_ctx):
else:
repository_ctx.file("BUILD", "# C++ toolchain autoconfiguration was disabled by BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN env variable.")


def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
"""Generate BUILD file with 'cc_toolchain' targets for the local host C++ toolchain.
Expand All @@ -45,10 +44,10 @@ def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
cpu_value = get_cpu_value(repository_ctx)

if cpu_value.startswith("darwin"):
print("Configuring local C++ toolchain for Darwin. This is non-hermetic and builds may " +
"not be reproducible. Consider building on linux for a hermetic build.")
print("Configuring local C++ toolchain for Darwin. This is non-hermetic and builds may " +
"not be reproducible. Consider building on linux for a hermetic build.")
configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools)
else:
else:
paths = resolve_labels(repository_ctx, [
"@bazel_tools//tools/cpp:BUILD.empty.tpl",
"@bazel_tools//tools/cpp:empty_cc_toolchain_config.bzl",
Expand Down Expand Up @@ -111,4 +110,4 @@ def configure_nonhermetic_darwin():
native.register_toolchains(
# Use register_toolchain's target pattern expansion to register all toolchains in the package.
"@local_config_cc_toolchains//:all",
)
)
84 changes: 41 additions & 43 deletions tools/image_deps.bzl
Original file line number Diff line number Diff line change
@@ -1,48 +1,46 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

def prysm_image_deps():
http_file(
name = "bash_amd64",
sha256 = "f702ef058e762d7208a9c83f6f6bbf02645533bfd615c54e8cdcce842cd57377",
urls = [
"http://ftp.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://http.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://ftp.uk.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://ftp.au.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
],
)

http_file(
name = "bash_arm64",
sha256 = "d7c7af5d86f43a885069408a89788f67f248e8124c682bb73936f33874e0611b",
urls = [
"http://ftp.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://http.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://ftp.uk.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://ftp.au.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
],
)

http_file(
name = "libtinfo6_amd64",
sha256 = "92ac8a8c12f02a6fe08c47f33ea6fb313e1b9480484e26eab34e2058ea59fdb4",
urls = [
"http://ftp.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://http.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://ftp.uk.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://ftp.au.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
],
)

http_file(
name = "libtinfo6_arm64",
sha256 = "8282a785437b305bca7758aba19252bd81b5d0d2a54b709af97e682516f1cf4e",
urls = [
"http://ftp.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://http.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://ftp.uk.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://ftp.au.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
],
)
http_file(
name = "bash_amd64",
sha256 = "f702ef058e762d7208a9c83f6f6bbf02645533bfd615c54e8cdcce842cd57377",
urls = [
"http://ftp.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://http.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://ftp.uk.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
"http://ftp.au.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb",
],
)

http_file(
name = "bash_arm64",
sha256 = "d7c7af5d86f43a885069408a89788f67f248e8124c682bb73936f33874e0611b",
urls = [
"http://ftp.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://http.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://ftp.uk.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
"http://ftp.au.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_arm64.deb",
],
)

http_file(
name = "libtinfo6_amd64",
sha256 = "92ac8a8c12f02a6fe08c47f33ea6fb313e1b9480484e26eab34e2058ea59fdb4",
urls = [
"http://ftp.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://http.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://ftp.uk.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
"http://ftp.au.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_amd64.deb",
],
)

http_file(
name = "libtinfo6_arm64",
sha256 = "8282a785437b305bca7758aba19252bd81b5d0d2a54b709af97e682516f1cf4e",
urls = [
"http://ftp.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://http.us.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://ftp.uk.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
"http://ftp.au.debian.org/debian/pool/main/n/ncurses/libtinfo6_6.2+20201114-2+deb11u1_arm64.deb",
],
)
21 changes: 13 additions & 8 deletions tools/prysm_image.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools:multi_arch.bzl", "multi_arch")

def prysm_image_upload(
name,
binary,
entrypoint,
symlinks,
repository):

name,
binary,
entrypoint,
symlinks,
repository,
tags):
pkg_tar(
name = "binary_tar",
srcs = [binary],
symlinks=symlinks,
symlinks = symlinks,
tags = tags,
)

oci_image(
Expand All @@ -25,6 +26,7 @@ def prysm_image_upload(
"//tools:bash_tar",
":binary_tar",
],
tags = tags,
)

multi_arch(
Expand All @@ -34,17 +36,20 @@ def prysm_image_upload(
"@io_bazel_rules_go//go/toolchain:linux_amd64_cgo",
"@io_bazel_rules_go//go/toolchain:linux_arm64_cgo",
],
tags = tags,
)

oci_image_index(
name = "oci_image_index",
images = [
":oci_multiarch",
],
tags = tags,
)

oci_push(
name = name,
image = ":oci_image_index",
repository = repository,
)
tags = tags,
)
2 changes: 1 addition & 1 deletion tools/ssz.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,4 @@ ssz_gen_marshal = rule(
outputs = {"out": "generated.ssz.go"},
)

SSZ_DEPS = ["@com_github_prysmaticlabs_fastssz//:go_default_library"]
SSZ_DEPS = ["@com_github_prysmaticlabs_fastssz//:go_default_library"]
14 changes: 7 additions & 7 deletions tools/target_migration.bzl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
def moved_targets(targets, new_package):
for target in targets:
native.alias(
name=target[1:],
actual=new_package+target,
deprecation="This target has moved to %s%s"%(new_package,target),
tags = ["manual"],
)
for target in targets:
native.alias(
name = target[1:],
actual = new_package + target,
deprecation = "This target has moved to %s%s" % (new_package, target),
tags = ["manual"],
)

0 comments on commit a7361cd

Please sign in to comment.