Skip to content

Commit 32fe3c0

Browse files
feat: Add CEL-based conditional function execution (#4388)
1 parent 77c718c commit 32fe3c0

13 files changed

+1497
-1
lines changed

.agent/QUICK_PR_COMMANDS.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Quick PR Creation Guide
2+
3+
## Run these commands in order:
4+
5+
# 1. Create branch
6+
git checkout -b feat/cel-conditional-execution
7+
8+
# 2. Add all changes
9+
git add .
10+
11+
# 3. Commit with descriptive message
12+
git commit -m "feat: Add CEL-based conditional function execution
13+
14+
Implements #4388
15+
16+
- Add 'condition' field to Function schema for CEL expressions
17+
- Integrate google/cel-go library for condition evaluation
18+
- Skip function execution when condition evaluates to false
19+
- Add comprehensive unit and E2E tests
20+
21+
Functions can now be conditionally executed based on package contents:
22+
23+
pipeline:
24+
mutators:
25+
- image: set-namespace:v0.4
26+
condition: \"resources.exists(r, r.kind == 'ConfigMap')\"
27+
"
28+
29+
# 4. Push to your fork
30+
git push origin feat/cel-conditional-execution
31+
32+
# 5. Go to GitHub and create PR!
33+
# https://github.com/kptdev/kpt/compare/main...YOUR_USERNAME:feat/cel-conditional-execution

.agent/github_comment_4382.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Comment to Post on Issue #4382
2+
3+
Post this on: https://github.com/kptdev/kpt/issues/4382
4+
5+
---
6+
7+
Hi @liamfallon! I'd like to work on this issue.
8+
9+
I've reviewed PR #4355 (the code transfer) and explored both the `kpt` and Porch repositories. Before I start moving documentation, I need clarification on which specific documentation should be transferred from Porch to kpt:
10+
11+
**Questions:**
12+
13+
1. **Which documentation files/sections** should be moved? The current Porch docs at https://docs.porch.nephio.org/ seem to be Porch-specific (e.g., API server, repositories, packages). Are there specific sections that are actually kpt-related?
14+
15+
2. **What should I look for?** Should I focus on:
16+
- API documentation that was updated in Porch?
17+
- User guides that apply to kpt functionality?
18+
- Function documentation?
19+
- Something else?
20+
21+
3. **Where is the source?** Should I look at:
22+
- The Porch documentation source in `nephio-project/porch/docs/`?
23+
- Or another location?
24+
25+
I'm ready to help, but I want to make sure I'm moving the right content! Could you point me to the specific files or sections I should focus on?
26+
27+
Thanks!

.agent/github_comment_4388.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Hey! I'd like to take this one if it's still available.
2+
3+
I've been looking through the issue and the codebase, and this seems like a really useful feature. The workaround of writing a custom function just to check a condition is definitely awkward when you just want to do something simple like set-annotation.
4+
5+
Here's what I'm thinking for the implementation:
6+
7+
**Approach:**
8+
- Add a `condition` field to the Function struct in the pipeline schema
9+
- Use the CEL library (google/cel-go) for evaluating expressions
10+
- The runner will check the condition before executing each function
11+
- If condition evaluates to false, skip the function (just pass through the input unchanged)
12+
13+
**Example of what it would look like:**
14+
```yaml
15+
pipeline:
16+
mutators:
17+
- image: gcr.io/kpt-fn/set-namespace:v0.4
18+
condition: "resources.exists(r, r.kind == 'ConfigMap' && r.metadata.name == 'env-config')"
19+
configMap:
20+
namespace: production
21+
```
22+
23+
I'll start with the schema changes and get CEL integrated into the runner. Should have something working soon.
24+
25+
Let me know if there are any specific considerations I should keep in mind!

.agent/issue_4382_action_plan.md

Lines changed: 257 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
# Action Plan: Issue #4382 - Move kpt docs from Porch to kpt
2+
3+
**🔗 Link**: https://github.com/kptdev/kpt/issues/4382
4+
**👤 Created by**: @liamfallon (Core Maintainer)
5+
**📅 Created**: Feb 10, 2026
6+
**🏷️ Labels**: `documentation`, `good first issue`, `cleanup`
7+
**⏱️ Estimated Time**: 4-8 hours
8+
9+
---
10+
11+
## 📋 **What This Issue Is About**
12+
13+
**Background**:
14+
- Porch (Package Orchestration service) was originally part of kpt
15+
- Porch was donated to the Nephio project (now at `nephio-project/porch`)
16+
- During the split, kpt code was duplicated in Porch
17+
- Porch team rewrote documentation for their cloned kpt code
18+
- Now that code is being ported BACK to kpt (#4355 completed this)
19+
- **We need to also move the NEW kpt-related documentation from Porch back to kpt**
20+
21+
**Your Task**:
22+
Move the improved kpt-related documentation from `nephio-project/porch` repository to `kptdev/kpt` repository
23+
24+
---
25+
26+
## 🎯 **Step-by-Step Plan**
27+
28+
### **Phase 1: Research & Understand** (1-2 hours)
29+
30+
#### Step 1: Comment on the Issue to Claim It
31+
```markdown
32+
Hi @liamfallon! I'd like to work on this issue.
33+
34+
Before I start, could you clarify:
35+
1. Which specific documentation files/sections from Porch should be moved to kpt?
36+
2. Should I look in the Nephio porch repo (nephio-project/porch) or is there another location?
37+
3. Are there any specific paths or folders I should focus on?
38+
39+
I'm ready to help move the kpt-related docs over!
40+
```
41+
42+
**Why**: Get clarification from the maintainer before starting work
43+
44+
#### Step 2: Explore the Porch Repository
45+
- **Repo**: https://github.com/nephio-project/porch
46+
- **Look for**: Documentation related to kpt (not Porch-specific features)
47+
- **Check directories**:
48+
- `/docs/`
49+
- `/documentation/`
50+
- `/README.md`
51+
- Any `/api/` or `/guides/` folders
52+
53+
#### Step 3: Explore the kpt Repository Documentation
54+
- **Current docs location**: `c:\Users\Surbhi\Catroid\kpt\documentation\`
55+
- **Understand structure**:
56+
- How docs are organized
57+
- Naming conventions
58+
- Link patterns
59+
60+
#### Step 4: Identify What to Move
61+
Create a list of:
62+
- Documentation files about kpt features (not Porch-specific)
63+
- Updated API docs
64+
- Improved guides/tutorials
65+
- Any new examples
66+
67+
---
68+
69+
### **Phase 2: Move Documentation** (2-4 hours)
70+
71+
#### Step 5: Create a New Branch
72+
```bash
73+
cd c:\Users\Surbhi\Catroid\kpt
74+
git checkout main
75+
git pull origin main
76+
git checkout -b docs/move-from-porch
77+
```
78+
79+
#### Step 6: Copy Documentation Files
80+
For each identified file:
81+
1. Download from Porch repo
82+
2. Place in appropriate location in kpt repo
83+
3. Update frontmatter/metadata if needed
84+
4. Update internal links to match kpt structure
85+
86+
#### Step 7: Update Links and References
87+
- Fix any internal documentation links
88+
- Update references to reflect kpt (not Porch)
89+
- Ensure images/assets are included
90+
- Check for broken links
91+
92+
#### Step 8: Test the Documentation Locally
93+
```bash
94+
# Navigate to documentation directory
95+
cd documentation
96+
97+
# Install dependencies (if haven't already)
98+
npm install
99+
100+
# Run local docs server
101+
npm run start
102+
```
103+
104+
**Verify**:
105+
- All pages load correctly
106+
- Links work
107+
- Images/assets display
108+
- No broken references
109+
110+
---
111+
112+
### **Phase 3: Clean Up & Submit** (1-2 hours)
113+
114+
#### Step 9: Write Clear Commit Messages
115+
```bash
116+
git add .
117+
git commit -m "docs: move kpt-related documentation from Porch
118+
119+
Moved the following kpt-related documentation from nephio-project/porch:
120+
- [List specific files/sections]
121+
122+
This documentation was rewritten in Porch and is now being moved
123+
back to kpt following the code port in #4355.
124+
125+
Fixes #4382
126+
```
127+
128+
#### Step 10: Create Pull Request
129+
```bash
130+
git push origin docs/move-from-porch
131+
```
132+
133+
**PR Title**: `docs: Move kpt-related documentation from Porch`
134+
135+
**PR Description Template**:
136+
```markdown
137+
## Description
138+
139+
This PR moves kpt-related documentation from the Porch repository
140+
(nephio-project/porch) back to kpt, following the code port completed in #4355.
141+
142+
## Changes
143+
144+
### Documentation Moved:
145+
- [ ] [File 1] - Brief description
146+
- [ ] [File 2] - Brief description
147+
- [ ] [etc.]
148+
149+
### Updates Made:
150+
- [ ] Fixed internal links to match kpt structure
151+
- [ ] Updated references from Porch to kpt
152+
- [ ] Verified all images/assets are included
153+
- [ ] Tested documentation builds locally
154+
155+
## Testing
156+
157+
- [x] Documentation builds without errors
158+
- [x] All links work correctly
159+
- [x] Images/assets display properly
160+
- [x] Verified on local dev server
161+
162+
## Related Issues
163+
164+
Fixes #4382
165+
Part of #4378
166+
167+
## Screenshots (if applicable)
168+
169+
[Add screenshots of doc pages if helpful]
170+
171+
## Checklist
172+
173+
- [ ] Documentation builds successfully
174+
- [ ] All links verified
175+
- [ ] No broken images
176+
- [ ] Commit messages follow conventions
177+
- [ ] PR description is clear
178+
```
179+
180+
#### Step 11: Address Review Feedback
181+
- Respond promptly to maintainer comments
182+
- Make requested changes
183+
- Re-test after updates
184+
185+
---
186+
187+
## 📚 **Resources You'll Need**
188+
189+
### Repositories:
190+
- **Porch (Nephio)**: https://github.com/nephio-project/porch
191+
- **kpt**: https://github.com/kptdev/kpt (you already have this)
192+
193+
### Related Issues:
194+
- **#4378** (EPIC): https://github.com/kptdev/kpt/issues/4378
195+
- **#4355** (Code port PR): https://github.com/kptdev/kpt/pull/4355
196+
197+
### kpt Documentation:
198+
- **Live site**: https://kpt.dev
199+
- **Local path**: `c:\Users\Surbhi\Catroid\kpt\documentation\`
200+
201+
---
202+
203+
## ⚠️ **Potential Challenges**
204+
205+
1. **Unclear which docs to move**
206+
- **Solution**: Ask maintainer for specific guidance in issue comment
207+
208+
2. **Documentation structure differences**
209+
- **Solution**: Study kpt docs structure first, adapt Porch docs to match
210+
211+
3. **Broken links after moving**
212+
- **Solution**: Use VSCode search to find/replace link patterns
213+
214+
4. **Build errors**
215+
- **Solution**: Test locally before submitting PR
216+
217+
---
218+
219+
## ✅ **Success Criteria**
220+
221+
- [ ] Identified all kpt-related docs from Porch
222+
- [ ] Moved docs to appropriate locations in kpt
223+
- [ ] All links work correctly
224+
- [ ] Documentation builds without errors
225+
- [ ] Images/assets included and working
226+
- [ ] Clear commit messages
227+
- [ ] PR approved and merged
228+
229+
---
230+
231+
## 🚀 **Ready to Start!**
232+
233+
### First Action: Post Comment on Issue
234+
235+
Copy this comment and post it on https://github.com/kptdev/kpt/issues/4382:
236+
237+
```
238+
Hi @liamfallon! I'd like to work on this issue.
239+
240+
Before I start, could you clarify:
241+
1. Which specific documentation files/sections from Porch should be moved to kpt?
242+
2. Should I look in the Nephio porch repo (nephio-project/porch) or is there another location?
243+
3. Are there any specific paths or folders I should focus on?
244+
245+
I'm ready to help move the kpt-related docs over! I'll start by exploring both repositories to identify candidates, but your guidance would help ensure I'm moving the right content.
246+
247+
Thanks!
248+
```
249+
250+
---
251+
252+
**After posting the comment, while waiting for response**:
253+
1. Explore https://github.com/nephio-project/porch/tree/main/docs
254+
2. Compare with `c:\Users\Surbhi\Catroid\kpt\documentation\`
255+
3. Create a draft list of candidate files to move
256+
257+
**Next Steps Document**: Once you get clarity, we'll create a detailed file-by-file migration plan!

0 commit comments

Comments
 (0)