Skip to content

Commit 6d00e01

Browse files
committed
feat: adjust EventListener to integrate with new MLOps pipeline
Update EventListener configuration and parameters to align with the refactored MLOps pipeline that uses DVC version parameters
1 parent 6dd304f commit 6d00e01

File tree

10 files changed

+780
-269
lines changed

10 files changed

+780
-269
lines changed

deploy/Makefile

Lines changed: 185 additions & 92 deletions
Large diffs are not rendered by default.

deploy/README.md

Lines changed: 74 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -179,25 +179,94 @@ For VPN-protected clusters, use GitOps to automatically sync Tekton resources fr
179179
- Repository access from within the cluster
180180

181181
#### 8.2. Deploy GitOps
182+
183+
**Development Environment:**
184+
```bash
185+
# Deploy ArgoCD Application (dev)
186+
make deploy-dev
187+
```
188+
189+
**Production Environment:**
182190
```bash
183-
# Deploy ArgoCD Application
184-
make argocd-deploy
191+
# Deploy ArgoCD Application (prod) with specific version
192+
make deploy-prod IMAGE_VERSION=1.2.3
185193
```
186194

187195
#### 8.3. How It Works
188196
- **Auto-sync**: Changes to `main` branch deploy automatically (~3 min)
189-
- **Self-healing**: Manual changes are automatically reverted
197+
- **Self-healing**: Manual changes are automatically reverted (dev only)
190198
- **Pruning**: Deleted files are removed from cluster
191-
- **Path**: Only syncs `deploy/tekton/` directory
199+
- **Path**:
200+
- Dev: Syncs `deploy/tekton/base` (uses latest tag)
201+
- Prod: Syncs `deploy/tekton/overlays/prod` (uses release versions)
192202

193203
#### 8.4. Configuration
194204
Set in `.env` file (optional):
195205
```env
196206
GITHUB_REPO_URL=https://github.com/your-org/sast-ai-workflow.git
197207
ARGOCD_NAMESPACE=sast-ai
208+
209+
# Orchestrator Configuration (for hooks)
210+
ORCHESTRATOR_API_URL=http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080
211+
BATCH_PACKAGES_SHEET_URL=https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID
212+
BASE_GDRIVE_FOLDER_ID=your-parent-folder-id
213+
```
214+
215+
#### 8.5. ArgoCD Hooks - Automated Batch Triggering
216+
217+
**What are hooks?**
218+
219+
ArgoCD PostSync hooks automatically trigger batch SAST analysis via the sast-ai-orchestrator when a new release is deployed to production.
220+
221+
**How it works:**
222+
223+
1. New sast-ai-workflow version deployed via ArgoCD
224+
2. PostSync hook runs after successful sync
225+
3. Hook generates unique RUN_ID: `v1.2.3-20251021-143055-a3f2b9`
226+
4. Calls orchestrator batch API with package list
227+
5. Orchestrator creates Tekton PipelineRuns for each package
228+
6. All reports organized under the same RUN_ID
229+
230+
**Configuration:**
231+
232+
```bash
233+
# Set in .env file
234+
ORCHESTRATOR_API_URL=http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080
235+
BATCH_PACKAGES_SHEET_URL=https://docs.google.com/spreadsheets/d/YOUR_SHEET_ID
236+
237+
# Deploy with hooks
238+
make deploy-prod IMAGE_VERSION=1.2.3
198239
```
199240

200-
#### 8.5. Prompt Changes with GitOps
241+
**Manual hook deployment:**
242+
243+
```bash
244+
make argocd-hooks
245+
```
246+
247+
**Disable hooks temporarily:**
248+
249+
```bash
250+
# Update ConfigMap
251+
oc edit configmap sast-ai-hook-config -n sast-ai
252+
# Change: enable-hook: "false"
253+
```
254+
255+
**Monitor hook execution:**
256+
257+
```bash
258+
# View hook jobs
259+
oc get jobs -l app.kubernetes.io/component=argocd-hook -n sast-ai
260+
261+
# View logs
262+
oc logs -l app.kubernetes.io/component=argocd-hook -n sast-ai --tail=100
263+
```
264+
265+
**Troubleshooting:**
266+
267+
See detailed troubleshooting guide in `argocd/hooks/README.md`
268+
269+
#### 8.6. Prompt Changes with GitOps
201270
When modifying prompts in `src/templates/prompts/`, you must regenerate the ConfigMap:
202271

203272
```bash

deploy/tekton/eventlistener/README.md

Lines changed: 38 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
# Tekton EventListener for MLOps Benchmarking
22

3-
This directory contains a Tekton EventListener implementation that triggers the sast-ai-orchestrator MLOps batch API via webhook. This enables automated MLOps performance testing and benchmarking with DVC data versioning and S3 integration.
3+
This directory contains a Tekton EventListener implementation that triggers the sast-ai-orchestrator MLOps batch API via webhook. This enables automated MLOps performance testing and benchmarking with DVC data versioning.
44

55
## 🎯 Purpose
66

77
Enable MLOps benchmark testing for batch SAST analysis jobs:
88
- ✅ Webhook-based triggering (curl/HTTP POST)
99
- ✅ Integration with sast-ai-orchestrator MLOps API (`/api/v1/mlops-batches`)
1010
- ✅ DVC data versioning support
11-
- ✅ S3 object storage integration
1211
- ✅ Container image version testing
1312
- ✅ Separation from production workflows
1413
- ✅ Fork-friendly configuration
@@ -90,8 +89,6 @@ make eventlistener \
9089
- ✅ Deploys all EventListener resources via Kustomize
9190
- ✅ Shows verification and testing commands
9291

93-
**Note:** The Google Sheet URL is provided via the webhook payload when triggering the EventListener, not during deployment.
94-
9592
**Note:** The EventListener always calls `/api/v1/mlops-batches` endpoint (hardcoded for MLOps benchmarking).
9693

9794
Verify deployment:
@@ -118,12 +115,11 @@ http://el-benchmark-mlop-listener.<namespace>.svc.cluster.local:8080
118115
curl -X POST http://localhost:8080 \
119116
-H 'Content-Type: application/json' \
120117
-d '{
121-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/YOUR_TEST_SHEET/edit",
122118
"submitted_by": "manual-test",
123-
"dvc_repo_url": "https://gitlab.com/your-org/dvc-repo.git",
124-
"dvc_data_version": "v1.0.0",
125-
"s3_endpoint_url": "https://s3.amazonaws.com",
126-
"s3_input_bucket_name": "mlops-test-data"
119+
"image_version": "v2.1.0",
120+
"dvc_nvr_version": "v1.0.0",
121+
"dvc_known_false_positives_version": "v1.0.0",
122+
"dvc_prompts_version": "v1.0.0"
127123
}'
128124
```
129125

@@ -132,13 +128,11 @@ curl -X POST http://localhost:8080 \
132128
curl -X POST http://localhost:8080 \
133129
-H 'Content-Type: application/json' \
134130
-d '{
135-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/YOUR_TEST_SHEET/edit",
136131
"submitted_by": "version-test",
137-
"dvc_repo_url": "https://gitlab.com/your-org/dvc-repo.git",
138-
"dvc_data_version": "v1.0.0",
139-
"s3_endpoint_url": "https://s3.amazonaws.com",
140-
"s3_input_bucket_name": "mlops-test-data",
141-
"image_version": "v2.1.0"
132+
"image_version": "v2.1.0",
133+
"dvc_nvr_version": "v1.0.0",
134+
"dvc_known_false_positives_version": "v1.0.0",
135+
"dvc_prompts_version": "v1.0.0"
142136
}'
143137
```
144138

@@ -182,9 +176,10 @@ Calling Orchestrator MLOps Batch API
182176
Configuration:
183177
Orchestrator URL: http://sast-ai-orchestrator...
184178
API Endpoint: /api/v1/mlops-batches (MLOps benchmarking)
185-
Batch Sheet URL: https://docs.google.com/...
186-
DVC Repo: https://gitlab.com/...
187-
S3 Bucket: mlops-test-data
179+
Image Version: v2.1.0
180+
DVC NVR Version: v1.0.0
181+
DVC Prompts Version: v1.0.0
182+
DVC Known False Positives Version: v1.0.0
188183
...
189184
✓ API call successful!
190185
Batch ID: batch-12345
@@ -220,7 +215,7 @@ oc logs -l tekton.dev/pipelineTask=call-orchestrator-api --tail=100
220215
- Orchestrator URL incorrect in ConfigMap
221216
- Orchestrator service not running: `oc get pods -l app=sast-ai-orchestrator`
222217
- Network policy blocking connections
223-
- Google Sheet URL not accessible by orchestrator
218+
- DVC version parameters not provided in webhook payload
224219

225220
#### Verify ConfigMap
226221

@@ -243,26 +238,22 @@ Send JSON payload with these fields:
243238

244239
```json
245240
{
246-
"batch_sheet_url": "https://docs.google.com/spreadsheets/d/SHEET_ID/edit",
247241
"submitted_by": "trigger-source",
248-
"dvc_repo_url": "https://gitlab.com/org/dvc-repo.git",
249-
"dvc_data_version": "v1.2.3",
250-
"s3_endpoint_url": "https://s3.amazonaws.com",
251-
"s3_input_bucket_name": "mlops-data",
242+
"dvc_nvr_version": "v1.2.3",
243+
"dvc_known_false_positives_version": "v1.2.3",
244+
"dvc_prompts_version": "v1.2.3",
252245
"image_version": "v2.0.0"
253246
}
254247
```
255248

256249
**Required Fields:**
257-
- `batch_sheet_url` - Google Sheet with package list
258-
- `dvc_repo_url` - DVC repository URL
259-
- `dvc_data_version` - DVC data version tag
260-
- `s3_endpoint_url` - S3 endpoint URL
261-
- `s3_input_bucket_name` - S3 bucket name
250+
- `dvc_nvr_version` - DVC NVR resource version
251+
- `dvc_prompts_version` - DVC prompts resource version
252+
- `dvc_known_false_positives_version` - DVC known false positives resource version
262253

263254
**Optional Fields:**
264255
- `submitted_by` - Defaults to "eventlistener-webhook"
265-
- `image_version` - Override workflow version for testing (e.g., "v2.1.0", "sha-abc123")
256+
- `image_version` - Defaults to "latest" (e.g., "v2.1.0", "sha-abc123")
266257

267258
### ConfigMap Keys
268259

@@ -281,13 +272,11 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
281272

282273
| Parameter | Type | Required | Default | Description |
283274
|-----------|------|----------|---------|-------------|
284-
| `batch-sheet-url` | string | Yes | - | Google Sheet with package list |
275+
| `dvc-nvr-version` | string | **Yes** | - | DVC NVR resource version |
276+
| `dvc-prompts-version` | string | **Yes** | - | DVC prompts resource version |
277+
| `dvc-known-false-positives-version` | string | **Yes** | - | DVC known false positives resource version |
285278
| `submitted-by` | string | No | `eventlistener-webhook` | Trigger source identifier |
286-
| `dvc-repo-url` | string | Yes | - | DVC repository URL for data versioning |
287-
| `dvc-data-version` | string | Yes | - | DVC data version tag |
288-
| `s3-endpoint-url` | string | Yes | - | S3 endpoint URL |
289-
| `s3-input-bucket-name` | string | Yes | - | S3 bucket name for input data |
290-
| `image-version` | string | No | (default from pipeline) | Workflow image version for testing (tag only, e.g., "v2.1.0") |
279+
| `image-version` | string | No | `latest` | Workflow image version for testing (tag only, e.g., "v2.1.0") |
291280

292281
## 🎓 Understanding the Architecture
293282

@@ -339,6 +328,7 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
339328
│ Orchestrator API │
340329
│ POST /api/v1/ │
341330
│ mlops-batches │
331+
│ (with DVC versions) │
342332
└──────────────────────┘
343333
```
344334

@@ -351,10 +341,21 @@ The `benchmark-config` ConfigMap is automatically generated by `make eventlisten
351341
2. **TriggerBinding**: Extracts parameters from webhook JSON payload (including MLOps params)
352342
3. **TriggerTemplate**: Generates PipelineRun with extracted parameters
353343
4. **Pipeline**: Orchestrates task execution, monitors completion, handles results
354-
5. **Task 1 (call-orchestrator-api)**: Calls orchestrator MLOps API with DVC/S3 params
344+
5. **Task 1 (call-orchestrator-api)**: Calls orchestrator MLOps API with DVC version params
355345
6. **Task 2 (poll-batch-status)**: Monitors batch completion until done or timeout
356346
7. **ConfigMap**: Stores environment-specific configuration (orchestrator URL, API endpoint)
357347

348+
## 🔄 Production Enhancements
349+
350+
For production use, consider:
351+
352+
### Automation
353+
354+
1. **Create CronJob** for scheduled benchmarking
355+
2. **Set up monitoring** (Prometheus metrics)
356+
3. **Configure notifications** (Slack/email on completion/failure)
357+
4. **Add retry logic** for transient failures
358+
358359
### Production Deployment
359360

360361
Deploy to dedicated namespace:
@@ -381,8 +382,6 @@ This creates both:
381382
- The `mlop-sast-ai-workflow-pipeline` that the orchestrator will trigger
382383
- The EventListener webhook endpoint for triggering benchmarks
383384

384-
**Note:** The Google Sheet URL is provided when triggering the EventListener via webhook, not during deployment.
385-
386385
## 🧹 Cleanup
387386

388387
To remove all MLOps benchmark resources:
Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
1-
# MLOps Benchmark Configuration
1+
# MLOps Benchmark Configuration Example
22
#
3-
# This ConfigMap is automatically generated by 'make eventlistener'.
4-
# Do not edit manually - regenerate using the Makefile.
3+
# This is an EXAMPLE file for reference only.
4+
# The actual benchmark-config.yaml is automatically generated by the Makefile.
55
#
6-
# To regenerate:
6+
# Recommended deployment method:
77
# cd deploy
88
# make eventlistener \
9-
# ORCHESTRATOR_API_URL=<your-url> \
10-
# NAMESPACE=<your-namespace>
9+
# ORCHESTRATOR_API_URL=http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080 \
10+
# NAMESPACE=your-namespace
11+
#
12+
# Finding your orchestrator URL:
13+
# oc get svc -l app=sast-ai-orchestrator
14+
#
15+
# Note: The Google Sheet URL is provided via webhook payload when triggering,
16+
# not in this ConfigMap.
1117
#
1218
---
1319
apiVersion: v1
@@ -19,8 +25,9 @@ metadata:
1925
app.kubernetes.io/component: benchmark-mlop
2026
data:
2127
# Orchestrator API base URL (cluster-internal service)
22-
# REPLACE THIS with your actual orchestrator URL
23-
orchestrator-api-url: "http://sast-ai-orchestrator.sast-ai.svc.cluster.local:8080"
28+
# This will be replaced by the Makefile with your actual orchestrator URL
29+
orchestrator-api-url: "http://sast-ai-orchestrator"
2430

2531
# API endpoint path for MLOps batches
2632
api-batch-endpoint: "/api/v1/mlops-batches"
33+

deploy/tekton/eventlistener/benchmark-pipeline.yaml

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,61 +13,51 @@ spec:
1313
batch completion. Designed for performance testing and MLOps workflows.
1414
1515
params:
16-
- name: batch-sheet-url
17-
type: string
18-
description: "Google Sheet URL with package list"
19-
default: ""
20-
2116
- name: submitted-by
2217
type: string
2318
description: "Trigger source identifier"
2419
default: "eventlistener-webhook"
2520

26-
# MLOps-specific parameters
27-
- name: dvc-repo-url
21+
- name: image-version
2822
type: string
29-
description: "DVC repository URL for data versioning"
30-
default: ""
23+
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
24+
default: "latest"
3125

32-
- name: dvc-data-version
26+
# DVC version parameters (required)
27+
- name: dvc-nvr-version
3328
type: string
34-
description: "DVC data version tag"
35-
default: ""
29+
description: "DVC NVR resource version"
3630

37-
- name: s3-endpoint-url
31+
- name: dvc-prompts-version
3832
type: string
39-
description: "S3 endpoint URL for MLOps data"
40-
default: ""
33+
description: "DVC prompts resource version"
4134

42-
- name: s3-input-bucket-name
35+
- name: dvc-known-false-positives-version
4336
type: string
44-
description: "S3 bucket name for input data"
45-
default: ""
37+
description: "DVC known false positives resource version"
4638

47-
- name: image-version
39+
- name: use-known-false-positive-file
4840
type: string
49-
description: "Workflow image version for testing (e.g., v2.1.0, sha-abc123)"
50-
default: "latest"
41+
description: "Whether to use known false positive file"
42+
default: "true"
5143

5244
tasks:
5345
- name: call-orchestrator-api
5446
taskRef:
5547
name: call-orchestrator-api-mlop
5648
params:
57-
- name: batch-sheet-url
58-
value: $(params.batch-sheet-url)
5949
- name: submitted-by
6050
value: $(params.submitted-by)
61-
- name: dvc-repo-url
62-
value: $(params.dvc-repo-url)
63-
- name: dvc-data-version
64-
value: $(params.dvc-data-version)
65-
- name: s3-endpoint-url
66-
value: $(params.s3-endpoint-url)
67-
- name: s3-input-bucket-name
68-
value: $(params.s3-input-bucket-name)
6951
- name: image-version
7052
value: $(params.image-version)
53+
- name: dvc-nvr-version
54+
value: $(params.dvc-nvr-version)
55+
- name: dvc-prompts-version
56+
value: $(params.dvc-prompts-version)
57+
- name: dvc-known-false-positives-version
58+
value: $(params.dvc-known-false-positives-version)
59+
- name: use-known-false-positive-file
60+
value: $(params.use-known-false-positive-file)
7161

7262
- name: poll-batch-status
7363
taskRef:

0 commit comments

Comments
 (0)