mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-20 04:04:21 -04:00
bazel: command to prepare development workspace (#1425)
This command symlinks all binaries into the current working directory (or the path specified by the first argument) * bazel: command to prepare development workspace * bazel: set malt3 as codeowner
This commit is contained in:
parent
e4b5ef0ed4
commit
a73cdb9b14
8 changed files with 86 additions and 3 deletions
|
@ -16,6 +16,11 @@ alias(
|
||||||
actual = "//bazel/ci:check",
|
actual = "//bazel/ci:check",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
alias(
|
||||||
|
name = "devbuild",
|
||||||
|
actual = "//bazel/devbuild:devbuild",
|
||||||
|
)
|
||||||
|
|
||||||
# These magic Gazelle commands need to be in the top-level BUILD file.
|
# These magic Gazelle commands need to be in the top-level BUILD file.
|
||||||
# gazelle:map_kind go_test go_test //bazel/go:go_test.bzl
|
# gazelle:map_kind go_test go_test //bazel/go:go_test.bzl
|
||||||
# gazelle:prefix github.com/edgelesssys/constellation/v2
|
# gazelle:prefix github.com/edgelesssys/constellation/v2
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
/.github @katexochen
|
/.github @katexochen
|
||||||
/3rdparty/gcp-guest-agent @malt3
|
/3rdparty/gcp-guest-agent @malt3
|
||||||
/apko @katexochen
|
/apko @katexochen
|
||||||
|
/bazel @malt3
|
||||||
/bootstrapper @3u13r
|
/bootstrapper @3u13r
|
||||||
/cli @katexochen
|
/cli @katexochen
|
||||||
/cli/internal/helm @derpsteb
|
/cli/internal/helm @derpsteb
|
||||||
|
|
|
@ -47,6 +47,7 @@ sh_library(
|
||||||
srcs = [
|
srcs = [
|
||||||
"lib.bash",
|
"lib.bash",
|
||||||
],
|
],
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
sh_template(
|
sh_template(
|
||||||
|
|
21
bazel/devbuild/BUILD.bazel
Normal file
21
bazel/devbuild/BUILD.bazel
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
load("//bazel/ci:def.bzl", "sh_template")
|
||||||
|
|
||||||
|
sh_template(
|
||||||
|
name = "devbuild",
|
||||||
|
data = [
|
||||||
|
"//bazel/ci:base_lib",
|
||||||
|
"//bootstrapper/cmd/bootstrapper",
|
||||||
|
"//cli:cli_oss_host",
|
||||||
|
"//debugd/cmd/cdbg:cdbg_host",
|
||||||
|
"//upgrade-agent/cmd",
|
||||||
|
],
|
||||||
|
substitutions = {
|
||||||
|
"@@BASE_LIB@@": "$(rootpath //bazel/ci:base_lib)",
|
||||||
|
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper)",
|
||||||
|
"@@CLI@@": "$(rootpath //cli:cli_oss_host)",
|
||||||
|
"@@CDBG@@": "$(rootpath //debugd/cmd/cdbg:cdbg_host)",
|
||||||
|
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd)",
|
||||||
|
},
|
||||||
|
template = "prepare_developer_workspace.sh.in",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
29
bazel/devbuild/prepare_developer_workspace.sh.in
Executable file
29
bazel/devbuild/prepare_developer_workspace.sh.in
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# This script is run from the user's Constellation workspace (BUILD_WORKING_DIRECTORY).
|
||||||
|
# It prepares the workspace by symlinking all required binaries into folder.
|
||||||
|
|
||||||
|
lib=$(realpath @@BASE_LIB@@) || exit 1
|
||||||
|
bootstrapper=$(realpath @@BOOTSTRAPPER@@) || exit 1
|
||||||
|
upgrade_agent=$(realpath @@UPGRADE_AGENT@@) || exit 1
|
||||||
|
cli=$(realpath @@CLI@@) || exit 1
|
||||||
|
cdbg=$(realpath @@CDBG@@) || exit 1
|
||||||
|
|
||||||
|
# shellcheck source=../ci/lib.bash
|
||||||
|
if ! source "${lib}"; then
|
||||||
|
echo "Error: could not find import"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd "${BUILD_WORKING_DIRECTORY}" || exit 1
|
||||||
|
|
||||||
|
if [[ $# -eq 0 ]] ; then
|
||||||
|
workdir="."
|
||||||
|
else
|
||||||
|
workdir="$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ln -sf "${bootstrapper}" "${workdir}/bootstrapper"
|
||||||
|
ln -sf "${upgrade_agent}" "${workdir}/upgrade-agent"
|
||||||
|
ln -sf "${cli}" "${workdir}/constellation"
|
||||||
|
ln -sf "${cdbg}" "${workdir}/cdbg"
|
|
@ -43,3 +43,16 @@ go_binary(
|
||||||
"enterprise",
|
"enterprise",
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[
|
||||||
|
go_cross_binary(
|
||||||
|
name = "cli_%s_host" % edition,
|
||||||
|
platform = "@local_config_platform//:host",
|
||||||
|
target = ":cli_%s" % edition,
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
for edition in [
|
||||||
|
"oss",
|
||||||
|
"enterprise",
|
||||||
|
]
|
||||||
|
]
|
||||||
|
|
|
@ -30,3 +30,10 @@ go_binary(
|
||||||
"linux_arm64",
|
"linux_arm64",
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|
||||||
|
go_cross_binary(
|
||||||
|
name = "cdbg_host",
|
||||||
|
platform = "@local_config_platform//:host",
|
||||||
|
target = ":cdbg",
|
||||||
|
visibility = ["//visibility:public"],
|
||||||
|
)
|
||||||
|
|
|
@ -21,13 +21,19 @@ Prerequisites:
|
||||||
sudo dnf install @development-tools pkg-config cmake openssl-devel cryptsetup-libs cryptsetup-devel
|
sudo dnf install @development-tools pkg-config cmake openssl-devel cryptsetup-libs cryptsetup-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
CMake wrapper:
|
Developer workspace:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ..
|
# build required binaries for a dev build
|
||||||
make
|
# and symlink them into the current directory
|
||||||
|
bazel run //:devbuild
|
||||||
|
./constellation ...
|
||||||
|
# modify code
|
||||||
|
# rerun to ensure that all binaries are up to date
|
||||||
|
bazel run //:devbuild
|
||||||
|
./constellation ...
|
||||||
```
|
```
|
||||||
|
|
||||||
Bazel build:
|
Bazel build:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue