-
Notifications
You must be signed in to change notification settings - Fork 35
Expand file tree
/
Copy pathTaskfile.yml
More file actions
496 lines (452 loc) Β· 19.8 KB
/
Taskfile.yml
File metadata and controls
496 lines (452 loc) Β· 19.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
version: '3'
tasks:
build-helm-dependencies:
desc: Build Helm chart dependencies for all addon charts that require them
cmds:
- echo "Adding required Helm repositories..."
- helm repo add crossplane-stable https://charts.crossplane.io/stable || true
- helm repo add kubevela https://kubevela.github.io/charts || true
- helm repo add fluxcd-community https://fluxcd-community.github.io/helm-charts || true
- helm repo update
- echo "Building dependencies for flux chart..."
- cd ./gitops/addons/charts/flux && helm dependency build
- echo "Building dependencies for crossplane chart..."
- cd ./gitops/addons/charts/crossplane && helm dependency build
- echo "Building dependencies for kubevela chart..."
- cd ./gitops/addons/charts/kubevela && helm dependency build
- echo "All Helm chart dependencies built successfully!"
- echo "Don't forget to commit the generated Chart.lock files and charts/ directories"
check-helm-dependencies:
desc: Check which charts have dependencies defined
cmds:
- echo "Charts with dependencies:"
- find ./gitops/addons/charts -name "Chart.yaml" -exec grep -l "dependencies:" {} \;
- echo ""
- echo "Checking for missing Chart.lock files:"
- |
for chart in $(find ./gitops/addons/charts -name "Chart.yaml" -exec grep -l "dependencies:" {} \;); do
chart_dir=$(dirname "$chart")
if [ ! -f "$chart_dir/Chart.lock" ]; then
echo "Missing Chart.lock: $chart_dir"
else
echo "Found Chart.lock: $chart_dir"
fi
done
clean-helm-dependencies:
desc: Clean all generated Helm dependency files
cmds:
- echo "Cleaning Chart.lock files and charts/ directories..."
- find ./gitops/addons/charts -name "Chart.lock" -delete
- find ./gitops/addons/charts -name "charts" -type d -exec rm -rf {} + 2>/dev/null || true
- echo "Cleaned all Helm dependency files"
test-applicationsets:
desc: Test ApplicationSet generation locally using helm template
cmds:
- |
cd ./gitops/addons/charts/application-sets && \
helm template test-appsets . \
-f ../../bootstrap/default/addons.yaml \
-f ../../environments/control-plane/addons.yaml \
--set repoURLGit="https://github.com/aws-samples/appmod-blueprints" \
--set repoURLGitRevision="main" \
--set repoURLGitBasePath="gitops/addons/"
#grep -A 50 -B 5 "name: crossplane-aws"
test-airflow-chart:
desc: Test airflow helm chart for bitnami images and validate template rendering
cmds:
- echo "π Testing airflow helm chart..."
- echo "Adding Apache Airflow repository..."
- helm repo add apache-airflow https://airflow.apache.org || true
- helm repo update
- echo "Building dependencies for airflow chart..."
- cd ./gitops/addons/charts/airflow && helm dependency build
- echo "Testing helm template rendering..."
- |
cd ./gitops/addons/charts/airflow && \
helm template airflow . \
-f ../../default/addons/airflow/values.yaml \
--set global.resourcePrefix=peeks \
--dry-run > /tmp/airflow-test.yaml
- echo "β
Template rendering successful"
- echo "π Checking for problematic bitnami images from docker.io..."
- |
if grep -E "image:.*docker\.io/bitnami|repository:.*docker\.io/bitnami" /tmp/airflow-test.yaml; then
echo "β Found problematic bitnami images from docker.io in airflow chart!"
exit 1
else
echo "β
No problematic docker.io bitnami images found"
fi
- echo "π Images used in airflow chart:"
- grep -i "image:" /tmp/airflow-test.yaml | grep -v "imagePullPolicy" | sort | uniq
- rm -f /tmp/airflow-test.yaml
test-kubeflow-chart:
desc: Test kubeflow helm chart for bitnami images and validate template rendering
cmds:
- echo "π Testing kubeflow helm chart..."
- echo "Testing helm template rendering..."
- |
cd ./gitops/addons/charts/kubeflow && \
helm template kubeflow . \
-f ../../default/addons/kubeflow/values.yaml \
--set global.resourcePrefix=peeks \
--set global.ingress_domain_name=example.com \
--dry-run > /tmp/kubeflow-test.yaml
- echo "β
Template rendering successful"
- echo "π Checking for bitnami images..."
- |
if grep -E "image:.*bitnami|repository:.*bitnami" /tmp/kubeflow-test.yaml; then
echo "β Found bitnami images in kubeflow chart!"
exit 1
else
echo "β
No bitnami images found"
fi
- echo "π Images used in kubeflow chart:"
- grep -i "image:" /tmp/kubeflow-test.yaml | grep -v "imagePullPolicy" | sort | uniq
- rm -f /tmp/kubeflow-test.yaml
summary: |
Tests the kubeflow helm chart to ensure:
- Template renders without errors
- No bitnami images are used
- Lists all images used in the chart
backstage-validate:
desc: Validate Backstage configuration and check compilation
dir: ./backstage
cmds:
- yarn install
- yarn tsc
test-backstage-kro:
desc: 'Run Kro plugin integration tests'
dir: ./backstage
cmds:
- |
echo "π§ͺ Running Kro Plugin Integration Tests..."
echo "π Location: backstage/packages/backend/src/plugins/__tests__"
echo ""
# Check if yarn is available
if ! command -v yarn &> /dev/null; then
echo "β yarn is required but not installed"
echo "π‘ Please install yarn to run Kro plugin tests"
exit 1
fi
# Install dependencies if needed
echo "π¦ Installing dependencies..."
yarn install
# Run Kro plugin tests
echo "π§ͺ Running Kro plugin integration tests..."
yarn test:kro
summary: |
Runs comprehensive Kro plugin integration tests:
- Plugin initialization and configuration tests
- ResourceGraphDefinition discovery and management tests
- Catalog integration and entity relationship tests
- Permission validation and security tests
- Frontend component integration tests
test-backstage-kro-frontend:
desc: 'Run Kro frontend component tests'
dir: ./backstage
cmds:
- |
echo "π¨ Running Kro Frontend Component Tests..."
echo "π Location: backstage/packages/app/src/components/__tests__"
echo ""
# Install dependencies if needed
echo "π¦ Installing dependencies..."
yarn install
# Run frontend tests specifically
echo "π¨ Running Kro frontend component tests..."
yarn test --testPathPattern="KroIntegration.test.tsx" --verbose --no-coverage --passWithNoTests
summary: |
Runs Kro frontend component tests:
- ResourceGroup table rendering and filtering
- ResourceGroup details display components
- Create form validation and submission
- Catalog API integration and error handling
- Entity relationship display components
test-backstage-kro-backend:
desc: 'Run Kro backend integration tests'
dir: ./backstage
cmds:
- |
echo "βοΈ Running Kro Backend Integration Tests..."
echo "π Location: backstage/packages/backend/src/plugins/__tests__"
echo ""
# Install dependencies if needed
echo "π¦ Installing dependencies..."
yarn install
# Run backend tests specifically
echo "βοΈ Running Kro backend integration tests..."
yarn test --testPathPattern="kro.*test\.ts" --verbose --no-coverage --passWithNoTests
summary: |
Runs Kro backend integration tests:
- Plugin initialization and configuration validation
- ResourceGraphDefinition discovery workflows
- ResourceGroup creation and management operations
- Catalog integration and entity processing
- RBAC validation and permission scenarios
- Security components and audit logging
# ===== CICD PIPELINE KRO RGD TESTS =====
test-kro-unit:
desc: 'Run unit tests for CI/CD Pipeline Kro RGD'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests
cmds:
- |
echo "π§ͺ Running CI/CD Pipeline Kro RGD Unit Tests..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests"
echo ""
# Check if npm is available
if ! command -v npm &> /dev/null; then
echo "β npm is required but not installed"
echo "π‘ Please install Node.js and npm to run unit tests"
exit 1
fi
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
echo "π¦ Installing test dependencies..."
npm install
fi
# Run unit tests
echo "π¬ Running unit tests..."
npm run test
summary: |
Runs comprehensive unit tests for the CI/CD Pipeline Kro RGD:
- Schema validation tests
- Parameter handling tests
- Resource template generation tests
- Dependency ordering tests
test-kro-integration:
desc: 'Run integration tests for CI/CD Pipeline Kro RGD'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests
cmds:
- |
echo "π Running CI/CD Pipeline Kro RGD Integration Tests..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests/integration"
echo ""
# Check if npm is available
if ! command -v npm &> /dev/null; then
echo "β npm is required but not installed"
echo "π‘ Please install Node.js and npm to run integration tests"
exit 1
fi
# Run integration tests
echo "π Running integration tests..."
npm run test:integration
summary: |
Runs integration tests for the CI/CD Pipeline Kro RGD:
- AWS resource validation tests
- Kubernetes deployment tests
- End-to-end integration validation
test-kro-template:
desc: 'Run Backstage template execution tests'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests/template-execution
cmds:
- |
echo "π Running Backstage Template Execution Tests..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests/template-execution"
echo ""
# Check if npm is available
if ! command -v npm &> /dev/null; then
echo "β npm is required but not installed"
echo "π‘ Please install Node.js and npm to run template tests"
exit 1
fi
# Install dependencies if needed
if [ ! -d "node_modules" ]; then
echo "π¦ Installing test dependencies..."
npm install
fi
# Run template execution tests
echo "π Running template execution tests..."
npm run test
summary: |
Runs Backstage template execution tests:
- Template parameter validation
- YAML manifest generation tests
- GitLab integration validation
- ArgoCD application creation tests
- Pipeline creation validation
test-kro-deployment:
desc: 'Run deployment test for CI/CD Pipeline Kro RGD (requires cluster access)'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline
cmds:
- |
echo "π Running CI/CD Pipeline Kro RGD Deployment Test..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline"
echo "β οΈ This test requires active Kubernetes cluster access"
echo ""
# Check if kubectl is available
if ! command -v kubectl &> /dev/null; then
echo "β kubectl is required but not installed"
echo "π‘ Please install kubectl to run deployment tests"
exit 1
fi
# Check cluster connectivity
echo "π Checking cluster connectivity..."
kubectl cluster-info --request-timeout=10s || {
echo "β Cannot connect to Kubernetes cluster"
echo "π‘ Please ensure kubectl is configured and cluster is accessible"
exit 1
}
# Run deployment test
echo "π Running deployment test..."
./tests/test-kro-cicd-instance.sh
summary: |
Runs full deployment test for the CI/CD Pipeline Kro RGD:
- Deploys RGD to active Kubernetes cluster
- Creates test CICDPipeline instance
- Validates resource creation and dependencies
- Verifies resource status and readiness
test-kro-clean:
desc: 'Clean up CI/CD Pipeline Kro RGD test resources (requires cluster access)'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline
cmds:
- |
echo "π§Ή Cleaning up CI/CD Pipeline Kro RGD Test Resources..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline"
echo "β οΈ This will delete test resources from the cluster"
echo ""
# Check if kubectl is available
if ! command -v kubectl &> /dev/null; then
echo "β kubectl is required but not installed"
echo "π‘ Please install kubectl to run cleanup"
exit 1
fi
# Check cluster connectivity
echo "π Checking cluster connectivity..."
kubectl cluster-info --request-timeout=10s || {
echo "β Cannot connect to Kubernetes cluster"
echo "π‘ Please ensure kubectl is configured and cluster is accessible"
exit 1
}
# Run cleanup
echo "π§Ή Running cleanup script..."
./tests/cleanup-kro-test.sh
summary: |
Cleans up test resources created by test-kro-deployment:
- Deletes test CICDPipeline instance
- Removes test namespace and all resources
- Cleans up AWS resources (ECR images, IAM roles/policies)
- Provides clean slate for next test run
test-kro-dryrun:
desc: 'Run dry-run validation for CI/CD Pipeline Kro RGD (no cluster required)'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline
cmds:
- |
echo "π Running CI/CD Pipeline Kro RGD Dry-Run Validation..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline"
echo "β
This test does not require cluster access"
echo ""
# Run dry-run test
echo "π Running dry-run validation..."
./tests/test-kro-cicd-instance-dryrun.sh
summary: |
Runs dry-run validation for the CI/CD Pipeline Kro RGD:
- Validates RGD YAML syntax and structure
- Tests parameter substitution
- Validates resource template generation
- No cluster access required
test-kro-workflow:
desc: 'Run workflow integration tests (requires cluster and AWS access)'
dir: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests
cmds:
- |
echo "βοΈ Running Workflow Integration Tests..."
echo "π Location: gitops/addons/charts/kro/resource-groups/cicd-pipeline/tests"
echo "β οΈ This test requires active Kubernetes cluster and AWS access"
echo ""
# Check if npm is available
if ! command -v npm &> /dev/null; then
echo "β npm is required but not installed"
echo "π‘ Please install Node.js and npm to run workflow tests"
exit 1
fi
# Run workflow integration tests
echo "βοΈ Running workflow integration tests..."
npm run test:workflow
summary: |
Runs workflow integration tests for the CI/CD Pipeline Kro RGD:
- Tests Argo Workflows integration
- Validates ECR credential management
- Tests GitLab webhook integration
- Requires active cluster and AWS credentials
test-kro-all:
desc: 'Run all CI/CD Pipeline Kro RGD tests'
deps: [test-kro-unit, test-kro-template, test-kro-dryrun]
cmds:
- |
echo ""
echo "π All CI/CD Pipeline Kro RGD tests completed!"
echo ""
echo "π Summary of tests executed:"
echo " β
Unit tests (schema, parameters, templates)"
echo " β
Template execution tests (Backstage integration)"
echo " β
Dry-run validation (syntax and structure)"
echo ""
echo "π‘ Additional tests available:"
echo " - task test-kro-integration (requires npm and cluster access)"
echo " - task test-kro-deployment (requires cluster access)"
echo " - task test-kro-workflow (requires cluster and AWS access)"
summary: |
Runs comprehensive test suite for CI/CD Pipeline Kro RGD:
- Executes unit tests, template tests, and dry-run validation
- Provides complete validation without requiring cluster access
- Additional integration tests available separately
test-kro-complete:
desc: 'Run all Kro tests (RGD + Backstage plugin integration)'
deps: [test-kro-all, test-backstage-kro]
cmds:
- |
echo ""
echo "π Complete Kro Test Suite Finished!"
echo ""
echo "π Summary of all tests executed:"
echo ""
echo "π§ KRO RGD TESTS:"
echo " β
Unit tests (schema, parameters, templates)"
echo " β
Template execution tests (Backstage integration)"
echo " β
Dry-run validation (syntax and structure)"
echo ""
echo "ποΈ BACKSTAGE PLUGIN TESTS:"
echo " β
Plugin initialization and configuration"
echo " β
ResourceGraphDefinition discovery and management"
echo " β
Catalog integration and entity relationships"
echo " β
Permission validation and security"
echo " β
Frontend component integration"
echo ""
echo "π‘ Additional integration tests available:"
echo " - task test-kro-integration (requires cluster access)"
echo " - task test-kro-deployment (requires cluster access)"
echo " - task test-kro-workflow (requires cluster and AWS access)"
summary: |
Runs the complete Kro test suite including:
- All CI/CD Pipeline Kro RGD tests (unit, template, dry-run)
- All Backstage plugin integration tests (frontend + backend)
- Comprehensive validation of the entire Kro ecosystem
default:
desc: 'Show available tasks'
cmds:
- |
echo "π Available tasks:"
echo ""
echo "π§ HELM CHART MANAGEMENT:"
echo " task build-helm-dependencies - Build Helm chart dependencies"
echo " task check-helm-dependencies - Check which charts have dependencies"
echo " task clean-helm-dependencies - Clean generated dependency files"
echo " task test-applicationsets - Test ApplicationSet generation"
echo ""
echo "ποΈ BACKSTAGE:"
echo " task backstage-validate - Validate Backstage configuration"
echo " task test-backstage-kro - Run Kro plugin integration tests"
echo " task test-backstage-kro-frontend - Run Kro frontend component tests"
echo " task test-backstage-kro-backend - Run Kro backend integration tests"
echo ""
echo "π§ͺ CI/CD PIPELINE KRO RGD TESTS:"
echo " task test-kro-unit - Run unit tests (schema, parameters, templates)"
echo " task test-kro-template - Run Backstage template execution tests"
echo " task test-kro-dryrun - Run dry-run validation (no cluster required)"
echo " task test-kro-integration - Run integration tests (requires cluster)"
echo " task test-kro-deployment - Run deployment test (requires cluster)"
echo " task test-kro-workflow - Run workflow integration tests (requires cluster + AWS)"
echo " task test-kro-all - Run all basic RGD tests (unit, template, dry-run)"
echo ""
echo "π COMPLETE KRO TEST SUITE:"
echo " task test-kro-complete - Run ALL Kro tests (RGD + Backstage plugin)"