Skip to content

Commit 03b2733

Browse files
authored
Add test suite for tekton-kueue CEL expressions (#7561)
- Add hack/test-tekton-kueue-config.py with parameterized unittest - Test all CEL mutation scenarios: multi-platform, priority assignment, queue config - Dynamically read image from kustomization and config from development env - Add GitHub action to run tests on kueue-related PRs Validates tekton-kueue mutations against expected annotations, labels, and priority classes using actual container via podman. Also, update the tekton-kueue config on dev to match staging. Assisted-By: Cursor Signed-off-by: Gal Ben Haim <[email protected]>
1 parent 04b8b5d commit 03b2733

File tree

3 files changed

+544
-2
lines changed

3 files changed

+544
-2
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Test Tekton-Kueue Configuration
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
paths:
7+
- 'components/kueue/**'
8+
- 'hack/test-tekton-kueue-config.py'
9+
- '.github/workflows/test-tekton-kueue-config.yaml'
10+
11+
jobs:
12+
test-tekton-kueue-config:
13+
name: Test Tekton-Kueue CEL expressions
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python 3
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.x'
23+
24+
- name: Install Python dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install PyYAML
28+
29+
- name: Install Podman
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y podman
33+
34+
- name: Check prerequisites
35+
run: |
36+
python hack/test-tekton-kueue-config.py --check-setup
37+
38+
- name: Run Tekton-Kueue configuration tests
39+
run: |
40+
python hack/test-tekton-kueue-config.py --verbose
41+
42+
- name: Report success
43+
if: success()
44+
run: |
45+
echo "✅ All Tekton-Kueue CEL expression tests passed successfully"

components/kueue/development/tekton-kueue/config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cel:
1010
p.name == 'build-platforms')[0]
1111
.value.map(
1212
p,
13-
annotation("kueue.konflux-ci.dev/requests-" + replace(p, "/", "-"), "1")
13+
annotation("kueue.konflux-ci.dev/requests-" + replace(replace(p, "/", "-"), "_", "-"), "1")
1414
) : []
1515
1616
# Set resource requests for multi platform pipelines which doesn't use the build-platforms parameter (old style)
@@ -24,7 +24,7 @@ cel:
2424
.filter(p, p.size() > 0)
2525
.map(
2626
p,
27-
annotation("kueue.konflux-ci.dev/requests-" + replace(p[0].value, "/", "-"), "1")
27+
annotation("kueue.konflux-ci.dev/requests-" + replace(replace(p[0].value, "/", "-"), "_", "-"), "1")
2828
) : []
2929
3030
# Set the pipeline priority

0 commit comments

Comments
 (0)