Skip to content

Commit 1b9fc98

Browse files
dmcilvaneychristopherco
authored andcommitted
docs(ai): Update docs with new azldev render feature
1 parent 3242244 commit 1b9fc98

11 files changed

Lines changed: 142 additions & 25 deletions

File tree

.github/copilot-instructions.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,23 @@ azldev.toml # Root config — includes distro/ and base
2525
│ ├── distro.toml # Includes all *.distro.toml
2626
│ ├── fedora.distro.toml # Fedora: dist-git URIs, lookaside, version branches
2727
│ └── mock/ # Mock build environment configs
28+
├── specs/ # Rendered specs (generated by `azldev comp render`)
29+
│ └── <first-char>/<name>/ # Per-component: spec, patches, scripts (no source tarballs)
2830
└── external/schemas/
2931
└── azldev.schema.json # Authoritative schema for all TOML config files
3032
```
3133

34+
## Rendered Specs (`specs/`)
35+
36+
The `specs/` directory (as specified by `rendered-specs-dir` config) contains rendered spec files generated by `azldev comp render`. These are the final specs with all overlays applied — ready for check-in. After adding or modifying components/overlays, re-render:
37+
38+
```bash
39+
azldev comp render -p <name> # Single component
40+
azldev comp render -a # All components (slow)
41+
```
42+
43+
To inspect what a component's spec looks like after overlays, read `specs/<first-char>/<name>/<name>.spec` directly — no need to run `prep-sources` just to view the result. Use `prep-sources` when you need the full source tree (tarballs) or want to diff pre/post overlay output for debugging.
44+
3245
## Key Concepts
3346

3447
**Components** = unit of packaging (→ one or more RPMs). Spec sources: upstream (default, from Fedora dist-git), local, or pinned upstream. See [`comp-toml.instructions.md`](instructions/comp-toml.instructions.md#spec-source-types) for syntax.
@@ -52,13 +65,15 @@ Run all commands from the repo root (where `azldev.toml` lives). If the terminal
5265
| Add a component | `azldev comp add` |
5366
| Build a component | `azldev comp build -p <name> -q` |
5467
| Build chain (auto-publish to local repo) | `azldev comp build --local-repo-with-publish ./base/out -p <a> -p <b> -q` |
68+
| Render all specs for check-in | `azldev comp render -a` |
69+
| Render a single component | `azldev comp render -p <name>` |
5570
| Prepare sources (apply overlays) | `azldev comp prep-sources -p <name> --force -o <dir> -q` |
5671
| Prepare sources (skip overlays) | `azldev comp prep-sources -p <name> --skip-overlays --force -o <dir> -q` |
5772
| Build, keep env on failure | `azldev comp build -p <name> --preserve-buildenv on-failure -q` |
5873
| List images | `azldev image list` |
5974
| Build an image | `azldev image build` |
6075
| Boot an image in QEMU | `azldev image boot` |
61-
| Dump resolved config | `azldev config dump -q -O json` |
76+
| Dump resolved config | `azldev config dump -q -f json` |
6277
| Advanced commands (like mock shell) | `azldev adv --help` (hidden from normal help) |
6378

6479
## Repository Hygiene Rules
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
applyTo: "specs/**/*"
3+
description: ALWAYS refer to this when working with rendered spec files (`*.spec`) in the `specs/` directory.
4+
---
5+
6+
# Rendered Spec Files (`specs/*.spec`)
7+
8+
## What are rendered specs?
9+
10+
Rendered specs are generated by the `azldev comp render` command based on the component definitions and overlays. They are output to the `specs/` directory (as specified by `rendered-specs-dir` config) and should not be edited directly.
11+
12+
They are meant to be consumed by downstream processes (e.g., build pipelines) and are the source of truth for all subsequent steps. Any changes to the spec should be made via the component definition and overlays, not by editing the rendered spec.
13+
14+
## Changing a rendered spec
15+
16+
To change a rendered spec, modify the component's `.comp.toml` and/or its overlays. Then re-run the render command to regenerate the spec:
17+
18+
```bash
19+
# VERY SLOW - Re-render all specs, removes any stale specs that are no longer defined in the components
20+
azldev comp render -a --clean-stale -O json
21+
```
22+
23+
```bash
24+
# Small set, will NOT remove stale specs, faster for iterative development
25+
azldev comp render -p <component-1> -p <component-2> -O json
26+
```
27+
28+
```bash
29+
# Custom output directory, useful for debugging. When not using the automatically configured spec directory, --force is
30+
# required to delete and re-create the output folders if they already exist.
31+
azldev comp render -p <component> -O json -o ./base/build/work/scratch/rendered-specs --force
32+
```

.github/instructions/spec.instructions.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
2-
applyTo: "**/*.spec"
2+
applyTo: "base/**/*.spec"
3+
description: Read this when working with spec files (`*.spec`) that are hand-maintained in the Azure Linux repo (not rendered).
34
---
45

56
# RPM Spec Files (`*.spec`)

.github/prompts/azl-add-component.prompt.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ Follow the workflow in the [skill-add-component skill](../skills/skill-add-compo
1919
- Needs overlays or customizations → create `${input:component_name}/${input:component_name}.comp.toml`
2020
- Needs extensive changes overlays can't handle → forked local spec (**last resort**, requires explicit user sign-off)
2121
6. Add overlays with meaningful `description` fields explaining *why* each change is needed
22-
7. Validate: `azldev comp prep-sources -p ${input:component_name} --force -o base/build/work/scratch/${input:component_name}-post -q` (with overlays) and diff against the skip-overlays output
22+
7. Render and verify: `azldev comp render -p ${input:component_name}` and inspect `specs/` (as specified by `rendered-specs-dir` config) output. For deeper debugging, diff pre/post overlay output with `prep-sources`.
2323
8. Build: `azldev comp build -p ${input:component_name} -q`
2424
9. Smoke-test the built RPMs in a mock chroot

.github/prompts/azl-debug-component.prompt.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,21 @@ First, determine the error category:
2727
- Follow the `skill-mock` workflow: install RPMs in a mock chroot, verify contents, check dependencies
2828
- Common causes: missing Requires, wrong file paths, permission issues
2929

30-
**When in doubt**, start with a `prep-sources` pre/post diff to determine if the issue is overlay-related:
30+
**When in doubt**, start with a render to determine if the issue is overlay-related:
31+
32+
```bash
33+
azldev comp render -p ${input:component_name}
34+
```
35+
36+
If `render` fails, the issue is overlay-related (category 1). For deeper debugging, diff pre/post overlay output:
3137

3238
```bash
3339
azldev comp prep-sources -p ${input:component_name} --skip-overlays -o base/build/work/scratch/${input:component_name}-pre --force
3440
azldev comp prep-sources -p ${input:component_name} -o base/build/work/scratch/${input:component_name}-post --force
3541
diff -r base/build/work/scratch/${input:component_name}-pre base/build/work/scratch/${input:component_name}-post
3642
```
3743

38-
If `prep-sources` itself fails, the issue is overlay-related (category 1). If it succeeds but `comp build` fails, it's a build issue (category 2).
44+
If both render and `prep-sources` succeed but `comp build` fails, it's a build issue (category 2).
3945

4046
## Fix
4147

.github/prompts/azl-update-component.prompt.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ Use structural patterns from [comp-toml.instructions.md](../instructions/comp-to
1818
- `config` — build config changes (`build.defines`, `build.without`)
1919
3. **Apply changes** to the `.comp.toml` file
2020
4. **Verify overlays still apply:**
21+
```bash
22+
azldev comp render -p ${input:component_name}
23+
```
24+
Inspect `specs/` (as specified by `rendered-specs-dir` config) output. For deeper debugging, diff pre/post overlay output:
2125
```bash
2226
azldev comp prep-sources -p ${input:component_name} --skip-overlays -o base/build/work/scratch/${input:component_name}-pre --force
2327
azldev comp prep-sources -p ${input:component_name} -o base/build/work/scratch/${input:component_name}-post --force

.github/skills/skill-add-component/SKILL.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ Overlays are vastly preferable to maintaining a forked spec, they get automatic
6969

7070
## Validate
7171

72+
After adding overlays or customizations, render the spec to verify:
73+
74+
```bash
75+
azldev comp render -p <name>
76+
# Inspect the result
77+
cat specs/<first-char>/<name>/<name>.spec
78+
```
79+
80+
For deeper debugging (diffing pre/post overlay output with full sources):
81+
7282
> Use a temp dir for `prep-sources` output. Use `--force` to overwrite an existing output dir.
7383
7484
`prep-sources -o <dir>` writes to a user-specified directory (NOT `base/out/` — that's for `comp build` output).
@@ -77,9 +87,11 @@ Overlays are vastly preferable to maintaining a forked spec, they get automatic
7787
azldev comp prep-sources -p <name> --skip-overlays --force -o base/build/work/scratch/<name>-pre -q
7888
azldev comp prep-sources -p <name> --force -o base/build/work/scratch/<name>-post -q
7989
diff -r base/build/work/scratch/<name>-pre base/build/work/scratch/<name>-post
90+
```
8091

92+
```bash
8193
# Test build (RPMs land in base/out/ per project.toml output-dir)
8294
azldev comp build -p <name> -q
8395
```
8496

85-
For testing the built RPMs, see the [`skill-mock`](../skill-mock/SKILL.md) skill. New components always need a smoke-test. For the full inner loop cycle (investigate → modify → verify → build → test → inspect), see [`skill-build-component`](../skill-build-component/SKILL.md).
97+
For testing the built RPMs, see the [`skill-mock`](../skill-mock/SKILL.md) skill. New components always need a smoke-test. For the full inner loop cycle (investigate → modify → render → build → test → inspect), see [`skill-build-component`](../skill-build-component/SKILL.md).

.github/skills/skill-build-component/SKILL.md

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,26 +49,40 @@ Build foundational packages first (e.g., `azurelinux-rpm-config`), then dependen
4949
The standard cycle for investigating, modifying, and verifying components:
5050

5151
```
52-
investigate → modify → verify → build → test → inspect
52+
investigate → modify → render → build → test → inspect
5353
```
5454

5555
| Step | Command | What to check |
5656
|------|---------|---------------|
57-
| **Investigate** | `prep-sources --skip-overlays --force -o base/build/work/scratch/<name>-pre` | Upstream spec/sources as-is |
58-
| **Compare** | `prep-sources --force -o base/build/work/scratch/<name>-post` + `diff -r ...-pre ...-post` | Current overlay effect |
57+
| **Investigate** | Read `specs/<first-char>/<name>/<name>.spec` or `prep-sources --skip-overlays --force -o base/build/work/scratch/<name>-pre` | Upstream spec/sources as-is |
58+
| **Compare** | `prep-sources --force -o base/build/work/scratch/<name>-post` + `diff -r ...-pre ...-post` | Current overlay effect (deep debug) |
5959
| **Modify** | Edit `*.comp.toml` (overlays, defines, without) ||
60-
| **Verify** | `prep-sources --force -o base/build/work/scratch/<name>-post` | Overlay applies cleanly |
60+
| **Verify** | `comp render -p <name>` + inspect `specs/<first-char>/<name>/` | Overlay applies cleanly (fast path) |
6161
| **Build** | `comp build -p <name>` | RPMs appear in `base/out/` |
6262
| **Test** | `adv mock shell --add-package base/out/<name>*.rpm` | Package installs, binary runs, basic functionality works |
6363
| **Inspect** | `comp build --preserve-buildenv always` + `adv mock shell` | BUILDROOT contents, file lists |
6464

65+
> **Prefer `comp render` for quick verification.** It's faster than `prep-sources` since it skips downloading source tarballs. Use `prep-sources` when you need the full source tree or want to diff pre/post overlay output for debugging.
66+
6567
> Use a temp dir for `prep-sources` output. Use `--force` to overwrite an existing output dir.
6668
6769
> Package builds are often very long, so adjust command timeouts accordingly when using shell tools to run builds, or use background mode if available.
6870
6971
## Debugging Build Failures
7072

71-
### 1. Diff sources pre/post overlay
73+
### 1. Render and inspect the spec
74+
75+
The fastest way to verify overlays applied correctly:
76+
77+
```bash
78+
azldev comp render -p <name>
79+
# Inspect the result
80+
cat specs/<first-char>/<name>/<name>.spec
81+
```
82+
83+
### 2. Diff sources pre/post overlay (deep debug)
84+
85+
When you need to understand exactly what upstream provides vs. what overlays change:
7286

7387
```bash
7488
azldev comp prep-sources -p <name> --skip-overlays --force -o base/build/work/scratch/<name>-pre -q
@@ -78,14 +92,14 @@ diff -r base/build/work/scratch/<name>-pre base/build/work/scratch/<name>-post
7892

7993
This reveals whether overlays apply as intended or whether upstream changed.
8094

81-
### 2. Preserve build environment on failure
95+
### 3. Preserve build environment on failure
8296

8397
```bash
8498
azldev comp build -p <name> --preserve-buildenv on-failure -q
8599
# Use `always` to inspect even successful builds
86100
```
87101

88-
### 3. Enter mock shell (deep debug)
102+
### 4. Enter mock shell (deep debug)
89103

90104
For testing built RPMs or inspecting the chroot, see the [`skill-mock`](../skill-mock/SKILL.md) skill. Quick reference:
91105

.github/skills/skill-fix-overlay/SKILL.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,21 @@ description: "[Skill] Diagnose and fix overlay issues in Azure Linux components.
77

88
## Diagnosis Workflow
99

10-
### 1. Reproduce and inspect
10+
### 1. Render and inspect
11+
12+
The fastest way to check if overlays apply cleanly:
13+
14+
```bash
15+
azldev comp render -p <name>
16+
# Inspect the result
17+
cat specs/<first-char>/<name>/<name>.spec
18+
```
19+
20+
If `render` fails, the error message will identify which overlay failed and why.
21+
22+
### 2. Diff pre/post overlay (deep debug)
23+
24+
When you need to understand exactly what upstream provides vs. what overlays change:
1125

1226
> Use a temp dir for `prep-sources` output. Use `--force` to overwrite an existing output dir.
1327
@@ -19,9 +33,7 @@ azldev comp prep-sources -p <name> --force -o base/build/work/scratch/<name>-pos
1933
diff -r base/build/work/scratch/<name>-pre base/build/work/scratch/<name>-post
2034
```
2135

22-
If `prep-sources` fails, the error message will identify which overlay failed and why.
23-
24-
### 2. Inspect the upstream spec/sources
36+
### 3. Inspect the upstream spec/sources
2537

2638
Look at the pre-overlay output dir — this is what the overlay is trying to modify. Common root cause: upstream changed and the overlay's assumptions no longer hold.
2739

@@ -61,5 +73,5 @@ For overlay type reference (all 12 types with key fields), see [`comp-toml.instr
6173
- **Test incrementally.** Apply one overlay at a time and verify with `prep-sources`. Debugging 10 overlays at once is painful.
6274
- **Minimize overlays.** Each is a potential failure point. Prefer the smallest delta from upstream.
6375
- **Verify in chroot.** If overlays apply but the build still fails, use [`skill-mock`](../skill-mock/SKILL.md) to inspect the build environment.
64-
- **Follow the inner loop.** The full cycle is: investigate → modify → verify → build → test → inspect. See [`skill-build-component`](../skill-build-component/SKILL.md) for details.
76+
- **Follow the inner loop.** The full cycle is: investigate → modify → render → build → test → inspect. See [`skill-build-component`](../skill-build-component/SKILL.md) for details.
6577
- **Smoke-test after fixing overlays.** A clean apply and successful build don't guarantee working RPMs. See [`skill-mock`](../skill-mock/SKILL.md).

AGENTS.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ For project context and architecture, see [`.github/copilot-instructions.md`](.g
99
### Examples of changes that should trigger a final test prior to sign-off (not an exhaustive list)
1010

1111
- Version bumps or pinning a new upstream version
12-
- Adding, modifying, or removing overlays (trivial edits may only require `prep-sources` verification, but when in doubt, do a full build + smoke-test)
12+
- Adding, modifying, or removing overlays (trivial edits may only require `render` verification, but when in doubt, do a full build + smoke-test)
1313
- Changing build config (`build.defines`, `build.with`, `build.without`)
1414
- Modifying local spec files or source files (again, trivial edits may not require a full rebuild, but when in doubt, test)
1515
- Adding a new component (first build)
@@ -33,9 +33,11 @@ Do NOT skip testing for changes that affect RPM output. Do NOT tell the user "th
3333

3434
- Always run `azldev comp list -p <name> -q -O json` before modifying a component.
3535
- Prefer overlays over forking/local specs when customizing upstream packages.
36-
- Use `azldev comp prep-sources -p <name> --force -o <dir> -q` to verify overlays apply cleanly before building. Always use `--force` to overwrite an existing output dir, `rm -rf` requires user confirmation which is disruptive.
37-
- Follow the inner loop cycle: investigate → modify → verify → build → test → inspect. See [`skill-build-component`](.github/skills/skill-build-component/SKILL.md).
38-
- Note: Use your best judgement, some packages are VERY slow to build (e.g., `kernel`), in those cases you may want to do multiple iterations of investigate → modify → verify with `prep-sources` before doing a full build + test.
36+
- After modifying overlays or component config, re-render with `azldev comp render -p <name>` and inspect `specs/<first-char>/<name>/` to verify the result. This is the fastest verification path.
37+
- Note: Changing a global snapshot time may affect all components that depend on it, potentially causing widespread rebuilds. Full re-render is time-consuming, but may be done by `azldev comp render -a --clean-stale`.
38+
- Use `prep-sources` for deeper debugging: `azldev comp prep-sources -p <name> --skip-overlays --force -o <pre-dir> -q` and `azldev comp prep-sources -p <name> --force -o <post-dir> -q` to diff pre/post overlay output when you need to understand what upstream provides vs. what overlays change. Always use `--force` to overwrite an existing output dir, `rm -rf` requires user confirmation which is disruptive.
39+
- Follow the inner loop cycle: investigate → modify → render → build → test → inspect. See [`skill-build-component`](.github/skills/skill-build-component/SKILL.md).
40+
- Note: Use your best judgement, some packages are VERY slow to build (e.g., `kernel`), in those cases you may want to do multiple iterations of investigate → modify → verify with `render` before doing a full build + test.
3941
- `prep-sources -o <dir>` output is ad-hoc (user-chosen dir). `comp build` output goes to project-configured dirs (`base/out/`, `base/build/`). Don't conflate them.
4042
- For temporary files, ensure they are all placed inside the project's defined work directory (`azldev config dump -q -f json 2>&1 | grep 'workDir'`). Example commands use `base/build/work/scratch/`, and all temp directories should be inside it unless there's a specific reason not to be.
4143

0 commit comments

Comments
 (0)