constellation/bazel/release/BUILD.bazel
Malte Poll ae6b22a143
deps: update rules_oci to a pre-release version to fix memory leak (#2729)
rules_oci spawns local container registry processes and in the past,
those would not be cleaned up explicitly, leading to an accumulation
of processes when using remote execution with buildbarn.
This pre-release contains a fix: https://github.com/bazel-contrib/rules_oci/pull/421
Additionally, windows support for rules_oci was removed in this fork,
since it is currently broken.
2023-12-19 15:40:04 +01:00

79 lines
2.0 KiB
Python

"""
This folder contains labels used to collect release artifacts.
"""
load("@com_github_ash2k_bazel_tools//multirun:def.bzl", "multirun")
load("@rules_oci//oci:defs.bzl", "oci_push")
load("//bazel/oci:containers.bzl", "container_reponame", "containers")
load("//bazel/oci:pin.bzl", "oci_sum", "oci_sum_merge")
[
container_reponame(
name = container["name"] + "_reponame",
container_name = container["image_name"],
)
for container in containers()
]
[
genrule(
name = container["name"] + "_repotag",
srcs = [
"//bazel/release:" + container["name"] + "_reponame",
"//bazel/settings:tag",
],
outs = [container["repotag_file"]],
cmd = "echo -n ':' | cat $(location //bazel/release:" + container["name"] + "_reponame) - $(location //bazel/settings:tag) > $@",
visibility = ["//visibility:public"],
)
for container in containers()
]
[
oci_sum(
name = container["name"] + "_sum",
image_name = container["image_name"],
oci = container["oci"],
repotag_file = container["repotag_file"],
)
for container in containers()
]
oci_sum_merge(
name = "container_sums",
sums = [
":%s_sum" % container["name"]
for container in containers()
],
visibility = ["//visibility:public"],
)
[
oci_push(
name = container["name"] + "_push",
image = container["oci"],
remote_tags = "//bazel/settings:tag",
repository_file = "//bazel/release:" + container["name"] + "_reponame",
)
for container in containers()
]
multirun(
name = "push",
commands = [
":" + container["name"] + "_push"
for container in containers()
],
jobs = 0, # execute in parallel
visibility = ["//visibility:public"],
)
multirun(
name = "build_and_push",
commands = [
"//bazel/release:push",
"//bazel/devbuild:devbuild",
],
visibility = ["//visibility:public"],
)