@catladder/pipeline 2.2.4 → 2.3.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 (52) hide show
  1. package/dist/constants.js +1 -1
  2. package/dist/deploy/base/deploy.js +1 -1
  3. package/dist/deploy/sbom.js +3 -2
  4. package/dist/pipeline/gitlab/createGitlabJobs.js +6 -4
  5. package/dist/tsconfig.tsbuildinfo +1 -1
  6. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +16 -20
  7. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +16 -20
  8. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +16 -20
  9. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +16 -20
  10. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +16 -20
  11. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +16 -20
  12. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +16 -20
  13. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +16 -20
  14. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +16 -20
  15. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +16 -20
  16. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +16 -20
  17. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +16 -20
  18. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +16 -20
  19. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +16 -20
  20. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +16 -20
  21. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +32 -40
  22. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +16 -20
  23. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +16 -20
  24. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +16 -20
  25. package/examples/__snapshots__/custom-build-job.test.ts.snap +16 -20
  26. package/examples/__snapshots__/custom-deploy.test.ts.snap +11 -113
  27. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +16 -20
  28. package/examples/__snapshots__/custom-verify-job.test.ts.snap +1632 -0
  29. package/examples/__snapshots__/git-submodule.test.ts.snap +16 -20
  30. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +20 -28
  31. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +20 -28
  32. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +40 -56
  33. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +20 -28
  34. package/examples/__snapshots__/local-dot-env.test.ts.snap +16 -20
  35. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +20 -28
  36. package/examples/__snapshots__/multiline-var.test.ts.snap +52 -68
  37. package/examples/__snapshots__/native-app.test.ts.snap +48 -24
  38. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +16 -20
  39. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +16 -20
  40. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +20 -28
  41. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +20 -28
  42. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +52 -68
  43. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +64 -8
  44. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +32 -40
  45. package/examples/__snapshots__/workspace-api-www.test.ts.snap +32 -40
  46. package/examples/custom-deploy.ts +8 -1
  47. package/examples/custom-verify-job.test.ts +11 -0
  48. package/examples/custom-verify-job.ts +64 -0
  49. package/package.json +1 -1
  50. package/src/deploy/base/deploy.ts +1 -1
  51. package/src/deploy/sbom.ts +3 -2
  52. package/src/pipeline/gitlab/createGitlabJobs.ts +6 -2
@@ -0,0 +1,64 @@
1
+ import type { Config } from "../src";
2
+
3
+ const config: Config = {
4
+ appName: "test-app",
5
+ customerName: "pan",
6
+ components: {
7
+ www: {
8
+ dir: "www",
9
+ build: {
10
+ type: "node",
11
+ },
12
+ deploy: {
13
+ type: "google-cloudrun",
14
+ projectId: "asdf",
15
+ region: "asia-east1",
16
+ },
17
+ env: {
18
+ review: {
19
+ deploy: {
20
+ script: ['ROOT_URL="$(my deploy command)"'],
21
+ },
22
+ },
23
+ },
24
+ customJobs: [
25
+ {
26
+ name: `e2e`,
27
+ stage: "verify",
28
+ needsStages: [{ stage: "deploy" }],
29
+ envMode: "jobPerEnv",
30
+ cache: {
31
+ key: "cypress",
32
+ policy: "pull-push",
33
+ paths: [".yarn/cache", "node_modules/", "cache/cypress"],
34
+ },
35
+ image: "cypress/browsers",
36
+ script: [
37
+ "yarn install --frozen-lockfile",
38
+ `CYPRESS_BASE_URL=$CI_ENVIRONMENT_URL yarn cypress:run:ci`,
39
+ ],
40
+ environment: {
41
+ action: "access",
42
+ },
43
+ variables: {
44
+ CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/cypress",
45
+ },
46
+ artifacts: {
47
+ expire_in: "1 week",
48
+ when: "always",
49
+ reports: {
50
+ junit: [`cypress/results/report-*.xml`],
51
+ },
52
+ paths: [`cypress/results`, `cypress/screenshots`, `cypress/videos`],
53
+ },
54
+ },
55
+ ],
56
+ },
57
+ },
58
+ };
59
+
60
+ export default config;
61
+
62
+ export const information = {
63
+ title: "Cloud Run: Job",
64
+ };
package/package.json CHANGED
@@ -53,7 +53,7 @@
53
53
  }
54
54
  ],
55
55
  "license": "MIT",
56
- "version": "2.2.4",
56
+ "version": "2.3.0",
57
57
  "scripts": {
58
58
  "build:tsc": "yarn tsc",
59
59
  "build": "yarn build:compile && yarn build:inline-variables",
@@ -124,7 +124,7 @@ export const createDeployJob = (
124
124
  on_stop: STOP_JOB_NAME,
125
125
  auto_stop_in: autoStop,
126
126
  }
127
- : undefined,
127
+ : {},
128
128
  jobTags: deployConfig ? deployConfig.jobTags : undefined,
129
129
  };
130
130
  };
@@ -1,3 +1,4 @@
1
+ import { getBashVariable } from "../bash/BashExpression";
1
2
  import { SBOM_FILE } from "../build/sbom";
2
3
  import {
3
4
  componentContextIsStandaloneBuild,
@@ -16,7 +17,7 @@ export const getDependencyTrackUploadScript = (
16
17
  ? []
17
18
  : [
18
19
  "echo 'Uploading SBOM to Dependency Track'",
19
- `/dtrackuploader https://dep.panter.swiss/ "$DT_KEY_PROD" upload "${context.fullConfig.customerName}-${context.fullConfig.appName}/${context.name}" "${context.environment.envVars.ROOT_URL}" "${SBOM_FILE}" vex.json || true`,
20
+ `/dtrackuploader https://dep.panter.swiss/ "$DT_KEY_PROD" upload "${context.fullConfig.customerName}-${context.fullConfig.appName}/${context.name}" "${getBashVariable("ROOT_URL")}" "${SBOM_FILE}" vex.json || true`,
20
21
  ];
21
22
  };
22
23
 
@@ -27,6 +28,6 @@ export const getDependencyTrackDeleteScript = (
27
28
  ? []
28
29
  : [
29
30
  "echo 'Disabling component in Dependency Track'",
30
- `/dtrackuploader https://dep.panter.swiss/ "$DT_KEY_PROD" disable "${context.fullConfig.customerName}-${context.fullConfig.appName}/${context.name}" "${context.environment.envVars.ROOT_URL}" || true`,
31
+ `/dtrackuploader https://dep.panter.swiss/ "$DT_KEY_PROD" disable "${context.fullConfig.customerName}-${context.fullConfig.appName}/${context.name}" "${getBashVariable("CI_ENVIRONMENT_URL")}" || true`,
31
32
  ];
32
33
  };
@@ -13,6 +13,7 @@ import { notNil } from "../../utils";
13
13
  import { collapseableSection } from "../../utils/gitlab";
14
14
  import { removeUndefined } from "../../utils/removeUndefined";
15
15
  import type { AllCatladderJobs } from "../createAllJobs";
16
+ import { getBashVariable } from "../../bash/BashExpression";
16
17
 
17
18
  export type GitlabJobWithContext = {
18
19
  gitlabJob: GitlabJobDef;
@@ -229,7 +230,7 @@ const addGitlabEnvironment = (
229
230
  const dotEnvFile = "gitlab_environment.env";
230
231
 
231
232
  const scriptToAdd = [
232
- `echo "${GITLAB_ENVIRONMENT_URL_VARIABLE}=${envVars.ROOT_URL}" >> ${dotEnvFile}`,
233
+ `echo "${GITLAB_ENVIRONMENT_URL_VARIABLE}=${getBashVariable("ROOT_URL")}" >> ${dotEnvFile}`,
233
234
  ];
234
235
 
235
236
  // this is NOT a bashVariable since it NEEDS to be used as a string in gitlab
@@ -242,7 +243,10 @@ const addGitlabEnvironment = (
242
243
  ...job,
243
244
  environment: {
244
245
  name: gitlabEnvironmentName,
245
- url: `$${GITLAB_ENVIRONMENT_URL_VARIABLE}`,
246
+ ...(!catladderJobEnvironment.action ||
247
+ catladderJobEnvironment.action === "start"
248
+ ? { url: `$${GITLAB_ENVIRONMENT_URL_VARIABLE}` }
249
+ : {}),
246
250
  ...(on_stop
247
251
  ? {
248
252
  on_stop: getFullReferencedJobNameFromComponent(