@catladder/pipeline 3.17.1 โ†’ 3.19.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.
@@ -0,0 +1,642 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`matches snapshot for modify-generated-files local pipeline YAML 1`] = `
4
+ "image: path/to/docker/jobs-default:the-version
5
+ stages:
6
+ - setup
7
+ - setup dev
8
+ - setup review
9
+ - setup stage
10
+ - setup prod
11
+ - test
12
+ - test dev
13
+ - test review
14
+ - test stage
15
+ - test prod
16
+ - build
17
+ - build dev
18
+ - build review
19
+ - build stage
20
+ - build prod
21
+ - deploy
22
+ - deploy dev
23
+ - deploy review
24
+ - deploy stage
25
+ - deploy prod
26
+ - verify
27
+ - verify dev
28
+ - verify review
29
+ - verify stage
30
+ - verify prod
31
+ - agents
32
+ - agents dev
33
+ - agents review
34
+ - agents stage
35
+ - agents prod
36
+ - rollback
37
+ - rollback dev
38
+ - rollback review
39
+ - rollback stage
40
+ - rollback prod
41
+ - stop
42
+ - stop dev
43
+ - stop review
44
+ - stop stage
45
+ - stop prod
46
+ - release
47
+ variables:
48
+ FF_USE_FASTZIP: 'true'
49
+ ARTIFACT_COMPRESSION_LEVEL: fast
50
+ CACHE_COMPRESSION_LEVEL: fast
51
+ TRANSFER_METER_FREQUENCY: 5s
52
+ GIT_DEPTH: '1'
53
+ workflow:
54
+ name: $PIPELINE_ICON $PIPELINE_NAME
55
+ rules:
56
+ - if: $CI_PIPELINE_SOURCE == "trigger"
57
+ variables:
58
+ PIPELINE_ICON: ๐Ÿค–
59
+ PIPELINE_NAME: Thinking...
60
+ - if: $CI_MERGE_REQUEST_ID
61
+ variables:
62
+ PIPELINE_ICON: ๐Ÿฑ๐Ÿ”จ
63
+ PIPELINE_NAME: Merge Request $CI_MERGE_REQUEST_IID
64
+ - if: $CI_COMMIT_TAG
65
+ variables:
66
+ PIPELINE_ICON: ๐Ÿฑ๐Ÿ“ฆ
67
+ PIPELINE_NAME: Release $CI_COMMIT_TAG
68
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
69
+ variables:
70
+ PIPELINE_ICON: ๐Ÿฑ๐Ÿ”จ
71
+ PIPELINE_NAME: Main
72
+ - when: always
73
+ variables:
74
+ PIPELINE_ICON: ๐Ÿฑโ“
75
+ PIPELINE_NAME: Default
76
+ before_script:
77
+ - |-
78
+ function escapeForDotEnv () {
79
+ input="\${1:-$(cat)}"
80
+ input="\${input//$'\\n'/\\\\n}"
81
+ if [[ "$input" == *\\\\n* ]]; then
82
+ if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
83
+ printf "\\"%s\\"\\n" "$input"
84
+ elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
85
+ printf "\`%s\`\\n" "$input"
86
+ elif [[ "$input" == *\\"* ]]; then
87
+ printf "'%s'\\n" "$input"
88
+ else
89
+ printf "\\"%s\\"\\n" "$input"
90
+ fi
91
+ else
92
+ printf "%s\\n" "$input"
93
+ fi
94
+ }
95
+ - |-
96
+ function collapseable_section_start () {
97
+ local section_title="\${1}"
98
+ local section_description="\${2:-$section_title}"
99
+ echo -e "section_start:\`date +%s\`:\${section_title}[collapsed=true]\\r\\e[0K\${section_description}"
100
+ }
101
+ - |-
102
+ function collapseable_section_end () {
103
+ local section_title="\${1}"
104
+ echo -e "section_end:\`date +%s\`:\${section_title}\\r\\e[0K"
105
+ }
106
+ api ๐Ÿ›ก audit:
107
+ stage: test
108
+ image: path/to/docker/jobs-default:the-version
109
+ variables:
110
+ KUBERNETES_CPU_REQUEST: '0.45'
111
+ KUBERNETES_MEMORY_REQUEST: 1Gi
112
+ KUBERNETES_MEMORY_LIMIT: 4Gi
113
+ script:
114
+ - collapseable_section_start "injectvars" "Injecting variables"
115
+ - export APP_PATH="api"
116
+ - collapseable_section_end "injectvars"
117
+ - cd api
118
+ - yarn npm audit --environment production
119
+ rules:
120
+ - when: never
121
+ if: $CI_PIPELINE_SOURCE == "trigger"
122
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
123
+ - when: never
124
+ if: $CI_PIPELINE_SOURCE == "trigger"
125
+ - if: $CI_MERGE_REQUEST_ID
126
+ needs: []
127
+ retry: &a1
128
+ max: 2
129
+ when:
130
+ - runner_system_failure
131
+ - stuck_or_timeout_failure
132
+ interruptible: true
133
+ allow_failure: true
134
+ api ๐Ÿ‘ฎ lint:
135
+ stage: test
136
+ image: path/to/docker/jobs-default:the-version
137
+ variables:
138
+ KUBERNETES_CPU_REQUEST: '0.45'
139
+ KUBERNETES_MEMORY_REQUEST: 1Gi
140
+ KUBERNETES_MEMORY_LIMIT: 4Gi
141
+ script:
142
+ - collapseable_section_start "injectvars" "Injecting variables"
143
+ - export APP_PATH="api"
144
+ - collapseable_section_end "injectvars"
145
+ - collapseable_section_start "nodeinstall" "Ensure node version"
146
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
147
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
148
+ - collapseable_section_end "nodeinstall"
149
+ - cd api
150
+ - collapseable_section_start "nodeinstall" "Ensure node version"
151
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
152
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
153
+ - collapseable_section_end "nodeinstall"
154
+ - collapseable_section_start "yarninstall" "Yarn install"
155
+ - yarn install --immutable
156
+ - collapseable_section_end "yarninstall"
157
+ - yarn lint
158
+ cache:
159
+ - key: api-yarn
160
+ policy: pull-push
161
+ paths:
162
+ - api/.yarn
163
+ - key: api-node-modules
164
+ policy: pull-push
165
+ paths:
166
+ - api/node_modules
167
+ rules:
168
+ - when: never
169
+ if: $CI_PIPELINE_SOURCE == "trigger"
170
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
171
+ - when: never
172
+ if: $CI_PIPELINE_SOURCE == "trigger"
173
+ - if: $CI_MERGE_REQUEST_ID
174
+ needs: []
175
+ retry: *a1
176
+ interruptible: true
177
+ api ๐Ÿงช test:
178
+ stage: test
179
+ image: path/to/docker/jobs-testing-chrome:the-version
180
+ variables:
181
+ KUBERNETES_CPU_REQUEST: '0.45'
182
+ KUBERNETES_MEMORY_REQUEST: 1Gi
183
+ KUBERNETES_MEMORY_LIMIT: 4Gi
184
+ script:
185
+ - collapseable_section_start "injectvars" "Injecting variables"
186
+ - export APP_PATH="api"
187
+ - collapseable_section_end "injectvars"
188
+ - collapseable_section_start "nodeinstall" "Ensure node version"
189
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
190
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
191
+ - collapseable_section_end "nodeinstall"
192
+ - cd api
193
+ - collapseable_section_start "nodeinstall" "Ensure node version"
194
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
195
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
196
+ - collapseable_section_end "nodeinstall"
197
+ - collapseable_section_start "yarninstall" "Yarn install"
198
+ - yarn install --immutable
199
+ - collapseable_section_end "yarninstall"
200
+ - yarn test
201
+ cache:
202
+ - key: api-yarn
203
+ policy: pull-push
204
+ paths:
205
+ - api/.yarn
206
+ - key: api-node-modules
207
+ policy: pull-push
208
+ paths:
209
+ - api/node_modules
210
+ rules:
211
+ - when: never
212
+ if: $CI_PIPELINE_SOURCE == "trigger"
213
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
214
+ - when: never
215
+ if: $CI_PIPELINE_SOURCE == "trigger"
216
+ - if: $CI_MERGE_REQUEST_ID
217
+ needs: []
218
+ retry: *a1
219
+ interruptible: true
220
+ 'api ๐Ÿ”จ app | dev ':
221
+ stage: build
222
+ image: path/to/docker/jobs-default:the-version
223
+ variables:
224
+ KUBERNETES_CPU_REQUEST: '0.45'
225
+ KUBERNETES_MEMORY_REQUEST: 1Gi
226
+ KUBERNETES_MEMORY_LIMIT: 4Gi
227
+ script:
228
+ - collapseable_section_start "injectvars" "Injecting variables"
229
+ - export ENV_SHORT="dev"
230
+ - export APP_DIR="api"
231
+ - export ENV_TYPE="dev"
232
+ - export BUILD_INFO_BUILD_ID="$(git describe --tags 2>/dev/null || git rev-parse HEAD)"
233
+ - export BUILD_INFO_BUILD_TIME="$CI_JOB_STARTED_AT"
234
+ - export BUILD_INFO_CURRENT_VERSION="$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")"
235
+ - export HOSTNAME="unknown-host.example.com"
236
+ - export ROOT_URL="https://unknown-host.example.com"
237
+ - export HOSTNAME_INTERNAL="unknown-host.example.com"
238
+ - export ROOT_URL_INTERNAL="https://unknown-host.example.com"
239
+ - export _ALL_ENV_VAR_KEYS="[\\"ENV_SHORT\\",\\"APP_DIR\\",\\"ENV_TYPE\\",\\"BUILD_INFO_BUILD_ID\\",\\"BUILD_INFO_BUILD_TIME\\",\\"BUILD_INFO_CURRENT_VERSION\\",\\"HOSTNAME\\",\\"ROOT_URL\\",\\"HOSTNAME_INTERNAL\\",\\"ROOT_URL_INTERNAL\\"]"
240
+ - collapseable_section_end "injectvars"
241
+ - collapseable_section_start "write-dotenv-api" "write dot env for api"
242
+ - |-
243
+ cat <<EOF > api/.env
244
+ ENV_SHORT=dev
245
+ APP_DIR=api
246
+ ENV_TYPE=dev
247
+ HOSTNAME=unknown-host.example.com
248
+ ROOT_URL=https://unknown-host.example.com
249
+ HOSTNAME_INTERNAL=unknown-host.example.com
250
+ ROOT_URL_INTERNAL=https://unknown-host.example.com
251
+ _ALL_ENV_VAR_KEYS=["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_BUILD_ID","BUILD_INFO_BUILD_TIME","BUILD_INFO_CURRENT_VERSION","HOSTNAME","ROOT_URL","HOSTNAME_INTERNAL","ROOT_URL_INTERNAL"]
252
+ EOF
253
+ - collapseable_section_end "write-dotenv-api"
254
+ - echo '{"id":"$(git describe --tags 2>/dev/null || git rev-parse HEAD)","time":"$CI_JOB_STARTED_AT"}' > api/__build_info.json
255
+ - collapseable_section_start "nodeinstall" "Ensure node version"
256
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
257
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
258
+ - collapseable_section_end "nodeinstall"
259
+ - cd api
260
+ - collapseable_section_start "nodeinstall" "Ensure node version"
261
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
262
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
263
+ - collapseable_section_end "nodeinstall"
264
+ - collapseable_section_start "yarninstall" "Yarn install"
265
+ - yarn install --immutable
266
+ - collapseable_section_end "yarninstall"
267
+ - yarn build
268
+ cache:
269
+ - key: api-yarn
270
+ policy: pull-push
271
+ paths:
272
+ - api/.yarn
273
+ - key: api-node-modules
274
+ policy: pull-push
275
+ paths:
276
+ - api/node_modules
277
+ artifacts:
278
+ paths:
279
+ - api/__build_info.json
280
+ - api/.next
281
+ - api/dist
282
+ exclude:
283
+ - api/.env
284
+ expire_in: 1 day
285
+ when: always
286
+ reports: {}
287
+ rules:
288
+ - when: never
289
+ if: $CI_PIPELINE_SOURCE == "trigger"
290
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
291
+ needs: []
292
+ retry: *a1
293
+ interruptible: true
294
+ 'api ๐Ÿงพ sbom | dev ':
295
+ stage: build
296
+ image:
297
+ name: aquasec/trivy:0.58.2
298
+ entrypoint:
299
+ - ''
300
+ variables: {}
301
+ script:
302
+ - collapseable_section_start "injectvars" "Injecting variables"
303
+ - collapseable_section_end "injectvars"
304
+ - trivy fs --quiet --format cyclonedx --output "__sbom.json" api
305
+ artifacts:
306
+ paths:
307
+ - __sbom.json
308
+ rules:
309
+ - when: never
310
+ if: $CI_PIPELINE_SOURCE == "trigger"
311
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $CI_COMMIT_MESSAGE !~ /^chore\\(release\\).*/
312
+ needs: []
313
+ retry: *a1
314
+ interruptible: true
315
+ allow_failure: true
316
+ 'api ๐Ÿ”จ app | review ':
317
+ stage: build
318
+ image: path/to/docker/jobs-default:the-version
319
+ variables:
320
+ KUBERNETES_CPU_REQUEST: '0.45'
321
+ KUBERNETES_MEMORY_REQUEST: 1Gi
322
+ KUBERNETES_MEMORY_LIMIT: 4Gi
323
+ script:
324
+ - collapseable_section_start "injectvars" "Injecting variables"
325
+ - export ENV_SHORT="review"
326
+ - export APP_DIR="api"
327
+ - export ENV_TYPE="review"
328
+ - export BUILD_INFO_BUILD_ID="$(git describe --tags 2>/dev/null || git rev-parse HEAD)"
329
+ - export BUILD_INFO_BUILD_TIME="$CI_JOB_STARTED_AT"
330
+ - export BUILD_INFO_CURRENT_VERSION="$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")"
331
+ - export HOSTNAME="unknown-host.example.com"
332
+ - export ROOT_URL="https://unknown-host.example.com"
333
+ - export HOSTNAME_INTERNAL="unknown-host.example.com"
334
+ - export ROOT_URL_INTERNAL="https://unknown-host.example.com"
335
+ - export _ALL_ENV_VAR_KEYS="[\\"ENV_SHORT\\",\\"APP_DIR\\",\\"ENV_TYPE\\",\\"BUILD_INFO_BUILD_ID\\",\\"BUILD_INFO_BUILD_TIME\\",\\"BUILD_INFO_CURRENT_VERSION\\",\\"HOSTNAME\\",\\"ROOT_URL\\",\\"HOSTNAME_INTERNAL\\",\\"ROOT_URL_INTERNAL\\"]"
336
+ - collapseable_section_end "injectvars"
337
+ - collapseable_section_start "write-dotenv-api" "write dot env for api"
338
+ - |-
339
+ cat <<EOF > api/.env
340
+ ENV_SHORT=review
341
+ APP_DIR=api
342
+ ENV_TYPE=review
343
+ HOSTNAME=unknown-host.example.com
344
+ ROOT_URL=https://unknown-host.example.com
345
+ HOSTNAME_INTERNAL=unknown-host.example.com
346
+ ROOT_URL_INTERNAL=https://unknown-host.example.com
347
+ _ALL_ENV_VAR_KEYS=["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_BUILD_ID","BUILD_INFO_BUILD_TIME","BUILD_INFO_CURRENT_VERSION","HOSTNAME","ROOT_URL","HOSTNAME_INTERNAL","ROOT_URL_INTERNAL"]
348
+ EOF
349
+ - collapseable_section_end "write-dotenv-api"
350
+ - echo '{"id":"$(git describe --tags 2>/dev/null || git rev-parse HEAD)","time":"$CI_JOB_STARTED_AT"}' > api/__build_info.json
351
+ - collapseable_section_start "nodeinstall" "Ensure node version"
352
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
353
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
354
+ - collapseable_section_end "nodeinstall"
355
+ - cd api
356
+ - collapseable_section_start "nodeinstall" "Ensure node version"
357
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
358
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
359
+ - collapseable_section_end "nodeinstall"
360
+ - collapseable_section_start "yarninstall" "Yarn install"
361
+ - yarn install --immutable
362
+ - collapseable_section_end "yarninstall"
363
+ - yarn build
364
+ cache:
365
+ - key: api-yarn
366
+ policy: pull-push
367
+ paths:
368
+ - api/.yarn
369
+ - key: api-node-modules
370
+ policy: pull-push
371
+ paths:
372
+ - api/node_modules
373
+ artifacts:
374
+ paths:
375
+ - api/__build_info.json
376
+ - api/.next
377
+ - api/dist
378
+ exclude:
379
+ - api/.env
380
+ expire_in: 1 day
381
+ when: always
382
+ reports: {}
383
+ rules:
384
+ - when: never
385
+ if: $CI_PIPELINE_SOURCE == "trigger"
386
+ - if: $CI_MERGE_REQUEST_ID
387
+ needs: []
388
+ retry: *a1
389
+ interruptible: true
390
+ 'api ๐Ÿงพ sbom | review ':
391
+ stage: build
392
+ image:
393
+ name: aquasec/trivy:0.58.2
394
+ entrypoint:
395
+ - ''
396
+ variables: {}
397
+ script:
398
+ - collapseable_section_start "injectvars" "Injecting variables"
399
+ - collapseable_section_end "injectvars"
400
+ - trivy fs --quiet --format cyclonedx --output "__sbom.json" api
401
+ artifacts:
402
+ paths:
403
+ - __sbom.json
404
+ rules:
405
+ - when: never
406
+ if: $CI_PIPELINE_SOURCE == "trigger"
407
+ - if: $CI_MERGE_REQUEST_ID
408
+ needs: []
409
+ retry: *a1
410
+ interruptible: true
411
+ allow_failure: true
412
+ 'api ๐Ÿ”จ app | stage ':
413
+ stage: build
414
+ image: path/to/docker/jobs-default:the-version
415
+ variables:
416
+ KUBERNETES_CPU_REQUEST: '0.45'
417
+ KUBERNETES_MEMORY_REQUEST: 1Gi
418
+ KUBERNETES_MEMORY_LIMIT: 4Gi
419
+ script:
420
+ - collapseable_section_start "injectvars" "Injecting variables"
421
+ - export ENV_SHORT="stage"
422
+ - export APP_DIR="api"
423
+ - export ENV_TYPE="stage"
424
+ - export BUILD_INFO_BUILD_ID="$(git describe --tags 2>/dev/null || git rev-parse HEAD)"
425
+ - export BUILD_INFO_BUILD_TIME="$CI_JOB_STARTED_AT"
426
+ - export BUILD_INFO_CURRENT_VERSION="$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")"
427
+ - export HOSTNAME="unknown-host.example.com"
428
+ - export ROOT_URL="https://unknown-host.example.com"
429
+ - export HOSTNAME_INTERNAL="unknown-host.example.com"
430
+ - export ROOT_URL_INTERNAL="https://unknown-host.example.com"
431
+ - export _ALL_ENV_VAR_KEYS="[\\"ENV_SHORT\\",\\"APP_DIR\\",\\"ENV_TYPE\\",\\"BUILD_INFO_BUILD_ID\\",\\"BUILD_INFO_BUILD_TIME\\",\\"BUILD_INFO_CURRENT_VERSION\\",\\"HOSTNAME\\",\\"ROOT_URL\\",\\"HOSTNAME_INTERNAL\\",\\"ROOT_URL_INTERNAL\\"]"
432
+ - collapseable_section_end "injectvars"
433
+ - collapseable_section_start "write-dotenv-api" "write dot env for api"
434
+ - |-
435
+ cat <<EOF > api/.env
436
+ ENV_SHORT=stage
437
+ APP_DIR=api
438
+ ENV_TYPE=stage
439
+ HOSTNAME=unknown-host.example.com
440
+ ROOT_URL=https://unknown-host.example.com
441
+ HOSTNAME_INTERNAL=unknown-host.example.com
442
+ ROOT_URL_INTERNAL=https://unknown-host.example.com
443
+ _ALL_ENV_VAR_KEYS=["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_BUILD_ID","BUILD_INFO_BUILD_TIME","BUILD_INFO_CURRENT_VERSION","HOSTNAME","ROOT_URL","HOSTNAME_INTERNAL","ROOT_URL_INTERNAL"]
444
+ EOF
445
+ - collapseable_section_end "write-dotenv-api"
446
+ - echo '{"id":"$(git describe --tags 2>/dev/null || git rev-parse HEAD)","time":"$CI_JOB_STARTED_AT"}' > api/__build_info.json
447
+ - collapseable_section_start "nodeinstall" "Ensure node version"
448
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
449
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
450
+ - collapseable_section_end "nodeinstall"
451
+ - cd api
452
+ - collapseable_section_start "nodeinstall" "Ensure node version"
453
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
454
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
455
+ - collapseable_section_end "nodeinstall"
456
+ - collapseable_section_start "yarninstall" "Yarn install"
457
+ - yarn install --immutable
458
+ - collapseable_section_end "yarninstall"
459
+ - yarn build
460
+ cache:
461
+ - key: api-yarn
462
+ policy: pull-push
463
+ paths:
464
+ - api/.yarn
465
+ - key: api-node-modules
466
+ policy: pull-push
467
+ paths:
468
+ - api/node_modules
469
+ artifacts:
470
+ paths:
471
+ - api/__build_info.json
472
+ - api/.next
473
+ - api/dist
474
+ exclude:
475
+ - api/.env
476
+ expire_in: 1 day
477
+ when: always
478
+ reports: {}
479
+ rules:
480
+ - when: never
481
+ if: $CI_PIPELINE_SOURCE == "trigger"
482
+ - if: $CI_COMMIT_TAG
483
+ needs: []
484
+ retry: *a1
485
+ interruptible: true
486
+ 'api ๐Ÿงพ sbom | stage ':
487
+ stage: build
488
+ image:
489
+ name: aquasec/trivy:0.58.2
490
+ entrypoint:
491
+ - ''
492
+ variables: {}
493
+ script:
494
+ - collapseable_section_start "injectvars" "Injecting variables"
495
+ - collapseable_section_end "injectvars"
496
+ - trivy fs --quiet --format cyclonedx --output "__sbom.json" api
497
+ artifacts:
498
+ paths:
499
+ - __sbom.json
500
+ rules:
501
+ - when: never
502
+ if: $CI_PIPELINE_SOURCE == "trigger"
503
+ - if: $CI_COMMIT_TAG
504
+ needs: []
505
+ retry: *a1
506
+ interruptible: true
507
+ allow_failure: true
508
+ 'api ๐Ÿ”จ app | prod ':
509
+ stage: build
510
+ image: path/to/docker/jobs-default:the-version
511
+ variables:
512
+ KUBERNETES_CPU_REQUEST: '0.45'
513
+ KUBERNETES_MEMORY_REQUEST: 1Gi
514
+ KUBERNETES_MEMORY_LIMIT: 4Gi
515
+ script:
516
+ - collapseable_section_start "injectvars" "Injecting variables"
517
+ - export ENV_SHORT="prod"
518
+ - export APP_DIR="api"
519
+ - export ENV_TYPE="prod"
520
+ - export BUILD_INFO_BUILD_ID="$(git describe --tags 2>/dev/null || git rev-parse HEAD)"
521
+ - export BUILD_INFO_BUILD_TIME="$CI_JOB_STARTED_AT"
522
+ - export BUILD_INFO_CURRENT_VERSION="$(tag=$(git ls-remote origin "refs/tags/v*[0-9]" 2>/dev/null | cut -f 2- | sort -V | tail -1 | sed 's/refs\\/tags\\/v//'); [ -z "$tag" ] && echo "0.0.0" || echo "$tag")"
523
+ - export HOSTNAME="unknown-host.example.com"
524
+ - export ROOT_URL="https://unknown-host.example.com"
525
+ - export HOSTNAME_INTERNAL="unknown-host.example.com"
526
+ - export ROOT_URL_INTERNAL="https://unknown-host.example.com"
527
+ - export _ALL_ENV_VAR_KEYS="[\\"ENV_SHORT\\",\\"APP_DIR\\",\\"ENV_TYPE\\",\\"BUILD_INFO_BUILD_ID\\",\\"BUILD_INFO_BUILD_TIME\\",\\"BUILD_INFO_CURRENT_VERSION\\",\\"HOSTNAME\\",\\"ROOT_URL\\",\\"HOSTNAME_INTERNAL\\",\\"ROOT_URL_INTERNAL\\"]"
528
+ - collapseable_section_end "injectvars"
529
+ - collapseable_section_start "write-dotenv-api" "write dot env for api"
530
+ - |-
531
+ cat <<EOF > api/.env
532
+ ENV_SHORT=prod
533
+ APP_DIR=api
534
+ ENV_TYPE=prod
535
+ HOSTNAME=unknown-host.example.com
536
+ ROOT_URL=https://unknown-host.example.com
537
+ HOSTNAME_INTERNAL=unknown-host.example.com
538
+ ROOT_URL_INTERNAL=https://unknown-host.example.com
539
+ _ALL_ENV_VAR_KEYS=["ENV_SHORT","APP_DIR","ENV_TYPE","BUILD_INFO_BUILD_ID","BUILD_INFO_BUILD_TIME","BUILD_INFO_CURRENT_VERSION","HOSTNAME","ROOT_URL","HOSTNAME_INTERNAL","ROOT_URL_INTERNAL"]
540
+ EOF
541
+ - collapseable_section_end "write-dotenv-api"
542
+ - echo '{"id":"$(git describe --tags 2>/dev/null || git rev-parse HEAD)","time":"$CI_JOB_STARTED_AT"}' > api/__build_info.json
543
+ - collapseable_section_start "nodeinstall" "Ensure node version"
544
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
545
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
546
+ - collapseable_section_end "nodeinstall"
547
+ - cd api
548
+ - collapseable_section_start "nodeinstall" "Ensure node version"
549
+ - if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi
550
+ - if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi
551
+ - collapseable_section_end "nodeinstall"
552
+ - collapseable_section_start "yarninstall" "Yarn install"
553
+ - yarn install --immutable
554
+ - collapseable_section_end "yarninstall"
555
+ - yarn build
556
+ cache:
557
+ - key: api-yarn
558
+ policy: pull-push
559
+ paths:
560
+ - api/.yarn
561
+ - key: api-node-modules
562
+ policy: pull-push
563
+ paths:
564
+ - api/node_modules
565
+ artifacts:
566
+ paths:
567
+ - api/__build_info.json
568
+ - api/.next
569
+ - api/dist
570
+ exclude:
571
+ - api/.env
572
+ expire_in: 1 day
573
+ when: always
574
+ reports: {}
575
+ rules:
576
+ - when: never
577
+ if: $CI_PIPELINE_SOURCE == "trigger"
578
+ - if: $CI_COMMIT_TAG
579
+ needs: []
580
+ retry: *a1
581
+ interruptible: true
582
+ 'api ๐Ÿงพ sbom | prod ':
583
+ stage: build
584
+ image:
585
+ name: aquasec/trivy:0.58.2
586
+ entrypoint:
587
+ - ''
588
+ variables: {}
589
+ script:
590
+ - collapseable_section_start "injectvars" "Injecting variables"
591
+ - collapseable_section_end "injectvars"
592
+ - trivy fs --quiet --format cyclonedx --output "__sbom.json" api
593
+ artifacts:
594
+ paths:
595
+ - __sbom.json
596
+ rules:
597
+ - when: never
598
+ if: $CI_PIPELINE_SOURCE == "trigger"
599
+ - if: $CI_COMMIT_TAG
600
+ needs: []
601
+ retry: *a1
602
+ interruptible: true
603
+ allow_failure: true
604
+ create release:
605
+ stage: release
606
+ image: path/to/docker/semantic-release:the-version
607
+ script:
608
+ - semanticRelease
609
+ - echo '๐Ÿ‘‰ The project access token might be invald - run \`project-renew-token\` in catladder CLI to fix.'
610
+ rules:
611
+ - &a2
612
+ if: $CI_COMMIT_MESSAGE =~ /^chore\\(release\\).*/
613
+ when: never
614
+ - &a3
615
+ if: $CI_PIPELINE_SOURCE == "trigger"
616
+ when: never
617
+ - &a4
618
+ if: $CI_PIPELINE_SOURCE == "schedule"
619
+ when: never
620
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH && $AUTO_RELEASE == "true"
621
+ when: on_success
622
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
623
+ when: manual
624
+ - if: $CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/
625
+ when: manual
626
+ โš ๏ธ force create release:
627
+ stage: release
628
+ image: path/to/docker/semantic-release:the-version
629
+ script:
630
+ - semanticRelease
631
+ - echo '๐Ÿ‘‰ The project access token might be invald - run \`project-renew-token\` in catladder CLI to fix.'
632
+ rules:
633
+ - *a2
634
+ - *a3
635
+ - *a4
636
+ - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
637
+ when: manual
638
+ - if: $CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/
639
+ when: manual
640
+ needs: []
641
+ "
642
+ `;
@@ -0,0 +1,11 @@
1
+ import { createYamlLocalPipeline } from "./__utils__/helpers";
2
+ import config from "./modify-generated-files";
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 modify-generated-files local pipeline YAML", async () => {
10
+ expect(await createYamlLocalPipeline(config)).toMatchSnapshot();
11
+ });
@@ -0,0 +1,29 @@
1
+ import type { Config } from "../src";
2
+
3
+ const config = {
4
+ appName: "test-app",
5
+ customerName: "pan",
6
+ components: {
7
+ api: {
8
+ dir: "api",
9
+ build: {
10
+ type: "node",
11
+ },
12
+ deploy: false,
13
+ },
14
+ },
15
+ hooks: {
16
+ transformFileBeforeWrite({ filename, content }) {
17
+ if (filename === ".gitlab-ci.yml") {
18
+ // FIXME: currently not covered by the snapshot test
19
+ return "# modified!\n\n" + content;
20
+ }
21
+ },
22
+ },
23
+ } satisfies Config;
24
+
25
+ export default config;
26
+
27
+ export const information = {
28
+ title: "Custom: Modify Generated Files",
29
+ };
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "3.17.1",
56
+ "version": "3.19.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",