mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-02-04 17:15:26 -05:00
bazel: fill microservice version on devbuild
target (#1994)
* wip: fill microservice version on devbuild * fill microservice versin on `devbuild`
This commit is contained in:
parent
e6dbb13c6c
commit
c7457bd942
@ -153,10 +153,13 @@ oci_register_toolchains(
|
|||||||
crane_version = LATEST_CRANE_VERSION,
|
crane_version = LATEST_CRANE_VERSION,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
load("@aspect_bazel_lib//lib:repositories.bzl", "register_yq_toolchains")
|
||||||
load("//bazel/toolchains:container_images.bzl", "containter_image_deps")
|
load("//bazel/toolchains:container_images.bzl", "containter_image_deps")
|
||||||
|
|
||||||
containter_image_deps()
|
containter_image_deps()
|
||||||
|
|
||||||
|
register_yq_toolchains()
|
||||||
|
|
||||||
# Multirun
|
# Multirun
|
||||||
load("//bazel/toolchains:multirun_deps.bzl", "multirun_deps")
|
load("//bazel/toolchains:multirun_deps.bzl", "multirun_deps")
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ sh_template(
|
|||||||
"//cli:cli_edition_host",
|
"//cli:cli_edition_host",
|
||||||
"//debugd/cmd/cdbg:cdbg_host",
|
"//debugd/cmd/cdbg:cdbg_host",
|
||||||
"//upgrade-agent/cmd:upgrade_agent_linux_amd64",
|
"//upgrade-agent/cmd:upgrade_agent_linux_amd64",
|
||||||
|
"@yq_toolchains//:resolved_toolchain",
|
||||||
],
|
],
|
||||||
substitutions = {
|
substitutions = {
|
||||||
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper:bootstrapper_linux_amd64)",
|
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper:bootstrapper_linux_amd64)",
|
||||||
@ -18,8 +19,10 @@ sh_template(
|
|||||||
"@@CONTAINER_SUMS@@": "$(rootpath //bazel/release:container_sums)",
|
"@@CONTAINER_SUMS@@": "$(rootpath //bazel/release:container_sums)",
|
||||||
"@@EDITION@@": "$(rootpath :devbuild_cli_edition)",
|
"@@EDITION@@": "$(rootpath :devbuild_cli_edition)",
|
||||||
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd:upgrade_agent_linux_amd64)",
|
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd:upgrade_agent_linux_amd64)",
|
||||||
|
"@@YQ@@": "$(YQ_BIN)",
|
||||||
},
|
},
|
||||||
template = "prepare_developer_workspace.sh.in",
|
template = "prepare_developer_workspace.sh.in",
|
||||||
|
toolchains = ["@yq_toolchains//:resolved_toolchain"],
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
lib=$(realpath @@BASE_LIB@@) || exit 1
|
lib=$(realpath @@BASE_LIB@@) || exit 1
|
||||||
stat "${lib}" >> /dev/null || exit 1
|
stat "${lib}" >> /dev/null || exit 1
|
||||||
|
|
||||||
|
yq=$(realpath @@YQ@@)
|
||||||
|
stat "${yq}" >> /dev/null
|
||||||
|
|
||||||
# shellcheck source=../sh/lib.bash
|
# shellcheck source=../sh/lib.bash
|
||||||
if ! source "${lib}"; then
|
if ! source "${lib}"; then
|
||||||
echo "Error: could not find import"
|
echo "Error: could not find import"
|
||||||
@ -59,3 +62,12 @@ ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${upgrade_agent}")"
|
|||||||
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${cdbg}")" "${workdir}/cdbg"
|
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${cdbg}")" "${workdir}/cdbg"
|
||||||
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${container_sums}")" "${workdir}/container_sums.sha256"
|
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${container_sums}")" "${workdir}/container_sums.sha256"
|
||||||
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${cli}")" "${workdir}/constellation"
|
ln -sf "$(replace_prefix "${host_cache}" "${builder_cache}" "${cli}")" "${workdir}/constellation"
|
||||||
|
|
||||||
|
build_version=$("${workdir}"/constellation version | grep ^Version: | awk '{print $2}')
|
||||||
|
if [[ ! -f "${workdir}/constellation-conf.yaml" ]]; then
|
||||||
|
echo "constellation-conf.yaml not present in workspace"
|
||||||
|
echo "Build version: ${build_version}"
|
||||||
|
else
|
||||||
|
$yq -i eval ".microserviceVersion=\"${build_version}\"" ./constellation-conf.yaml
|
||||||
|
echo "Microservice version updated to ${build_version} in constellation-conf.yaml"
|
||||||
|
fi
|
||||||
|
@ -8,6 +8,7 @@ def _sh_template_impl(ctx):
|
|||||||
substitutions = {}
|
substitutions = {}
|
||||||
for k, v in ctx.attr.substitutions.items():
|
for k, v in ctx.attr.substitutions.items():
|
||||||
sub = ctx.expand_location(v, ctx.attr.data)
|
sub = ctx.expand_location(v, ctx.attr.data)
|
||||||
|
sub = ctx.expand_make_variables("substitutions", sub, {})
|
||||||
substitutions[k] = sub
|
substitutions[k] = sub
|
||||||
|
|
||||||
ctx.actions.expand_template(
|
ctx.actions.expand_template(
|
||||||
@ -50,6 +51,7 @@ def sh_template(name, **kwargs):
|
|||||||
substitutions = kwargs.pop("substitutions", [])
|
substitutions = kwargs.pop("substitutions", [])
|
||||||
substitutions["@@BASE_LIB@@"] = "$(rootpath //bazel/sh:base_lib)"
|
substitutions["@@BASE_LIB@@"] = "$(rootpath //bazel/sh:base_lib)"
|
||||||
template = kwargs.pop("template", [])
|
template = kwargs.pop("template", [])
|
||||||
|
toolchains = kwargs.pop("toolchains", [])
|
||||||
|
|
||||||
_sh_template(
|
_sh_template(
|
||||||
name = script_name,
|
name = script_name,
|
||||||
@ -57,6 +59,7 @@ def sh_template(name, **kwargs):
|
|||||||
data = data,
|
data = data,
|
||||||
substitutions = substitutions,
|
substitutions = substitutions,
|
||||||
template = template,
|
template = template,
|
||||||
|
toolchains = toolchains,
|
||||||
)
|
)
|
||||||
|
|
||||||
native.sh_binary(
|
native.sh_binary(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user