multirun to use multiple repositories, but doesn't work with tag stamping

This commit is contained in:
Preston Van Loon
2023-06-28 10:35:46 -05:00
parent fc7361af92
commit 93afa76f65
3 changed files with 39 additions and 5 deletions

View File

@@ -422,6 +422,14 @@ filegroup(
],
)
http_archive(
name = "rules_multirun",
sha256 = "9cd384e42b2da00104f0e18f25e66285aa21f64b573c667638a7a213206885ab",
strip_prefix = "rules_multirun-0.6.1",
url = "https://github.com/keith/rules_multirun/archive/refs/tags/0.6.1.tar.gz",
)
load("//:deps.bzl", "prysm_deps")
# gazelle:repository_macro deps.bzl%prysm_deps

View File

@@ -162,7 +162,10 @@ prysm_image_upload(
name = "push_oci_image",
binary = ":beacon-chain",
entrypoint = ["/beacon-chain"],
repository = "gcr.io/prylabs-dev/prysm/beacon-chain",
repositories = [
"gcr.io/prylabs-dev/prysm/beacon-chain",
"gcr.io/prylabs-dev/prysm/beacon-chain2",
],
symlinks = {
# Backwards compatiability for images that depended on the old filepath.
"/app/cmd/beacon-chain/beacon-chain": "/beacon-chain",

View File

@@ -1,13 +1,15 @@
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index", "oci_push")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("//tools:multi_arch.bzl", "multi_arch")
load("@rules_multirun//:defs.bzl", "command", "multirun")
def prysm_image_upload(
name,
binary,
entrypoint,
symlinks,
repository):
repositories):
pkg_tar(
name = "binary_tar",
@@ -43,8 +45,29 @@ def prysm_image_upload(
],
)
oci_push(
[
oci_push(
name = "push_{}".format(i),
image = ":oci_image_index",
repository = repo,
)
for i, repo in enumerate(repositories)
]
[
command(
name = "cmd_{}".format(i),
command = ":push_{}".format(i),
arguments = ["--tag", "{DOCKER_TAG}"],
)
for i in range(len(repositories))
]
multirun(
name = name,
image = ":oci_image_index",
repository = repository,
commands = [
"cmd_{}".format(i)
for i in range(len(repositories))
],
#jobs = 0, # Set to 0 to run in parallel, defaults to sequential
)