diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-05 11:19:16 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-07-24 09:53:24 +0000 |
commit | b5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch) | |
tree | d4d31289c39fc00da064a825df13a0b98ce95b10 /packaging/dag/build_command.py | |
parent | Adding upstream version 1.44.3. (diff) | |
download | netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.tar.xz netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.zip |
Adding upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/dag/build_command.py')
-rw-r--r-- | packaging/dag/build_command.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/packaging/dag/build_command.py b/packaging/dag/build_command.py new file mode 100644 index 00000000..dcb1b6c8 --- /dev/null +++ b/packaging/dag/build_command.py @@ -0,0 +1,65 @@ +import click +import asyncio +import sys +import dagger +import pathlib +import uuid + +from nd import ( + Distribution, + NetdataInstaller, + FeatureFlags, + Endpoint, + AgentContext, + SUPPORTED_PLATFORMS, + SUPPORTED_DISTRIBUTIONS, +) + + +def run_async(func): + def wrapper(*args, **kwargs): + return asyncio.run(func(*args, **kwargs)) + + return wrapper + + +@run_async +async def simple_build(platform, distro): + config = dagger.Config(log_output=sys.stdout) + + async with dagger.Connection(config) as client: + repo_root = pathlib.Path("/netdata") + prefix_path = pathlib.Path("/opt/netdata") + + installer = NetdataInstaller( + platform, distro, repo_root, prefix_path, FeatureFlags.DBEngine + ) + + endpoint = Endpoint("node", 19999) + api_key = uuid.uuid4() + allow_children = False + + agent_ctx = AgentContext( + client, platform, distro, installer, endpoint, api_key, allow_children + ) + + await agent_ctx.build_container() + + +@click.command() +@click.option( + "--platform", + "-p", + type=click.Choice(sorted([str(p) for p in SUPPORTED_PLATFORMS])), + help="Specify the platform.", +) +@click.option( + "--distribution", + "-d", + type=click.Choice(sorted([str(p) for p in SUPPORTED_DISTRIBUTIONS])), + help="Specify the distribution.", +) +def build(platform, distribution): + platform = dagger.Platform(platform) + distro = Distribution(distribution) + simple_build(platform, distro) |