@catladder/pipeline 2.2.4 → 2.4.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.
- package/dist/constants.js +1 -1
- package/dist/deploy/base/deploy.js +1 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +7 -4
- package/dist/deploy/sbom.js +3 -2
- package/dist/deploy/types/googleCloudRun.d.ts +6 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +6 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +16 -20
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +32 -40
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +20 -24
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +16 -20
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +16 -20
- package/examples/__snapshots__/custom-build-job.test.ts.snap +16 -20
- package/examples/__snapshots__/custom-deploy.test.ts.snap +11 -113
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +16 -20
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +1632 -0
- package/examples/__snapshots__/git-submodule.test.ts.snap +16 -20
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +20 -28
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +20 -28
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +40 -56
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +20 -28
- package/examples/__snapshots__/local-dot-env.test.ts.snap +16 -20
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +20 -28
- package/examples/__snapshots__/multiline-var.test.ts.snap +52 -68
- package/examples/__snapshots__/native-app.test.ts.snap +48 -24
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +16 -20
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +16 -20
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +20 -28
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +20 -28
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +52 -68
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +64 -8
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +32 -40
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +32 -40
- package/examples/cloud-run-with-sql.ts +2 -1
- package/examples/custom-deploy.ts +8 -1
- package/examples/custom-verify-job.test.ts +11 -0
- package/examples/custom-verify-job.ts +64 -0
- package/package.json +1 -1
- package/src/deploy/base/deploy.ts +1 -1
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +11 -8
- package/src/deploy/sbom.ts +3 -2
- package/src/deploy/types/googleCloudRun.ts +6 -0
- 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
|
@@ -69,16 +69,19 @@ export const getJobRunScripts = (
|
|
|
69
69
|
when: DeployConfigCloudRunJob["when"],
|
|
70
70
|
) => {
|
|
71
71
|
const jobsWithNames = getCloudRunJobsWithNames(context);
|
|
72
|
+
|
|
72
73
|
return jobsWithNames
|
|
73
74
|
.filter(({ job }) => job.when === when)
|
|
74
|
-
.map(({ jobName }) =>
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
75
|
+
.map(({ jobName, job }) => {
|
|
76
|
+
// always wait for completion for preStop and postStop jobs
|
|
77
|
+
// since stop will delete the jobs afterwards, so they will fail
|
|
78
|
+
const waitForCompletion = ["preStop", "postStop"].includes(when)
|
|
79
|
+
? true
|
|
80
|
+
: "waitForCompletion" in job
|
|
81
|
+
? (job.waitForCompletion ?? false)
|
|
82
|
+
: false;
|
|
83
|
+
return getJobRunScriptForJob(context, jobName, waitForCompletion);
|
|
84
|
+
});
|
|
82
85
|
};
|
|
83
86
|
|
|
84
87
|
export const getJobCreateScripts = (context: ComponentContext): string[] =>
|
package/src/deploy/sbom.ts
CHANGED
|
@@ -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}" "${
|
|
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}" "${
|
|
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
|
};
|
|
@@ -241,6 +241,12 @@ export type DeployConfigCloudRunJobWithSchedule =
|
|
|
241
241
|
|
|
242
242
|
export type DeployConfigCloudRunJobNormal = DeployConfigCloudRunJobBase & {
|
|
243
243
|
when: "manual" | "preDeploy" | "postDeploy" | "preStop" | "postStop";
|
|
244
|
+
/**
|
|
245
|
+
* wait for completion of the job on preDeploy and postDeploy
|
|
246
|
+
*
|
|
247
|
+
* has no effect on preStop and postStop (which always wait for completion)
|
|
248
|
+
*/
|
|
249
|
+
waitForCompletion?: boolean;
|
|
244
250
|
};
|
|
245
251
|
|
|
246
252
|
export type DeployConfigCloudRunWithVolumes = {
|
|
@@ -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}=${
|
|
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
|
-
|
|
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(
|