File size: 27,606 Bytes
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2794920
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2794920
 
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb895b1
 
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
eb895b1
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2794920
 
c8f3b98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
"""Task: Full Stack Deployment Pipeline β€” EXPERT.

Agent debugs multi-error scenarios spanning the entire stack:
GHA workflow + Dockerfile + Kubernetes manifests.
Multiple bugs per scenario requiring cross-file reasoning.
"""

from server.models import TaskDifficulty
from server.tasks.base import BaseTask


class PipelineFullTask(BaseTask):
    NAME = "Full Stack Deployment Pipeline"
    DESCRIPTION = "Debug complex multi-error deployment pipelines across GHA workflows, Dockerfiles, and Kubernetes manifests"
    DIFFICULTY = TaskDifficulty.HARD
    AVAILABLE_SECRETS = ["GITHUB_TOKEN", "DOCKER_USERNAME", "DOCKER_PASSWORD"]

    SCENARIOS = [
        # Scenario 1: GHCR token missing env + K8s service selector mismatch
        {
            "id": "full_pipeline_ghcr_and_selector",
            "files": [
                {
                    "path": ".github/workflows/deploy.yml",
                    "type": "workflow",
                    "content": (
                        "name: Build and Deploy\n"
                        "on:\n"
                        "  push:\n"
                        "    branches: [main]\n"
                        "\n"
                        "jobs:\n"
                        "  deploy:\n"
                        "    runs-on: ubuntu-latest\n"
                        "    steps:\n"
                        "      - uses: actions/checkout@v4\n"
                        "\n"
                        "      - name: Build Docker image\n"
                        "        run: docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .\n"
                        "\n"
                        "      - name: Login to GHCR\n"
                        "        run: echo $GITHUB_TOKEN | docker login ghcr.io -u ${{ github.actor }} --password-stdin\n"
                        "\n"
                        "      - name: Push image\n"
                        "        run: docker push ghcr.io/${{ github.repository }}:${{ github.sha }}\n"
                    ),
                },
                {
                    "path": "Dockerfile",
                    "type": "dockerfile",
                    "content": (
                        "FROM node:20-alpine\n"
                        "WORKDIR /app\n"
                        "COPY package*.json ./\n"
                        "RUN npm ci\n"
                        "COPY . .\n"
                        "EXPOSE 3000\n"
                        'CMD ["npm", "start"]\n'
                    ),
                },
                {
                    "path": "package.json",
                    "type": "other",
                    "content": '{"name": "myapp", "scripts": {"start": "node server.js"}}',
                },
                {
                    "path": "k8s/deployment.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: apps/v1\n"
                        "kind: Deployment\n"
                        "metadata:\n"
                        "  name: myapp\n"
                        "spec:\n"
                        "  replicas: 3\n"
                        "  selector:\n"
                        "    matchLabels:\n"
                        "      app: myapp\n"
                        "  template:\n"
                        "    metadata:\n"
                        "      labels:\n"
                        "        app: myapp\n"
                        "    spec:\n"
                        "      containers:\n"
                        "      - name: app\n"
                        "        image: ghcr.io/OWNER/REPO:TAG\n"
                        "        ports:\n"
                        "        - containerPort: 3000\n"
                    ),
                },
                {
                    "path": "k8s/service.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: v1\n"
                        "kind: Service\n"
                        "metadata:\n"
                        "  name: myapp-service\n"
                        "spec:\n"
                        "  selector:\n"
                        "    app: my-app\n"
                        "  ports:\n"
                        "  - port: 80\n"
                        "    targetPort: 3000\n"
                    ),
                },
            ],
            "error": {
                "phase": "pipeline_deploy",
                "message": (
                    "Run: Build and Deploy\n"
                    "\n"
                    "Step: Login to GHCR βœ—\n"
                    "Error: Cannot perform an interactive login from a non TTY device\n"
                    "Error: GITHUB_TOKEN environment variable is not set\n"
                    "\n"
                    "---\n"
                    "(If login had succeeded, deployment would also fail with:)\n"
                    "Error: Service 'myapp-service' has no endpoints"
                ),
            },
            "expected_fixes": [
                {
                    "file": ".github/workflows/deploy.yml",
                    "type": "contains",
                    "expected": "GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}",
                    "hint": "GITHUB_TOKEN is used as shell variable but not mapped from secrets via env block",
                },
                {
                    "file": "k8s/service.yaml",
                    "type": "contains",
                    "expected": "app: myapp",
                    "hint": "Service selector 'app: my-app' doesn't match Deployment label 'app: myapp'",
                },
            ],
        },

        # Scenario 2: Dockerfile missing WORKDIR + workflow missing checkout + K8s wrong port
        {
            "id": "full_pipeline_three_bugs",
            "files": [
                {
                    "path": ".github/workflows/ci.yml",
                    "type": "workflow",
                    "content": (
                        "name: CI Pipeline\n"
                        "on:\n"
                        "  push:\n"
                        "    branches: [main]\n"
                        "\n"
                        "jobs:\n"
                        "  build:\n"
                        "    runs-on: ubuntu-latest\n"
                        "    steps:\n"
                        "      - name: Build image\n"
                        "        run: docker build -t myapp:${{ github.sha }} .\n"
                        "\n"
                        "      - name: Run tests\n"
                        "        run: docker run myapp:${{ github.sha }} npm test\n"
                    ),
                },
                {
                    "path": "Dockerfile",
                    "type": "dockerfile",
                    "content": (
                        "FROM node:18-alpine\n"
                        "COPY package*.json ./\n"
                        "RUN npm ci\n"
                        "COPY . .\n"
                        "EXPOSE 3000\n"
                        'CMD ["npm", "start"]\n'
                    ),
                },
                {
                    "path": "package.json",
                    "type": "other",
                    "content": '{"name": "myapp", "scripts": {"start": "node server.js", "test": "jest"}}',
                },
                {
                    "path": "k8s/deployment.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: apps/v1\n"
                        "kind: Deployment\n"
                        "metadata:\n"
                        "  name: myapp\n"
                        "spec:\n"
                        "  replicas: 2\n"
                        "  selector:\n"
                        "    matchLabels:\n"
                        "      app: myapp\n"
                        "  template:\n"
                        "    metadata:\n"
                        "      labels:\n"
                        "        app: myapp\n"
                        "    spec:\n"
                        "      containers:\n"
                        "      - name: app\n"
                        "        image: myapp:latest\n"
                        "        ports:\n"
                        "        - containerPort: 8080\n"
                    ),
                },
                {
                    "path": "k8s/service.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: v1\n"
                        "kind: Service\n"
                        "metadata:\n"
                        "  name: myapp-svc\n"
                        "spec:\n"
                        "  selector:\n"
                        "    app: myapp\n"
                        "  ports:\n"
                        "  - port: 80\n"
                        "    targetPort: 8080\n"
                    ),
                },
            ],
            "error": {
                "phase": "pipeline_deploy",
                "message": (
                    "Run: CI Pipeline\n"
                    "\n"
                    "Step: Build image βœ—\n"
                    "Error: Checkout must happen before Docker build steps\n"
                    "(No actions/checkout@v4 step found before docker build)\n"
                    "\n"
                    "---\n"
                    "Additionally:\n"
                    "- Dockerfile: npm reports module resolution errors at runtime\n"
                    "- K8s: Service returns connection refused when accessed"
                ),
            },
            "expected_fixes": [
                {
                    "file": ".github/workflows/ci.yml",
                    "type": "contains",
                    "expected": "actions/checkout@v4",
                    "hint": "Workflow needs a checkout step before docker build",
                },
                {
                    "file": "Dockerfile",
                    "type": "contains",
                    "expected": "WORKDIR /app",
                    "hint": "Dockerfile needs WORKDIR /app before COPY commands",
                },
                {
                    "file": "k8s/deployment.yaml",
                    "type": "contains",
                    "expected": "containerPort: 3000",
                    "hint": "Container port should be 3000 to match the app's EXPOSE/listen port",
                },
                {
                    "file": "k8s/service.yaml",
                    "type": "contains",
                    "expected": "targetPort: 3000",
                    "hint": "Service targetPort should be 3000 to match container port",
                },
            ],
        },

        # Scenario 3: Wrong GHCR password secret + Dockerfile base image typo + K8s OOM
        {
            "id": "full_pipeline_ghcr_dockerfile_k8s",
            "files": [
                {
                    "path": ".github/workflows/release.yml",
                    "type": "workflow",
                    "content": (
                        "name: Release Pipeline\n"
                        "on:\n"
                        "  release:\n"
                        "    types: [published]\n"
                        "\n"
                        "jobs:\n"
                        "  release:\n"
                        "    runs-on: ubuntu-latest\n"
                        "    steps:\n"
                        "      - uses: actions/checkout@v4\n"
                        "\n"
                        "      - name: Login to GHCR\n"
                        "        run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin\n"
                        "\n"
                        "      - name: Build\n"
                        "        run: docker build -t ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }} .\n"
                        "\n"
                        "      - name: Push\n"
                        "        run: docker push ghcr.io/${{ github.repository }}:${{ github.event.release.tag_name }}\n"
                    ),
                },
                {
                    "path": "Dockerfile",
                    "type": "dockerfile",
                    "content": (
                        "FROM python:3.9-slimm\n"
                        "WORKDIR /app\n"
                        "COPY requirements.txt .\n"
                        "RUN pip install -r requirements.txt\n"
                        "COPY . .\n"
                        "EXPOSE 7860\n"
                        'CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860"]\n'
                    ),
                },
                {
                    "path": "requirements.txt",
                    "type": "requirements",
                    "content": "flask==3.0.0\ngunicorn==21.2.0\n",
                },
                {
                    "path": "k8s/deployment.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: apps/v1\n"
                        "kind: Deployment\n"
                        "metadata:\n"
                        "  name: api\n"
                        "spec:\n"
                        "  replicas: 3\n"
                        "  selector:\n"
                        "    matchLabels:\n"
                        "      app: api\n"
                        "  template:\n"
                        "    metadata:\n"
                        "      labels:\n"
                        "        app: api\n"
                        "    spec:\n"
                        "      containers:\n"
                        "      - name: api\n"
                        "        image: ghcr.io/myorg/myapp:latest\n"
                        "        ports:\n"
                        "        - containerPort: 7860\n"
                        "        resources:\n"
                        "          limits:\n"
                        '            memory: "64Mi"\n'
                        '            cpu: "100m"\n'
                    ),
                },
            ],
            "error": {
                "phase": "pipeline_deploy",
                "message": (
                    "Run: Release Pipeline\n"
                    "\n"
                    "Step: Login to GHCR βœ—\n"
                    "Error: GHCR requires GITHUB_TOKEN for authentication, not DOCKER_PASSWORD\n"
                    "\n"
                    "---\n"
                    "Additional issues found:\n"
                    "- Dockerfile: pull access denied for base image β€” repository does not exist\n"
                    "- K8s: Pod in CrashLoopBackOff with exit code 137"
                ),
            },
            "expected_fixes": [
                {
                    "file": ".github/workflows/release.yml",
                    "type": "contains",
                    "expected": "secrets.GITHUB_TOKEN",
                    "hint": "GHCR uses GITHUB_TOKEN, not DOCKER_PASSWORD",
                },
                {
                    "file": "Dockerfile",
                    "type": "not_contains",
                    "expected": "python:3.9-slimm",
                    "hint": "Base image tag has a typo: 'slimm' should be 'slim'",
                },
                {
                    "file": "k8s/deployment.yaml",
                    "type": "contains",
                    "expected": 'memory: "256Mi"',
                    "hint": "Memory limit 64Mi is too low for gunicorn β€” increase to at least 256Mi",
                },
            ],
        },

        # Scenario 4: Missing permissions block + hardcoded K8s image + missing ingress class
        {
            "id": "full_pipeline_permissions_image_ingress",
            "files": [
                {
                    "path": ".github/workflows/deploy.yml",
                    "type": "workflow",
                    "content": (
                        "name: Deploy to Production\n"
                        "on:\n"
                        "  push:\n"
                        "    branches: [main]\n"
                        "\n"
                        "jobs:\n"
                        "  build-and-push:\n"
                        "    runs-on: ubuntu-latest\n"
                        "    steps:\n"
                        "      - uses: actions/checkout@v4\n"
                        "\n"
                        "      - name: Login to GHCR\n"
                        "        run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin\n"
                        "\n"
                        "      - name: Build and push\n"
                        "        run: |\n"
                        "          docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .\n"
                        "          docker push ghcr.io/${{ github.repository }}:${{ github.sha }}\n"
                    ),
                },
                {
                    "path": "Dockerfile",
                    "type": "dockerfile",
                    "content": (
                        "FROM node:20-alpine\n"
                        "WORKDIR /app\n"
                        "COPY package*.json ./\n"
                        "RUN npm ci\n"
                        "COPY . .\n"
                        "EXPOSE 3000\n"
                        'CMD ["npm", "start"]\n'
                    ),
                },
                {
                    "path": "package.json",
                    "type": "other",
                    "content": '{"name": "app", "scripts": {"start": "node index.js"}}',
                },
                {
                    "path": "k8s/deployment.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: apps/v1\n"
                        "kind: Deployment\n"
                        "metadata:\n"
                        "  name: webapp\n"
                        "spec:\n"
                        "  replicas: 3\n"
                        "  selector:\n"
                        "    matchLabels:\n"
                        "      app: webapp\n"
                        "  template:\n"
                        "    metadata:\n"
                        "      labels:\n"
                        "        app: webapp\n"
                        "    spec:\n"
                        "      containers:\n"
                        "      - name: webapp\n"
                        "        image: ghcr.io/OWNER/REPO:TAG\n"
                        "        ports:\n"
                        "        - containerPort: 3000\n"
                    ),
                },
                {
                    "path": "k8s/service.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: v1\n"
                        "kind: Service\n"
                        "metadata:\n"
                        "  name: webapp-svc\n"
                        "spec:\n"
                        "  selector:\n"
                        "    app: webapp\n"
                        "  ports:\n"
                        "  - port: 80\n"
                        "    targetPort: 3000\n"
                    ),
                },
                {
                    "path": "k8s/ingress.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: networking.k8s.io/v1\n"
                        "kind: Ingress\n"
                        "metadata:\n"
                        "  name: webapp-ingress\n"
                        "spec:\n"
                        "  rules:\n"
                        "  - host: webapp.example.com\n"
                        "    http:\n"
                        "      paths:\n"
                        "      - path: /\n"
                        "        pathType: Prefix\n"
                        "        backend:\n"
                        "          service:\n"
                        "            name: webapp-svc\n"
                        "            port:\n"
                        "              number: 80\n"
                    ),
                },
            ],
            "error": {
                "phase": "pipeline_deploy",
                "message": (
                    "Run: Deploy to Production\n"
                    "\n"
                    "Step: Build and push βœ—\n"
                    "Error: denied: permission_denied: write_package\n"
                    "GITHUB_TOKEN does not have packages:write permission\n"
                    "\n"
                    "---\n"
                    "Additional issues:\n"
                    "- K8s Deployment image is hardcoded as 'ghcr.io/OWNER/REPO:TAG' β€” "
                    "should reference the actual built image\n"
                    "- Ingress has no ingressClassName β€” won't be picked up by nginx controller"
                ),
            },
            "expected_fixes": [
                {
                    "file": ".github/workflows/deploy.yml",
                    "type": "contains",
                    "expected": "packages: write",
                    "hint": "Add permissions block with 'packages: write' to allow GHCR push",
                },
                {
                    "file": "k8s/deployment.yaml",
                    "type": "not_contains",
                    "expected": "OWNER/REPO:TAG",
                    "hint": "Replace hardcoded 'OWNER/REPO:TAG' placeholder with actual image reference",
                },
                {
                    "file": "k8s/ingress.yaml",
                    "type": "contains",
                    "expected": "ingressClassName: nginx",
                    "hint": "Add ingressClassName: nginx to the Ingress spec",
                },
            ],
        },

        # Scenario 5: Workflow secrets not wired + Dockerfile wrong output dir + K8s probe port wrong
        {
            "id": "full_pipeline_secrets_build_probe",
            "files": [
                {
                    "path": ".github/workflows/build.yml",
                    "type": "workflow",
                    "content": (
                        "name: Build and Push\n"
                        "on:\n"
                        "  push:\n"
                        "    branches: [main]\n"
                        "\n"
                        "jobs:\n"
                        "  build:\n"
                        "    runs-on: ubuntu-latest\n"
                        "    steps:\n"
                        "      - uses: actions/checkout@v4\n"
                        "\n"
                        "      - name: Login to DockerHub\n"
                        "        run: echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin\n"
                        "\n"
                        "      - name: Build\n"
                        "        run: docker build -t myuser/frontend:${{ github.sha }} .\n"
                        "\n"
                        "      - name: Push\n"
                        "        run: docker push myuser/frontend:${{ github.sha }}\n"
                    ),
                },
                {
                    "path": "Dockerfile",
                    "type": "dockerfile",
                    "content": (
                        "FROM node:20-alpine AS builder\n"
                        "WORKDIR /app\n"
                        "COPY package*.json ./\n"
                        "RUN npm ci\n"
                        "COPY . .\n"
                        "RUN npm run build\n"
                        "\n"
                        "FROM nginx:alpine\n"
                        "COPY --from=builder /app/dist /usr/share/nginx/html\n"
                        "EXPOSE 80\n"
                        'CMD ["nginx", "-g", "daemon off;"]\n'
                    ),
                },
                {
                    "path": "package.json",
                    "type": "other",
                    "content": '{"name": "frontend", "scripts": {"build": "react-scripts build", "start": "react-scripts start"}}',
                },
                {
                    "path": "k8s/deployment.yaml",
                    "type": "kubernetes",
                    "content": (
                        "apiVersion: apps/v1\n"
                        "kind: Deployment\n"
                        "metadata:\n"
                        "  name: frontend\n"
                        "spec:\n"
                        "  replicas: 2\n"
                        "  selector:\n"
                        "    matchLabels:\n"
                        "      app: frontend\n"
                        "  template:\n"
                        "    metadata:\n"
                        "      labels:\n"
                        "        app: frontend\n"
                        "    spec:\n"
                        "      containers:\n"
                        "      - name: frontend\n"
                        "        image: myuser/frontend:latest\n"
                        "        ports:\n"
                        "        - containerPort: 80\n"
                        "        livenessProbe:\n"
                        "          httpGet:\n"
                        "            path: /healthz\n"
                        "            port: 3000\n"
                        "          initialDelaySeconds: 10\n"
                        "          periodSeconds: 5\n"
                    ),
                },
            ],
            "error": {
                "phase": "pipeline_deploy",
                "message": (
                    "Run: Build and Push\n"
                    "\n"
                    "Step: Login to DockerHub βœ—\n"
                    "Error: DOCKER_USERNAME and DOCKER_PASSWORD env vars are empty β€” "
                    "secrets not wired via env block\n"
                    "\n"
                    "---\n"
                    "Additional issues:\n"
                    "- Dockerfile: COPY failed: stat app/dist: file does not exist "
                    "(react-scripts outputs to 'build/' not 'dist/')\n"
                    "- K8s: Liveness probe port 3000 doesn't match container port 80 "
                    "(nginx listens on 80)"
                ),
            },
            "expected_fixes": [
                {
                    "file": ".github/workflows/build.yml",
                    "type": "contains",
                    "expected": "DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}",
                    "hint": "Docker login secrets need to be mapped via env block",
                },
                {
                    "file": ".github/workflows/build.yml",
                    "type": "contains",
                    "expected": "DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}",
                    "hint": "Both DOCKER_USERNAME and DOCKER_PASSWORD must be in env block",
                },
                {
                    "file": "Dockerfile",
                    "type": "contains",
                    "expected": "COPY --from=builder /app/build",
                    "hint": "react-scripts outputs to 'build/' not 'dist/'",
                },
                {
                    "file": "k8s/deployment.yaml",
                    "type": "contains",
                    "expected": "port: 80",
                    "hint": "Liveness probe port should be 80 to match nginx container",
                },
            ],
        },
    ]