Skip to content

Commit deb7722

Browse files
committed
Add env qa command group
1 parent 2f0738c commit deb7722

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3978
-60
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
88

99
## Unreleased
1010

11+
***Added:***
12+
13+
- Add `env qa` command group for managing QA environments
14+
- Add the `linux-container` QA environment type
15+
1116
## 0.23.1 - 2025-07-25
1217

1318
***Fixed:***
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Environment metadata
2+
3+
-----
4+
5+
::: dda.env.models.EnvironmentMetadata
6+
7+
::: dda.env.models.EnvironmentNetworkMetadata
8+
9+
::: dda.env.models.EnvironmentPortMetadata
10+
11+
::: dda.env.models.EnvironmentPort
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# QA environment interface
2+
3+
-----
4+
5+
Environment types implementing the [`QAEnvironmentInterface`][dda.env.qa.interface.QAEnvironmentInterface] interface may be managed by the [`env qa`](../../../cli/commands.md#dda-env-qa) command group.
6+
7+
::: dda.env.qa.interface.QAEnvironmentConfig
8+
options:
9+
show_labels: true
10+
unwrap_annotated: true
11+
12+
::: dda.env.qa.interface.QAEnvironmentInterface
13+
options:
14+
show_labels: true
15+
show_if_no_docstring: false

hatch.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ extra-dependencies = [
1515
extra-dependencies = [
1616
"mypy",
1717
"pytest",
18+
"types-pyyaml",
1819
]
1920
[envs.types.scripts]
20-
check = "mypy --install-types --non-interactive {args:src/dda tests}"
21+
check = "mypy {args:src/dda tests}"
2122

2223
[envs.docs]
2324
dependencies = [

mkdocs.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,11 @@ nav:
8383
- Interface:
8484
- Tool: reference/interface/tool.md
8585
- Environments:
86-
- Status: reference/interface/env/status.md
8786
- Types:
8887
- Developer: reference/interface/env/types/dev.md
88+
- QA: reference/interface/env/types/qa.md
89+
- Status: reference/interface/env/status.md
90+
- Metadata: reference/interface/env/metadata.md
8991
- Guidelines:
9092
- CLI: guidelines/cli.md
9193
- Documentation: guidelines/docs.md

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ dependencies = [
4040
"psutil~=7.0",
4141
"pyjson5~=1.6.9",
4242
"pywinpty~=2.0.15; sys_platform == 'win32'",
43+
"pyyaml~=6.0.2",
4344
"rich~=14.0",
4445
"rich-click~=1.8.9",
4546
"tomlkit~=0.13",
@@ -178,7 +179,6 @@ legacy-notifications = [
178179
"codeowners==0.6.0",
179180
"invoke==2.2.0",
180181
"requests==2.32.3",
181-
"pyyaml==6.0.1",
182182
"slack-sdk~=3.27.1",
183183
"tabulate[widechars]==0.9.0",
184184
]

src/dda/cli/env/qa/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2025-present Datadog, Inc. <dev@datadoghq.com>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
from __future__ import annotations
5+
6+
from dda.cli.base import dynamic_group
7+
8+
9+
@dynamic_group(
10+
short_help="Work with QA environments",
11+
)
12+
def cmd() -> None:
13+
pass
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# SPDX-FileCopyrightText: 2025-present Datadog, Inc. <dev@datadoghq.com>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
from __future__ import annotations
5+
6+
from dda.cli.base import dynamic_group
7+
8+
9+
@dynamic_group(
10+
short_help="Manage Agent configuration",
11+
)
12+
def cmd() -> None:
13+
pass
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: 2025-present Datadog, Inc. <dev@datadoghq.com>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
import click
9+
10+
from dda.cli.base import dynamic_command, pass_app
11+
from dda.cli.env.qa.utils import option_env_type
12+
13+
if TYPE_CHECKING:
14+
from dda.cli.application import Application
15+
16+
17+
@dynamic_command(short_help="Open the Agent config location in your file manager")
18+
@option_env_type()
19+
@click.option("--id", "instance", default="default", help="Unique identifier for the environment")
20+
@pass_app
21+
def cmd(app: Application, *, env_type: str, instance: str) -> None:
22+
"""
23+
Open the Agent config location in your file manager.
24+
"""
25+
from dda.env.qa import get_qa_env
26+
27+
env = get_qa_env(env_type)(
28+
app=app,
29+
name=env_type,
30+
instance=instance,
31+
)
32+
if not env.agent_config_dir.is_dir():
33+
app.abort(f"QA environment `{instance}` of type `{env_type}` does not exist")
34+
35+
click.launch(str(env.agent_config.path), locate=True)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-FileCopyrightText: 2025-present Datadog, Inc. <dev@datadoghq.com>
2+
#
3+
# SPDX-License-Identifier: MIT
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING
7+
8+
import click
9+
10+
from dda.cli.base import dynamic_command, pass_app
11+
from dda.cli.env.qa.utils import option_env_type
12+
13+
if TYPE_CHECKING:
14+
from dda.cli.application import Application
15+
16+
17+
@dynamic_command(short_help="Output the location of the Agent config")
18+
@option_env_type()
19+
@click.option("--id", "instance", default="default", help="Unique identifier for the environment")
20+
@pass_app
21+
def cmd(app: Application, *, env_type: str, instance: str) -> None:
22+
"""
23+
Output the location of the Agent config.
24+
"""
25+
from dda.env.qa import get_qa_env
26+
27+
env = get_qa_env(env_type)(
28+
app=app,
29+
name=env_type,
30+
instance=instance,
31+
)
32+
if not env.agent_config_dir.is_dir():
33+
app.abort(f"QA environment `{instance}` of type `{env_type}` does not exist")
34+
35+
app.display(str(env.agent_config.root_dir))

0 commit comments

Comments
 (0)