Skip to content

Commit 6b5370b

Browse files
committed
Add agent-executable docs for Konflux setup
Signed-off-by: Daniel Farrell <[email protected]>
1 parent 3f90f69 commit 6b5370b

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#### Setting up Lighthouse Builds in Konflux on New Branch
2+
3+
**Prerequisites:**
4+
5+
- Configuration added in konflux-ci/build-definitions repo
6+
- Existing Konflux-configured branch to copy files from (e.g., `release-0.21`)
7+
8+
**Placeholders:**
9+
10+
- `<target-branch>`: Your target branch (e.g., `release-0.22`)
11+
- `<X-Y>`: Version with dashes (e.g., `0-22`)
12+
- `<component>`: Component name (agent or coredns)
13+
14+
**Important:** Lighthouse uses gomod-only prefetch (NO RPM dependencies). Gomod paths differ per component (see Step 3).
15+
16+
**Repeat steps 1-6 for each component (agent, coredns):**
17+
18+
##### 1. Checkout Bot's PR Branch
19+
20+
Bot creates PRs on branches named `konflux-lighthouse-<component>-<X-Y>`.
21+
22+
```bash
23+
git checkout konflux-lighthouse-<component>-<X-Y>
24+
```
25+
26+
##### 2. Copy Tekton Configuration from Previous Release
27+
28+
```bash
29+
TARGET_VERSION=$(echo "<target-branch>" | grep -oP '(?<=release-0\.)\d+$')
30+
[ -z "$TARGET_VERSION" ] && { echo "ERROR: Invalid branch format"; exit 1; }
31+
PREV_VERSION=$((TARGET_VERSION - 1))
32+
33+
git checkout origin/release-0.${PREV_VERSION} -- \
34+
.tekton/lighthouse-<component>-0-${PREV_VERSION}-pull-request.yaml \
35+
.tekton/lighthouse-<component>-0-${PREV_VERSION}-push.yaml
36+
37+
mv .tekton/lighthouse-<component>-0-${PREV_VERSION}-pull-request.yaml \
38+
.tekton/lighthouse-<component>-0-${TARGET_VERSION}-pull-request.yaml
39+
mv .tekton/lighthouse-<component>-0-${PREV_VERSION}-push.yaml \
40+
.tekton/lighthouse-<component>-0-${TARGET_VERSION}-push.yaml
41+
42+
sed -i "s/0-${PREV_VERSION}/0-${TARGET_VERSION}/g" .tekton/lighthouse-<component>-0-${TARGET_VERSION}-*.yaml
43+
sed -i "s/release-0\.${PREV_VERSION}/release-0.${TARGET_VERSION}/g" .tekton/lighthouse-<component>-0-${TARGET_VERSION}-*.yaml
44+
```
45+
46+
**Note:** Template approach avoids sed parameter insertion which creates malformed YAML.
47+
48+
##### 3. Update Gomod Prefetch Paths
49+
50+
**For lighthouse-agent:**
51+
52+
```bash
53+
sed -i 's|\[{"type": "gomod", "path": "."}, {"type": "gomod", "path": "coredns"}, {"type": "gomod", "path": "tools"}]|[{"type": "gomod", "path": "."}, {"type": "gomod", "path": "tools"}]|' .tekton/lighthouse-agent-0-${TARGET_VERSION}-*.yaml
54+
```
55+
56+
**For lighthouse-coredns:**
57+
58+
```bash
59+
sed -i 's|\[{"type": "gomod", "path": "."}, {"type": "gomod", "path": "coredns"}, {"type": "gomod", "path": "tools"}]|[{"type": "gomod", "path": "./coredns"}]|' .tekton/lighthouse-coredns-0-${TARGET_VERSION}-*.yaml
60+
```
61+
62+
**Note:** Agent uses root+tools modules, coredns uses only coredns module.
63+
64+
##### 4. Add Konflux Dockerfile
65+
66+
```bash
67+
git checkout origin/release-0.${PREV_VERSION} -- package/Dockerfile.lighthouse-<component>.konflux
68+
sed -i "s/release-0.${PREV_VERSION}/release-0.${TARGET_VERSION}/g" package/Dockerfile.lighthouse-<component>.konflux
69+
```
70+
71+
**Note:** Lighthouse Dockerfiles have no CPE labels (only BASE_BRANCH update needed).
72+
73+
##### 5. Commit Changes
74+
75+
```bash
76+
git add .tekton/lighthouse-<component>-0-${TARGET_VERSION}-*.yaml package/Dockerfile.lighthouse-<component>.konflux
77+
git commit -s -m "Add Konflux config for lighthouse-<component>"
78+
```
79+
80+
##### 6. Review and Push
81+
82+
```bash
83+
git log origin/<target-branch>..HEAD
84+
git status
85+
git push origin konflux-lighthouse-<component>-<X-Y> --force-with-lease
86+
```
87+
88+
Expected: 1 commit (bot's initial + your configuration), clean working tree.
89+
90+
##### 7. Verify All Component PRs
91+
92+
After completing both components:
93+
94+
```bash
95+
for component in agent coredns; do
96+
gh pr list --head konflux-lighthouse-$component-<X-Y>
97+
done
98+
```
99+
100+
Expected: 2 PRs (one per component).
101+
102+
**Troubleshooting:**
103+
104+
- **Validation error "impossible ParamValues.Type"**: Sed pattern mismatch. Verify release-0.21 prefetch format matches expected pattern.
105+
- **Commit message too long**: Use exactly "Add Konflux config for lighthouse-<component>" (40-43 chars).
106+
- **RPM lockfiles**: Lighthouse has NO RPM dependencies. Do not create `.rpm-lockfiles` directory.

0 commit comments

Comments
 (0)