Skip to content

Conversation

@ofek
Copy link
Contributor

@ofek ofek commented Aug 4, 2025

This adds a way to run Bazel commands and use a managed installation if there are no Bazel executables on PATH (or if configured as such).

@ofek ofek requested a review from a team as a code owner August 4, 2025 04:49
Copy link
Contributor

@Ishirui Ishirui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice, thanks ! Just one thing about the build namespace

Comment on lines +1 to +24
# SPDX-FileCopyrightText: 2025-present Datadog, Inc. <dev@datadoghq.com>
#
# SPDX-License-Identifier: MIT
from __future__ import annotations

from typing import TYPE_CHECKING

import click

from dda.cli.base import dynamic_command, pass_app

if TYPE_CHECKING:
from dda.cli.application import Application


@dynamic_command(
short_help="Run Bazel commands",
context_settings={"help_option_names": [], "ignore_unknown_options": True},
)
@click.argument("args", nargs=-1)
@pass_app
def cmd(app: Application, *, args: tuple[str, ...]) -> None:
process = app.tools.bazel.attach(list(args), check=False)
app.abort(code=process.returncode)
Copy link
Contributor

@Ishirui Ishirui Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thought for the future: do we want these kind of direct "tool-invocation" sort of commands to live in the build namespace ? It might be best to reserve that for the actual build tasks that we'll implement in the future, like dda build agent, dda build dogstatsd etc.

Maybe run or launch or exec or something similar would work ? We are after all just delegating the execution of some command to another tool

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • I think bazel would be the only exception for the build command group, it makes most sense for it to be there. The number of sister command groups would be smaller and more nested e.g. build comp for building individual components like the core Agent binary, build dist for building distributions like an MSI installer or a container, etc. The command could be instead something like tools bazel run but then it wouldn't be as intuitive or discoverable.
  • A nice part about having the command right under build is that it removes the need to have an extra word (run, exec, etc.) and you can just pass arguments directly to bazel.

@ofek ofek merged commit ee9b795 into main Aug 4, 2025
20 checks passed
@ofek ofek deleted the ofek/bazel branch August 4, 2025 13:56
github-actions bot pushed a commit that referenced this pull request Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants