Skip to content

Commit 1fcfdd0

Browse files
committed
docs: rework build section to xray MR 19 layout
1 parent 97d1c6e commit 1fcfdd0

1 file changed

Lines changed: 33 additions & 68 deletions

File tree

CLAUDE.md

Lines changed: 33 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -52,85 +52,50 @@ update the spec in the same commit.
5252
socket support), prefer deleting the fork-local copy and documenting
5353
the change.
5454

55-
## Creating a Build
55+
## AI Workspace Required
5656

57-
This project ships as an RPM package (Build System name: `node_exporter`). Builds are submitted to the CloudLinux Build System via its CLI.
57+
Both the local-test and Build System workflows below assume you are inside an [AI Workspace](https://gitlab.corp.cloudlinux.com/clos/ci-tools/cl-aiworkspaces) VM at `/root/ai-workspace/`. They depend on:
5858

59-
### Step 1 — Generate the build plan
59+
- the workspace's CloudLinux OS toolchain and any project-specific runtime (Python venv, Node, Docker, …) — needed by the local-build and unit-test targets;
60+
- the workspace's `mcp-cli-wrapper.sh` and provisioned Build System / Jenkins tokens — needed by the BS payload helper.
6061

61-
```bash
62-
cd /root/ai-workspace/node_exporter
63-
git checkout <branch-or-tag> # branch, tag, or detached HEAD
64-
uv run /root/ai-workspace/cl-aiworkspaces/workspace-side/scripts/build-plan.py
65-
```
62+
Outside an AI Workspace these commands will not work as documented. Spin up a workspace via `cl-aiworkspaces` first.
6663

67-
The script reads `cl-aiworkspaces/.agents/skills/build-create/projects-catalog.yaml` to map this workspace directory to its Build System name(s) and emits a JSON plan on stdout (warnings/errors on stderr; exit 1 on fatal errors such as uncommitted changes).
64+
## Local Tests
6865

69-
The plan contains:
70-
- `build_type_id` — build-type for the payload
71-
- `build_platforms` — target platforms (e.g. CL7, CL8, CL9)
72-
- `build_flavors` — flavor IDs
73-
- `projects` — project names, build refs, testing config
74-
- `jenkins_jobs` — Jenkins job IDs and definitions
66+
Run from the repo root (`/root/ai-workspace/node_exporter/`):
7567

76-
### Step 2 — Filter the plan to this project only
68+
| Command | What it does |
69+
| --- | --- |
70+
| `make build` | Build the `node_exporter` binary |
71+
| `make test` | Run the upstream Go unit-test suite |
72+
| `make test-e2e` | Run the e2e harness (downloads collector fixtures on first run) |
73+
| `make checkmetrics && make checkrules` | Validate metric and rule schemas |
7774

78-
The plan may include unrelated workspace projects. **Strip all entries from `projects` except `node_exporter`**, and keep only the Jenkins jobs relevant to it. One project per build — do not submit a multi-project payload.
75+
## Build System
7976

80-
### Step 3 — Submit the build
77+
This repo ships as an RPM/DEB package: `node_exporter`. **Use the `/build-create` skill to submit builds** — it runs `build-plan.py` and submits the payload via the Build System CLI. The tables below are the project-specific overrides on top of that generic flow.
8178

82-
```bash
83-
/root/ai-workspace/cl-aiworkspaces/workspace-side/mcps/mcp-cli-wrapper.sh build-system \
84-
create-build --raw '<filtered-plan-json>'
85-
```
79+
### Parameters
8680

87-
Minimum payload shape:
81+
Most fields come from `build-plan.py`; the table records what should end up in the final payload for a `node_exporter`-only build.
8882

89-
```json
90-
{
91-
"build_type_id": "<from plan>",
92-
"build_platforms": [<from plan>],
93-
"build_flavors": ["<flavor_id>"],
94-
"target_channel": "beta",
95-
"projects": [
96-
{
97-
"name": "node_exporter",
98-
"build_ref": { "name": "<branch-or-tag>", "type": "git_branch" },
99-
"testing": { "qa_ref": "<branch-or-tag>" }
100-
}
101-
],
102-
"jenkins_jobs": [<from plan — only jobs relevant to this project>]
103-
}
104-
```
83+
| Field | Value |
84+
| --- | --- |
85+
| BS project name | `node_exporter` |
86+
| `build_type_id` | `5ac2787bdf7e526d4a5f0259` (CloudLinux OS packages) |
87+
| `build_platforms` | `CL7`, `CL8`, `CL9`, `CL10`, `ubuntu22_04_ext_cpanel` |
88+
| `build_flavors` | `alt-php-els` (id `68b1ad89aa0264b2618434c8`) |
89+
| `target_channel` | `beta` |
90+
| `build_ref.name` | **Branch (or tag) to build.** `build-plan.py` reads this from the current `git` checkout in the workspace — confirm you are on the intended branch (your feature branch, not `master`) before generating the plan. |
91+
| `build_ref.type` | `git_branch` or `git_tag`. |
92+
| `testing.qa_ref` (per project) and top-level `qa_ref` | **Branch checked out in the QA repo for Jenkins jobs.** `build-plan.py` defaults both to `"master"` regardless of `build_ref.name` — override to your feature branch if the QA side has matching changes. |
10593

106-
`build_ref.type` options: `git_branch`, `git_tag`, or `gerrit_change` (for `refs/changes/XX/NNNNN/PS` refs — the `qa_ref` should then be `NNNNN/PS`).
94+
### Jenkins jobs (node_exporter-relevant)
10795

108-
The CLI returns a build ID. Build URL: `https://build.cloudlinux.com/#/build/<build_id>`.
96+
`build-plan.py` emits the workspace-wide plan covering every project in the workspace. For a `node_exporter`-only build, filter `projects[]` down to `node_exporter` and keep **only** these jobs in `jenkins_jobs[]`:
10997

110-
### Step 4 — Monitor
111-
112-
```bash
113-
/root/ai-workspace/cl-aiworkspaces/workspace-side/mcps/mcp-cli-wrapper.sh build-system \
114-
get-build --build-id <build_id>
115-
```
116-
117-
### Step 5 — Debug failures
118-
119-
Search logs for errors:
120-
121-
```bash
122-
/root/ai-workspace/cl-aiworkspaces/workspace-side/mcps/mcp-cli-wrapper.sh build-system \
123-
search-build-logs --build-id <build_id> --query "error"
124-
```
125-
126-
Common failure patterns:
127-
128-
| Symptom | Likely cause | Fix |
129-
|---|---|---|
130-
| `FAILED` in test output | Test regression | Update the test — do not revert the code fix |
131-
| `ModuleNotFoundError` / `ImportError` | New dependency not declared | Add to the `.spec` `Requires`/`BuildRequires` (or equivalent) |
132-
| `SyntaxError` in build log | Source typo | Fix the source |
133-
| `%files`/`%install` mismatch | Spec file vs installed layout drift | Update the spec stanzas |
134-
| Dependency-resolution errors | `Requires` constraint wrong | Check spec file version constraints |
135-
136-
After fixing, push to the same branch and re-run steps 1–3.
98+
| Job name | Build System `_id` |
99+
| --- | --- |
100+
| `CMT-end-server-tools` | `635b962c2afd3e1feec603bd` |
101+
| `clpro-ubuntu-tests` | `677e40a2f1b69faa0d69baf6` |

0 commit comments

Comments
 (0)