Docker: Add "manual" build tag to reduce build times in CI (#12967)

* Add manual tags to oci images. This reduces build times for build and test in CI.

* Ran buildifier on tools dir
This commit is contained in:
Preston Van Loon
2023-09-28 12:49:26 -05:00
committed by GitHub
parent 02ee6897bb
commit a7361cd5ab
9 changed files with 71 additions and 66 deletions

View File

@@ -137,4 +137,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath. # Backwards compatiability for images that depended on the old filepath.
"/app/cmd/beacon-chain/beacon-chain": "/beacon-chain", "/app/cmd/beacon-chain/beacon-chain": "/beacon-chain",
}, },
tags = ["manual"],
) )

View File

@@ -99,4 +99,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath. # Backwards compatiability for images that depended on the old filepath.
"/app/cmd/prysmctl/prysmctl": "/prysmctl", "/app/cmd/prysmctl/prysmctl": "/prysmctl",
}, },
tags = ["manual"],
) )

View File

@@ -132,4 +132,5 @@ prysm_image_upload(
# Backwards compatiability for images that depended on the old filepath. # Backwards compatiability for images that depended on the old filepath.
"/app/cmd/validator/validator": "/validator", "/app/cmd/validator/validator": "/validator",
}, },
tags = ["manual"],
) )

View File

@@ -5,11 +5,11 @@ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
go_library( go_library(
name = "go_default_library", name = "go_default_library",
srcs = ["main.go"], srcs = ["main.go"],
importpath = "github.com/prysmaticlabs/prysm/v4/tools/beacon-fuzz",
visibility = ["//visibility:private"],
deps = [ deps = [
"//io/file:go_default_library", "//io/file:go_default_library",
], ],
importpath = "github.com/prysmaticlabs/prysm/v4/tools/beacon-fuzz",
visibility = ["//visibility:private"],
) )
go_binary( go_binary(

View File

@@ -34,7 +34,6 @@ def cc_autoconf_toolchains_impl(repository_ctx):
else: else:
repository_ctx.file("BUILD", "# C++ toolchain autoconfiguration was disabled by BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN env variable.") 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()): def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
"""Generate BUILD file with 'cc_toolchain' targets for the local host C++ toolchain. """Generate BUILD file with 'cc_toolchain' targets for the local host C++ toolchain.
@@ -45,10 +44,10 @@ def cc_autoconf_impl(repository_ctx, overriden_tools = dict()):
cpu_value = get_cpu_value(repository_ctx) cpu_value = get_cpu_value(repository_ctx)
if cpu_value.startswith("darwin"): if cpu_value.startswith("darwin"):
print("Configuring local C++ toolchain for Darwin. This is non-hermetic and builds may " + 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.") "not be reproducible. Consider building on linux for a hermetic build.")
configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools) configure_unix_toolchain(repository_ctx, cpu_value, overriden_tools)
else: else:
paths = resolve_labels(repository_ctx, [ paths = resolve_labels(repository_ctx, [
"@bazel_tools//tools/cpp:BUILD.empty.tpl", "@bazel_tools//tools/cpp:BUILD.empty.tpl",
"@bazel_tools//tools/cpp:empty_cc_toolchain_config.bzl", "@bazel_tools//tools/cpp:empty_cc_toolchain_config.bzl",
@@ -111,4 +110,4 @@ def configure_nonhermetic_darwin():
native.register_toolchains( native.register_toolchains(
# Use register_toolchain's target pattern expansion to register all toolchains in the package. # Use register_toolchain's target pattern expansion to register all toolchains in the package.
"@local_config_cc_toolchains//:all", "@local_config_cc_toolchains//:all",
) )

View File

@@ -1,48 +1,46 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
def prysm_image_deps(): def prysm_image_deps():
http_file( http_file(
name = "bash_amd64", name = "bash_amd64",
sha256 = "f702ef058e762d7208a9c83f6f6bbf02645533bfd615c54e8cdcce842cd57377", sha256 = "f702ef058e762d7208a9c83f6f6bbf02645533bfd615c54e8cdcce842cd57377",
urls = [ urls = [
"http://ftp.us.debian.org/debian/pool/main/b/bash/bash_5.1-2+deb11u1_amd64.deb", "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://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.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://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_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",
],
)

View File

@@ -3,16 +3,17 @@ load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools:multi_arch.bzl", "multi_arch") load("//tools:multi_arch.bzl", "multi_arch")
def prysm_image_upload( def prysm_image_upload(
name, name,
binary, binary,
entrypoint, entrypoint,
symlinks, symlinks,
repository): repository,
tags):
pkg_tar( pkg_tar(
name = "binary_tar", name = "binary_tar",
srcs = [binary], srcs = [binary],
symlinks=symlinks, symlinks = symlinks,
tags = tags,
) )
oci_image( oci_image(
@@ -25,6 +26,7 @@ def prysm_image_upload(
"//tools:bash_tar", "//tools:bash_tar",
":binary_tar", ":binary_tar",
], ],
tags = tags,
) )
multi_arch( multi_arch(
@@ -34,6 +36,7 @@ def prysm_image_upload(
"@io_bazel_rules_go//go/toolchain:linux_amd64_cgo", "@io_bazel_rules_go//go/toolchain:linux_amd64_cgo",
"@io_bazel_rules_go//go/toolchain:linux_arm64_cgo", "@io_bazel_rules_go//go/toolchain:linux_arm64_cgo",
], ],
tags = tags,
) )
oci_image_index( oci_image_index(
@@ -41,10 +44,12 @@ def prysm_image_upload(
images = [ images = [
":oci_multiarch", ":oci_multiarch",
], ],
tags = tags,
) )
oci_push( oci_push(
name = name, name = name,
image = ":oci_image_index", image = ":oci_image_index",
repository = repository, repository = repository,
) tags = tags,
)

View File

@@ -83,4 +83,4 @@ ssz_gen_marshal = rule(
outputs = {"out": "generated.ssz.go"}, outputs = {"out": "generated.ssz.go"},
) )
SSZ_DEPS = ["@com_github_prysmaticlabs_fastssz//:go_default_library"] SSZ_DEPS = ["@com_github_prysmaticlabs_fastssz//:go_default_library"]

View File

@@ -1,8 +1,8 @@
def moved_targets(targets, new_package): def moved_targets(targets, new_package):
for target in targets: for target in targets:
native.alias( native.alias(
name=target[1:], name = target[1:],
actual=new_package+target, actual = new_package + target,
deprecation="This target has moved to %s%s"%(new_package,target), deprecation = "This target has moved to %s%s" % (new_package, target),
tags = ["manual"], tags = ["manual"],
) )