@catladder/pipeline 3.13.0 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/bash/bashEscape.d.ts +2 -0
  2. package/dist/bash/bashEscape.js +9 -1
  3. package/dist/constants.js +1 -1
  4. package/dist/pipeline/agent/createAgentContext.d.ts +6 -0
  5. package/dist/pipeline/agent/createAgentContext.js +141 -0
  6. package/dist/pipeline/agent/createAgentEventJob.d.ts +2 -0
  7. package/dist/pipeline/agent/createAgentEventJob.js +74 -0
  8. package/dist/pipeline/agent/createAgentReviewJob.d.ts +2 -0
  9. package/dist/pipeline/agent/createAgentReviewJob.js +69 -0
  10. package/dist/pipeline/agent/createJobsForAgentContext.d.ts +2 -0
  11. package/dist/pipeline/agent/createJobsForAgentContext.js +12 -0
  12. package/dist/pipeline/agent/prompts.d.ts +10 -0
  13. package/dist/pipeline/agent/prompts.js +66 -0
  14. package/dist/pipeline/agent/shared.d.ts +8 -0
  15. package/dist/pipeline/agent/shared.js +29 -0
  16. package/dist/pipeline/agent/utils.d.ts +3 -0
  17. package/dist/pipeline/agent/utils.js +16 -0
  18. package/dist/pipeline/createAllJobs.d.ts +5 -1
  19. package/dist/pipeline/createAllJobs.js +32 -6
  20. package/dist/pipeline/createMainPipeline.js +10 -5
  21. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +3 -3
  22. package/dist/pipeline/gitlab/createGitlabJobs.js +13 -11
  23. package/dist/pipeline/gitlab/createGitlabPipeline.js +7 -1
  24. package/dist/rules/index.d.ts +1 -0
  25. package/dist/rules/index.js +8 -3
  26. package/dist/tsconfig.tsbuildinfo +1 -1
  27. package/dist/types/agent.d.ts +7 -0
  28. package/dist/types/agent.js +5 -0
  29. package/dist/types/config.d.ts +2 -0
  30. package/dist/types/context.d.ts +7 -0
  31. package/dist/types/index.d.ts +2 -1
  32. package/dist/types/index.js +2 -1
  33. package/dist/types/jobs.d.ts +5 -1
  34. package/dist/types/jobs.js +1 -1
  35. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +66 -1
  36. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +66 -1
  37. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +66 -1
  38. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +66 -1
  39. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +30 -1
  40. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +66 -1
  41. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +66 -1
  42. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +66 -1
  43. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +66 -1
  44. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +66 -1
  45. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +66 -1
  46. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +66 -1
  47. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +66 -1
  48. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +66 -1
  49. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +66 -1
  50. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +66 -1
  51. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +66 -1
  52. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +54 -1
  53. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +1576 -0
  54. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +66 -1
  55. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +66 -1
  56. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +66 -1
  57. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +170 -1
  58. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +118 -1
  59. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +66 -1
  60. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +66 -1
  61. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +66 -1
  62. package/examples/__snapshots__/custom-build-job.test.ts.snap +54 -1
  63. package/examples/__snapshots__/custom-deploy.test.ts.snap +60 -1
  64. package/examples/__snapshots__/custom-envs.test.ts.snap +64 -1
  65. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +54 -1
  66. package/examples/__snapshots__/custom-verify-job.test.ts.snap +74 -1
  67. package/examples/__snapshots__/git-submodule.test.ts.snap +66 -1
  68. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +74 -1
  69. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +74 -1
  70. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +134 -1
  71. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +74 -1
  72. package/examples/__snapshots__/local-dot-env.test.ts.snap +66 -1
  73. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +74 -1
  74. package/examples/__snapshots__/multiline-var.test.ts.snap +178 -1
  75. package/examples/__snapshots__/native-app.test.ts.snap +102 -1
  76. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +66 -1
  77. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +66 -1
  78. package/examples/__snapshots__/override-secrets.test.ts.snap +66 -1
  79. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +66 -1
  80. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +66 -1
  81. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +178 -1
  82. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +86 -1
  83. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +98 -1
  84. package/examples/__snapshots__/workspace-api-www.test.ts.snap +98 -1
  85. package/examples/cloud-run-with-agents.test.ts +11 -0
  86. package/examples/cloud-run-with-agents.ts +36 -0
  87. package/package.json +1 -1
  88. package/src/bash/bashEscape.ts +6 -0
  89. package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +9 -0
  90. package/src/pipeline/agent/createAgentContext.ts +19 -0
  91. package/src/pipeline/agent/createAgentEventJob.ts +35 -0
  92. package/src/pipeline/agent/createAgentReviewJob.ts +33 -0
  93. package/src/pipeline/agent/createJobsForAgentContext.ts +7 -0
  94. package/src/pipeline/agent/prompts.ts +233 -0
  95. package/src/pipeline/agent/shared.ts +36 -0
  96. package/src/pipeline/agent/utils.ts +9 -0
  97. package/src/pipeline/createAllJobs.ts +20 -1
  98. package/src/pipeline/createJobsForComponent.ts +1 -0
  99. package/src/pipeline/createMainPipeline.ts +19 -4
  100. package/src/pipeline/gitlab/createGitlabJobs.ts +39 -30
  101. package/src/pipeline/gitlab/createGitlabPipeline.ts +9 -1
  102. package/src/rules/index.ts +7 -0
  103. package/src/types/agent.ts +7 -0
  104. package/src/types/config.ts +3 -0
  105. package/src/types/context.ts +8 -0
  106. package/src/types/index.ts +1 -0
  107. package/src/types/jobs.ts +6 -0
@@ -28,6 +28,11 @@ stages:
28
28
  - verify review
29
29
  - verify stage
30
30
  - verify prod
31
+ - agents
32
+ - agents dev
33
+ - agents review
34
+ - agents stage
35
+ - agents prod
31
36
  - rollback
32
37
  - rollback dev
33
38
  - rollback review
@@ -48,6 +53,10 @@ variables:
48
53
  workflow:
49
54
  name: $PIPELINE_ICON $PIPELINE_NAME
50
55
  rules:
56
+ - if: $CI_PIPELINE_SOURCE == "trigger"
57
+ variables:
58
+ PIPELINE_ICON: 🤖
59
+ PIPELINE_NAME: Thinking...
51
60
  - if: $CI_MERGE_REQUEST_ID
52
61
  variables:
53
62
  PIPELINE_ICON: 🐱🔨
@@ -59,7 +68,7 @@ workflow:
59
68
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
60
69
  variables:
61
70
  PIPELINE_ICON: 🐱🔨
62
- PIPELINE_NAME: Main $CI_COMMIT_REF_NAME
71
+ PIPELINE_NAME: Main
63
72
  - when: always
64
73
  variables:
65
74
  PIPELINE_ICON: 🐱❓
@@ -108,7 +117,11 @@ before_script:
108
117
  - cd .
109
118
  - yarn npm audit --environment production
110
119
  rules:
120
+ - when: never
121
+ if: $CI_PIPELINE_SOURCE == "trigger"
111
122
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
123
+ - when: never
124
+ if: $CI_PIPELINE_SOURCE == "trigger"
112
125
  - if: $CI_MERGE_REQUEST_ID
113
126
  needs: []
114
127
  retry: &a1
@@ -152,7 +165,11 @@ before_script:
152
165
  paths:
153
166
  - node_modules
154
167
  rules:
168
+ - when: never
169
+ if: $CI_PIPELINE_SOURCE == "trigger"
155
170
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
171
+ - when: never
172
+ if: $CI_PIPELINE_SOURCE == "trigger"
156
173
  - if: $CI_MERGE_REQUEST_ID
157
174
  needs: []
158
175
  retry: *a1
@@ -191,7 +208,11 @@ before_script:
191
208
  paths:
192
209
  - node_modules
193
210
  rules:
211
+ - when: never
212
+ if: $CI_PIPELINE_SOURCE == "trigger"
194
213
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
214
+ - when: never
215
+ if: $CI_PIPELINE_SOURCE == "trigger"
195
216
  - if: $CI_MERGE_REQUEST_ID
196
217
  needs: []
197
218
  retry: *a1
@@ -280,6 +301,8 @@ before_script:
280
301
  when: always
281
302
  reports: {}
282
303
  rules:
304
+ - when: never
305
+ if: $CI_PIPELINE_SOURCE == "trigger"
283
306
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
284
307
  needs: []
285
308
  retry: *a1
@@ -368,6 +391,8 @@ before_script:
368
391
  when: always
369
392
  reports: {}
370
393
  rules:
394
+ - when: never
395
+ if: $CI_PIPELINE_SOURCE == "trigger"
371
396
  - if: $CI_MERGE_REQUEST_ID
372
397
  needs: []
373
398
  retry: *a1
@@ -456,6 +481,8 @@ before_script:
456
481
  when: always
457
482
  reports: {}
458
483
  rules:
484
+ - when: never
485
+ if: $CI_PIPELINE_SOURCE == "trigger"
459
486
  - if: $CI_COMMIT_TAG
460
487
  needs: []
461
488
  retry: *a1
@@ -544,6 +571,8 @@ before_script:
544
571
  when: always
545
572
  reports: {}
546
573
  rules:
574
+ - when: never
575
+ if: $CI_PIPELINE_SOURCE == "trigger"
547
576
  - if: $CI_COMMIT_TAG
548
577
  needs: []
549
578
  retry: *a1
@@ -601,6 +630,8 @@ before_script:
601
630
  paths:
602
631
  - api/.yarn
603
632
  rules:
633
+ - when: never
634
+ if: $CI_PIPELINE_SOURCE == "trigger"
604
635
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
605
636
  needs:
606
637
  - job: '🔸 myWorkspace 🔨 app | dev '
@@ -622,6 +653,8 @@ before_script:
622
653
  paths:
623
654
  - __sbom.json
624
655
  rules:
656
+ - when: never
657
+ if: $CI_PIPELINE_SOURCE == "trigger"
625
658
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
626
659
  needs: []
627
660
  retry: *a1
@@ -718,6 +751,8 @@ before_script:
718
751
  reports:
719
752
  dotenv: gitlab_environment.env
720
753
  rules:
754
+ - when: never
755
+ if: $CI_PIPELINE_SOURCE == "trigger"
721
756
  - when: on_success
722
757
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
723
758
  needs:
@@ -760,6 +795,8 @@ before_script:
760
795
  rules:
761
796
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
762
797
  when: on_success
798
+ - when: never
799
+ if: $CI_PIPELINE_SOURCE == "trigger"
763
800
  - when: manual
764
801
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
765
802
  needs: []
@@ -819,6 +856,8 @@ before_script:
819
856
  paths:
820
857
  - api/.yarn
821
858
  rules:
859
+ - when: never
860
+ if: $CI_PIPELINE_SOURCE == "trigger"
822
861
  - if: $CI_MERGE_REQUEST_ID
823
862
  needs:
824
863
  - job: '🔸 myWorkspace 🔨 app | review '
@@ -840,6 +879,8 @@ before_script:
840
879
  paths:
841
880
  - __sbom.json
842
881
  rules:
882
+ - when: never
883
+ if: $CI_PIPELINE_SOURCE == "trigger"
843
884
  - if: $CI_MERGE_REQUEST_ID
844
885
  needs: []
845
886
  retry: *a1
@@ -939,6 +980,8 @@ before_script:
939
980
  reports:
940
981
  dotenv: gitlab_environment.env
941
982
  rules:
983
+ - when: never
984
+ if: $CI_PIPELINE_SOURCE == "trigger"
942
985
  - when: on_success
943
986
  if: $CI_MERGE_REQUEST_ID
944
987
  needs:
@@ -984,6 +1027,8 @@ before_script:
984
1027
  rules:
985
1028
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
986
1029
  when: on_success
1030
+ - when: never
1031
+ if: $CI_PIPELINE_SOURCE == "trigger"
987
1032
  - when: manual
988
1033
  if: $CI_MERGE_REQUEST_ID
989
1034
  needs: []
@@ -1043,6 +1088,8 @@ before_script:
1043
1088
  paths:
1044
1089
  - api/.yarn
1045
1090
  rules:
1091
+ - when: never
1092
+ if: $CI_PIPELINE_SOURCE == "trigger"
1046
1093
  - if: $CI_COMMIT_TAG
1047
1094
  needs:
1048
1095
  - job: '🔸 myWorkspace 🔨 app | stage '
@@ -1064,6 +1111,8 @@ before_script:
1064
1111
  paths:
1065
1112
  - __sbom.json
1066
1113
  rules:
1114
+ - when: never
1115
+ if: $CI_PIPELINE_SOURCE == "trigger"
1067
1116
  - if: $CI_COMMIT_TAG
1068
1117
  needs: []
1069
1118
  retry: *a1
@@ -1159,6 +1208,8 @@ before_script:
1159
1208
  reports:
1160
1209
  dotenv: gitlab_environment.env
1161
1210
  rules:
1211
+ - when: never
1212
+ if: $CI_PIPELINE_SOURCE == "trigger"
1162
1213
  - when: on_success
1163
1214
  if: $CI_COMMIT_TAG
1164
1215
  needs:
@@ -1195,6 +1246,8 @@ before_script:
1195
1246
  rules:
1196
1247
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
1197
1248
  when: on_success
1249
+ - when: never
1250
+ if: $CI_PIPELINE_SOURCE == "trigger"
1198
1251
  - when: manual
1199
1252
  if: $CI_COMMIT_TAG
1200
1253
  needs: []
@@ -1254,6 +1307,8 @@ before_script:
1254
1307
  paths:
1255
1308
  - api/.yarn
1256
1309
  rules:
1310
+ - when: never
1311
+ if: $CI_PIPELINE_SOURCE == "trigger"
1257
1312
  - if: $CI_COMMIT_TAG
1258
1313
  needs:
1259
1314
  - job: '🔸 myWorkspace 🔨 app | prod '
@@ -1275,6 +1330,8 @@ before_script:
1275
1330
  paths:
1276
1331
  - __sbom.json
1277
1332
  rules:
1333
+ - when: never
1334
+ if: $CI_PIPELINE_SOURCE == "trigger"
1278
1335
  - if: $CI_COMMIT_TAG
1279
1336
  needs: []
1280
1337
  retry: *a1
@@ -1370,6 +1427,8 @@ before_script:
1370
1427
  reports:
1371
1428
  dotenv: gitlab_environment.env
1372
1429
  rules:
1430
+ - when: never
1431
+ if: $CI_PIPELINE_SOURCE == "trigger"
1373
1432
  - when: manual
1374
1433
  if: $CI_COMMIT_TAG
1375
1434
  needs:
@@ -1406,6 +1465,8 @@ before_script:
1406
1465
  rules:
1407
1466
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
1408
1467
  when: on_success
1468
+ - when: never
1469
+ if: $CI_PIPELINE_SOURCE == "trigger"
1409
1470
  - when: manual
1410
1471
  if: $CI_COMMIT_TAG
1411
1472
  needs: []
@@ -1465,6 +1526,8 @@ before_script:
1465
1526
  paths:
1466
1527
  - www/.yarn
1467
1528
  rules:
1529
+ - when: never
1530
+ if: $CI_PIPELINE_SOURCE == "trigger"
1468
1531
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
1469
1532
  needs:
1470
1533
  - job: '🔸 myWorkspace 🔨 app | dev '
@@ -1486,6 +1549,8 @@ before_script:
1486
1549
  paths:
1487
1550
  - __sbom.json
1488
1551
  rules:
1552
+ - when: never
1553
+ if: $CI_PIPELINE_SOURCE == "trigger"
1489
1554
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
1490
1555
  needs: []
1491
1556
  retry: *a1
@@ -1585,6 +1650,8 @@ before_script:
1585
1650
  reports:
1586
1651
  dotenv: gitlab_environment.env
1587
1652
  rules:
1653
+ - when: never
1654
+ if: $CI_PIPELINE_SOURCE == "trigger"
1588
1655
  - when: on_success
1589
1656
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
1590
1657
  needs:
@@ -1627,6 +1694,8 @@ before_script:
1627
1694
  rules:
1628
1695
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
1629
1696
  when: on_success
1697
+ - when: never
1698
+ if: $CI_PIPELINE_SOURCE == "trigger"
1630
1699
  - when: manual
1631
1700
  if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
1632
1701
  needs: []
@@ -1686,6 +1755,8 @@ before_script:
1686
1755
  paths:
1687
1756
  - www/.yarn
1688
1757
  rules:
1758
+ - when: never
1759
+ if: $CI_PIPELINE_SOURCE == "trigger"
1689
1760
  - if: $CI_MERGE_REQUEST_ID
1690
1761
  needs:
1691
1762
  - job: '🔸 myWorkspace 🔨 app | review '
@@ -1707,6 +1778,8 @@ before_script:
1707
1778
  paths:
1708
1779
  - __sbom.json
1709
1780
  rules:
1781
+ - when: never
1782
+ if: $CI_PIPELINE_SOURCE == "trigger"
1710
1783
  - if: $CI_MERGE_REQUEST_ID
1711
1784
  needs: []
1712
1785
  retry: *a1
@@ -1809,6 +1882,8 @@ before_script:
1809
1882
  reports:
1810
1883
  dotenv: gitlab_environment.env
1811
1884
  rules:
1885
+ - when: never
1886
+ if: $CI_PIPELINE_SOURCE == "trigger"
1812
1887
  - when: on_success
1813
1888
  if: $CI_MERGE_REQUEST_ID
1814
1889
  needs:
@@ -1854,6 +1929,8 @@ before_script:
1854
1929
  rules:
1855
1930
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
1856
1931
  when: on_success
1932
+ - when: never
1933
+ if: $CI_PIPELINE_SOURCE == "trigger"
1857
1934
  - when: manual
1858
1935
  if: $CI_MERGE_REQUEST_ID
1859
1936
  needs: []
@@ -1913,6 +1990,8 @@ before_script:
1913
1990
  paths:
1914
1991
  - www/.yarn
1915
1992
  rules:
1993
+ - when: never
1994
+ if: $CI_PIPELINE_SOURCE == "trigger"
1916
1995
  - if: $CI_COMMIT_TAG
1917
1996
  needs:
1918
1997
  - job: '🔸 myWorkspace 🔨 app | stage '
@@ -1934,6 +2013,8 @@ before_script:
1934
2013
  paths:
1935
2014
  - __sbom.json
1936
2015
  rules:
2016
+ - when: never
2017
+ if: $CI_PIPELINE_SOURCE == "trigger"
1937
2018
  - if: $CI_COMMIT_TAG
1938
2019
  needs: []
1939
2020
  retry: *a1
@@ -2032,6 +2113,8 @@ before_script:
2032
2113
  reports:
2033
2114
  dotenv: gitlab_environment.env
2034
2115
  rules:
2116
+ - when: never
2117
+ if: $CI_PIPELINE_SOURCE == "trigger"
2035
2118
  - when: on_success
2036
2119
  if: $CI_COMMIT_TAG
2037
2120
  needs:
@@ -2068,6 +2151,8 @@ before_script:
2068
2151
  rules:
2069
2152
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
2070
2153
  when: on_success
2154
+ - when: never
2155
+ if: $CI_PIPELINE_SOURCE == "trigger"
2071
2156
  - when: manual
2072
2157
  if: $CI_COMMIT_TAG
2073
2158
  needs: []
@@ -2127,6 +2212,8 @@ before_script:
2127
2212
  paths:
2128
2213
  - www/.yarn
2129
2214
  rules:
2215
+ - when: never
2216
+ if: $CI_PIPELINE_SOURCE == "trigger"
2130
2217
  - if: $CI_COMMIT_TAG
2131
2218
  needs:
2132
2219
  - job: '🔸 myWorkspace 🔨 app | prod '
@@ -2148,6 +2235,8 @@ before_script:
2148
2235
  paths:
2149
2236
  - __sbom.json
2150
2237
  rules:
2238
+ - when: never
2239
+ if: $CI_PIPELINE_SOURCE == "trigger"
2151
2240
  - if: $CI_COMMIT_TAG
2152
2241
  needs: []
2153
2242
  retry: *a1
@@ -2246,6 +2335,8 @@ before_script:
2246
2335
  reports:
2247
2336
  dotenv: gitlab_environment.env
2248
2337
  rules:
2338
+ - when: never
2339
+ if: $CI_PIPELINE_SOURCE == "trigger"
2249
2340
  - when: manual
2250
2341
  if: $CI_COMMIT_TAG
2251
2342
  needs:
@@ -2282,6 +2373,8 @@ before_script:
2282
2373
  rules:
2283
2374
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/
2284
2375
  when: on_success
2376
+ - when: never
2377
+ if: $CI_PIPELINE_SOURCE == "trigger"
2285
2378
  - when: manual
2286
2379
  if: $CI_COMMIT_TAG
2287
2380
  needs: []
@@ -2299,6 +2392,9 @@ create release:
2299
2392
  if: $CI_COMMIT_MESSAGE =~ /^chore\\(release\\).*/
2300
2393
  when: never
2301
2394
  - &a3
2395
+ if: $CI_PIPELINE_SOURCE == "trigger"
2396
+ when: never
2397
+ - &a4
2302
2398
  if: $CI_PIPELINE_SOURCE == "schedule"
2303
2399
  when: never
2304
2400
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $AUTO_RELEASE == "true"
@@ -2316,6 +2412,7 @@ create release:
2316
2412
  rules:
2317
2413
  - *a2
2318
2414
  - *a3
2415
+ - *a4
2319
2416
  - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
2320
2417
  when: manual
2321
2418
  - if: $CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/
@@ -0,0 +1,11 @@
1
+ import { createYamlLocalPipeline } from "./__utils__/helpers";
2
+ import config from "./cloud-run-with-agents";
3
+
4
+ /**
5
+ * This test is auto-generated.
6
+ * Modifications will be overwritten on every `yarn test` run!
7
+ */
8
+
9
+ it("matches snapshot for cloud-run-with-agents local pipeline YAML", async () => {
10
+ expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
11
+ });
@@ -0,0 +1,36 @@
1
+ import type { Config } from "../src";
2
+
3
+ const config = {
4
+ appName: "agent-example-app",
5
+ customerName: "pan",
6
+ // Note: AI agents are experimental
7
+ agents: {
8
+ claude: {
9
+ type: "claude",
10
+ },
11
+ },
12
+ components: {
13
+ www: {
14
+ dir: "www",
15
+ build: {
16
+ type: "node",
17
+ cache: {
18
+ paths: [".next/cache"],
19
+ },
20
+ },
21
+ deploy: {
22
+ type: "google-cloudrun",
23
+ projectId: "google-project-id",
24
+ region: "europe-west6",
25
+ },
26
+ },
27
+ },
28
+ } satisfies Config;
29
+
30
+ export default config;
31
+
32
+ export const information = {
33
+ title: "Cloud Run: With AI Agents",
34
+ description:
35
+ "Example showing how to configure AI agents for automated code review and issue analysis",
36
+ };
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.13.0",
56
+ "version": "3.14.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -57,6 +57,12 @@ export const escapeDoubleQuotes = (value: string | null | undefined) =>
57
57
  export const escapeSingleQuotes = (value: string | null | undefined) =>
58
58
  value?.toString().replace(/'/g, "\\'");
59
59
 
60
+ export const escapeBackTicks = (value: string | null | undefined) =>
61
+ value?.toString().replace(/`/g, "\\`");
62
+
63
+ export const escapeNewlines = (value: string | null | undefined) =>
64
+ value?.toString().replace(/\n/g, "\\n");
65
+
60
66
  export type EscapeForDotEnvOptions = {
61
67
  quoteMode: "auto" | "always";
62
68
  };
@@ -47,6 +47,15 @@ exports[`getPipelineStages() should return all envs for SIMPLE_CONFIG1 1`] = `
47
47
  "verify review2",
48
48
  "verify stage2",
49
49
  "verify prod2",
50
+ "agents",
51
+ "agents dev",
52
+ "agents review",
53
+ "agents stage",
54
+ "agents prod",
55
+ "agents dev2",
56
+ "agents review2",
57
+ "agents stage2",
58
+ "agents prod2",
50
59
  "rollback",
51
60
  "rollback dev",
52
61
  "rollback review",
@@ -0,0 +1,19 @@
1
+ import type { Config } from "../../types";
2
+ import type { AgentContext } from "../../types/context";
3
+
4
+ export const createAgentContext = async (ctx: {
5
+ agentName: string;
6
+ config: Config;
7
+ }): Promise<AgentContext> => {
8
+ const agentConfig = ctx.config.agents?.[ctx.agentName];
9
+ if (!agentConfig) {
10
+ throw new Error(`Agent ${ctx.agentName} not found in config`);
11
+ }
12
+ return {
13
+ type: "agent",
14
+ name: ctx.agentName,
15
+ //env: ctx.env,
16
+ fullConfig: ctx.config,
17
+ agentConfig: agentConfig,
18
+ };
19
+ };
@@ -0,0 +1,35 @@
1
+ import type { AgentContext, CatladderJob } from "../../types";
2
+ import { getEventPrompt } from "./prompts";
3
+ import { baseSetupScript, callClaude, createBaseAgentJob } from "./shared";
4
+ import { getAgentUserId, getAgentUserName } from "./utils";
5
+
6
+ export const createAgentEventJob = (context: AgentContext): CatladderJob => {
7
+ const baseJob = createBaseAgentJob(context);
8
+ // unfortunatly, we need to manage both, because the "@mention"-feature only works with the username
9
+ const agentUserId = getAgentUserId(context);
10
+ const agentUserName = getAgentUserName(context);
11
+ return {
12
+ interruptible: false, // do not cancel this job if it is running. Otherwise a commit to main will cancel it
13
+ ...baseJob,
14
+ variables: {
15
+ ...baseJob.variables,
16
+ },
17
+ name: context.name + "-agent-event",
18
+ rules: [
19
+ {
20
+ if: `$CI_PIPELINE_SOURCE == "trigger" && ($ASSIGNEE_USER_ID == ${agentUserId} || $OBJECT_DESCRIPTION =~ /@${agentUserName}/)`,
21
+ when: "always",
22
+ },
23
+
24
+ {
25
+ when: "never",
26
+ },
27
+ ],
28
+ script: [
29
+ ...baseSetupScript,
30
+ ...callClaude({
31
+ prompt: getEventPrompt({ agentUserName: agentUserName }),
32
+ }),
33
+ ],
34
+ };
35
+ };
@@ -0,0 +1,33 @@
1
+ import { RULE_IS_MERGE_REQUEST } from "../../rules";
2
+ import type { AgentContext, CatladderJob } from "../../types";
3
+ import { getMergeRequestPrompt } from "./prompts";
4
+ import { baseSetupScript, callClaude, createBaseAgentJob } from "./shared";
5
+ import { getAgentUserName } from "./utils";
6
+
7
+ export const createAgentReviewJob = (context: AgentContext): CatladderJob => {
8
+ const baseJob = createBaseAgentJob(context);
9
+
10
+ const agentUserName = getAgentUserName(context);
11
+ return {
12
+ ...baseJob,
13
+ name: context.name + "-agent-review",
14
+
15
+ rules: [
16
+ {
17
+ ...RULE_IS_MERGE_REQUEST,
18
+ when: "always",
19
+ },
20
+ {
21
+ when: "never",
22
+ },
23
+ ],
24
+ script: [
25
+ ...baseSetupScript,
26
+ ...callClaude({
27
+ prompt: getMergeRequestPrompt({
28
+ agentUserName: agentUserName,
29
+ }),
30
+ }),
31
+ ],
32
+ };
33
+ };
@@ -0,0 +1,7 @@
1
+ import type { AgentContext } from "../../types";
2
+ import { createAgentEventJob } from "./createAgentEventJob";
3
+ import { createAgentReviewJob } from "./createAgentReviewJob";
4
+
5
+ export const createJobsForAgentContext = (context: AgentContext) => {
6
+ return [createAgentEventJob(context), createAgentReviewJob(context)];
7
+ };