Skip to content

Commit efaca8c

Browse files
authored
docs: add environment config reference and user guide for config subc… (#156)
* docs: add environment config reference and user guide for config subcommand (#110) Signed-off-by: sushant-suse <[email protected]> * docs: added fragment file, updated ruff checks Signed-off-by: sushant-suse <[email protected]> * docs: updated the descriptions of subcommands Signed-off-by: sushant-suse <[email protected]> --------- Signed-off-by: sushant-suse <[email protected]>
1 parent cbf5601 commit efaca8c

8 files changed

Lines changed: 81 additions & 48 deletions

File tree

changelog.d/110.doc.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added a comprehensive technical reference for environment configuration keys and a User Guide section for the ``docbuild config env`` subcommand.

docs/source/reference/_autoapi/docbuild/models/config/env/EnvBuildContainer.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,12 @@ docbuild.models.config.env.EnvBuildContainer
1717
Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].
1818

1919

20+
21+
.. py:attribute:: container
22+
:type: str
23+
:value: None
24+
25+
26+
The container image used for the build environment.
27+
28+

docs/source/reference/_autoapi/docbuild/models/config/env/EnvBuildDaps.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,21 @@ docbuild.models.config.env.EnvBuildDaps
1717
Configuration for the model, should be a dictionary conforming to [`ConfigDict`][pydantic.config.ConfigDict].
1818

1919

20+
21+
.. py:attribute:: command
22+
:type: str
23+
:value: None
24+
25+
26+
The base command used for DAPS execution.
27+
28+
29+
30+
.. py:attribute:: meta
31+
:type: str
32+
:value: None
33+
34+
35+
The command used to extract DAPS metadata.
36+
37+

docs/source/reference/_autoapi/docbuild/models/config/env/EnvPathsConfig.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ docbuild.models.config.env.EnvPathsConfig
100100

101101

102102
.. py:attribute:: base_tmp_dir
103-
:type: pathlib.Path
103+
:type: docbuild.models.path.EnsureWritableDirectory
104104
:value: None
105105

106106

docs/source/reference/_autoapi/docbuild/models/config/env/EnvTargetPaths.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,6 @@ docbuild.models.config.env.EnvTargetPaths
3232
:value: None
3333

3434

35-
Directory for backups.
35+
Local directory for storing build backups before deployment.
3636

3737

docs/source/reference/_autoapi/docbuild/models/config/env/EnvTmpPaths.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ docbuild.models.config.env.EnvTmpPaths
2828

2929

3030
.. py:attribute:: tmp_dir
31-
:type: pathlib.Path
31+
:type: docbuild.models.path.EnsureWritableDirectory
3232
:value: None
3333

3434

@@ -37,7 +37,7 @@ docbuild.models.config.env.EnvTmpPaths
3737

3838

3939
.. py:attribute:: tmp_deliverable_dir
40-
:type: pathlib.Path
40+
:type: docbuild.models.path.EnsureWritableDirectory
4141
:value: None
4242

4343

@@ -46,7 +46,7 @@ docbuild.models.config.env.EnvTmpPaths
4646

4747

4848
.. py:attribute:: tmp_metadata_dir
49-
:type: pathlib.Path
49+
:type: docbuild.models.path.EnsureWritableDirectory
5050
:value: None
5151

5252

@@ -64,7 +64,7 @@ docbuild.models.config.env.EnvTmpPaths
6464

6565

6666
.. py:attribute:: tmp_out_dir
67-
:type: pathlib.Path
67+
:type: docbuild.models.path.EnsureWritableDirectory
6868
:value: None
6969

7070

@@ -73,7 +73,7 @@ docbuild.models.config.env.EnvTmpPaths
7373

7474

7575
.. py:attribute:: log_dir
76-
:type: pathlib.Path
76+
:type: docbuild.models.path.EnsureWritableDirectory
7777
:value: None
7878

7979

docs/source/user/config.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,15 @@ To deal with different environments without having to type the full command each
3232
alias docbuild-prod='docbuild --env-config env.production.toml'
3333
alias docbuild-test='docbuild --env-config env.testing.toml'
3434
alias docbuild-dev='docbuild --env-config env.devel.toml'
35+
36+
Viewing the Environment Configuration
37+
------------------------------------
38+
39+
To see how ``docbuild`` interprets your environment configuration, use the ``config env`` subcommand. This is particularly useful for verifying that all placeholders (like ``{{product}}`` or ``{{lang}}``) have been correctly resolved into absolute paths.
40+
41+
.. code-block:: shell-session
42+
:caption: Displaying the resolved environment configuration
43+
44+
docbuild config env
45+
46+
If the configuration contains errors—such as missing mandatory keys or invalid data types—the command will output a validation error detailing what needs to be fixed.

src/docbuild/models/config/env.py

Lines changed: 34 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -43,19 +43,37 @@
4343
class EnvBuildDaps(BaseModel):
4444
"""Configuration for daps command execution."""
4545

46-
# Allows extra keys from the TOML file that aren't yet defined in the model schema.
4746
model_config = ConfigDict(extra="allow")
4847

49-
command: str = Field(..., description="The base daps command.")
50-
meta: str = Field(..., description="The daps metadata command.")
48+
command: str = Field(
49+
...,
50+
title="DAPS Command",
51+
description="The base daps command executable.",
52+
examples=["daps"]
53+
)
54+
"The base command used for DAPS execution."
55+
56+
meta: str = Field(
57+
...,
58+
title="DAPS Metadata Subcommand",
59+
description="The daps metadata command for extracting info.",
60+
examples=["daps metadata"]
61+
)
62+
"The command used to extract DAPS metadata."
5163

5264

5365
class EnvBuildContainer(BaseModel):
5466
"""Configuration for container usage."""
5567

5668
model_config = ConfigDict(extra="allow")
5769

58-
container: str = Field(..., description="The container registry path/name.")
70+
container: str = Field(
71+
...,
72+
title="Container Image",
73+
description="The container registry path or image name.",
74+
examples=["registry.opensuse.org/documentation/containers/15.6/opensuse-daps-toolchain:latest"]
75+
)
76+
"The container image used for the build environment."
5977

6078

6179
class EnvBuild(BaseModel):
@@ -175,9 +193,7 @@ class EnvTmpPaths(BaseModel):
175193

176194
tmp_deliverable_dir: EnsureWritableDirectory = Field(
177195
title="Temporary Deliverable Directory",
178-
description=(
179-
"The directory where deliverable repositories are cloned and processed."
180-
),
196+
description="The directory where deliverable repositories are cloned and processed.",
181197
examples=["/var/tmp/docbuild/doc-example-com/deliverable/"],
182198
)
183199
"Directory for temporary deliverable clones."
@@ -191,9 +207,7 @@ class EnvTmpPaths(BaseModel):
191207

192208
tmp_build_dir: str = Field(
193209
title="Temporary Build Directory",
194-
description=(
195-
"Temporary directory for intermediate files (contains placeholders)."
196-
),
210+
description="Temporary directory for intermediate files (contains placeholders).",
197211
examples=[
198212
"/var/tmp/docbuild/doc-example-com/build/{{product}}-{{docset}}-{{lang}}"
199213
],
@@ -202,10 +216,7 @@ class EnvTmpPaths(BaseModel):
202216

203217
tmp_out_dir: EnsureWritableDirectory = Field(
204218
title="Temporary Output Directory",
205-
description=(
206-
"The final temporary directory where built artifacts land before "
207-
"deployment."
208-
),
219+
description="The final temporary directory where built artifacts land before deployment.",
209220
examples=["/var/tmp/docbuild/doc-example-com/out/"],
210221
)
211222
"Temporary final output directory."
@@ -242,11 +253,10 @@ class EnvTargetPaths(BaseModel):
242253

243254
backup_dir: Path = Field(
244255
title="Build Server Backup Directory",
245-
description=(
246-
"The location on the build server before it is synced to the target path."
247-
),
256+
description="The location on the build server before it is synced to the target path.",
257+
examples=["/var/lib/docbuild/backups"]
248258
)
249-
"Directory for backups."
259+
"Local directory for storing build backups before deployment."
250260

251261

252262
class EnvPathsConfig(BaseModel):
@@ -256,20 +266,14 @@ class EnvPathsConfig(BaseModel):
256266

257267
config_dir: Path = Field(
258268
title="Configuration Directory",
259-
description=(
260-
"The configuration directory containing application and environment "
261-
"files (e.g. app.toml)"
262-
),
269+
description="The configuration directory containing application and environment files (e.g. app.toml).",
263270
examples=["/etc/docbuild"],
264271
)
265272
"Path to configuration files."
266273

267274
root_config_dir: Path = Field(
268275
title="Root Configuration Directory",
269-
description=(
270-
"The highest-level configuration directory containing common "
271-
"configuration files."
272-
),
276+
description="The highest-level directory containing common config files.",
273277
examples=["/etc/docbuild"],
274278
)
275279
"Path to the root configuration files."
@@ -283,10 +287,7 @@ class EnvPathsConfig(BaseModel):
283287

284288
server_rootfiles_dir: Path = Field(
285289
title="Server Root Files Directory",
286-
description=(
287-
"Directory for files that should be placed in the root of the "
288-
"server deployment."
289-
),
290+
description="Files placed in the root of the server deployment.",
290291
examples=["/etc/docbuild/server-root-files-doc-suse-com"],
291292
)
292293
"Path for server root files."
@@ -300,10 +301,7 @@ class EnvPathsConfig(BaseModel):
300301

301302
tmp_repo_dir: Path = Field(
302303
title="Temporary Repository Directory",
303-
description=(
304-
"The directory used for temporary working copies cloned from "
305-
"the permanent bare repositories."
306-
),
304+
description="Directory used for temporary working copies cloned from permanent bare repos.",
307305
examples=["/var/cache/docbuild/repos/temporary-branches/"],
308306
)
309307
"Directory for temporary working copies."
@@ -324,19 +322,14 @@ class EnvPathsConfig(BaseModel):
324322

325323
meta_cache_dir: Path = Field(
326324
title="Metadata Cache Directory",
327-
description=(
328-
"Cache directory specifically for repository and deliverable metadata."
329-
),
325+
description="Cache specifically for repository and deliverable metadata.",
330326
examples=["/var/cache/docbuild/doc-example-com/meta"],
331327
)
332328
"Metadata cache path."
333329

334330
base_tmp_dir: EnsureWritableDirectory = Field(
335331
title="Base Temporary Directory (System Wide)",
336-
description=(
337-
"The root directory for all temporary artifacts (used for "
338-
"placeholder resolution)."
339-
),
332+
description="The root directory for all temporary artifacts (used for placeholder resolution).",
340333
examples=["/var/tmp/docbuild"],
341334
)
342335
"Base system temporary path."

0 commit comments

Comments
 (0)