@catladder/pipeline 0.0.0-remove-env-mode-none-9b62fbb1 → 0.0.0-remove-sbom-91cda0a4
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/build/artifacts/createBuildJobArtifact.js +7 -4
- package/dist/build/base/index.js +2 -4
- package/dist/build/custom/testJob.js +13 -11
- package/dist/build/docker.d.ts +1 -1
- package/dist/build/docker.js +16 -4
- package/dist/build/node/cache.js +6 -3
- package/dist/build/node/testJob.js +13 -11
- package/dist/build/node/yarn.d.ts +2 -1
- package/dist/build/node/yarn.js +8 -3
- package/dist/build/rails/index.js +2 -2
- package/dist/build/types.d.ts +25 -11
- package/dist/config/readConfig.js +30 -1
- package/dist/constants.js +1 -1
- package/dist/context/getEnvironmentVariables.d.ts +4 -4
- package/dist/context/getEnvironmentVariables.js +15 -10
- package/dist/defaults/index.js +1 -2
- package/dist/deploy/base/deploy.js +8 -10
- package/dist/deploy/base/stop.js +0 -5
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +1 -0
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +33 -34
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -3
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +2 -3
- package/dist/deploy/custom/deployJob.js +2 -3
- package/dist/deploy/kubernetes/deployJob.js +2 -3
- package/dist/deploy/kubernetes/mongodb.d.ts +4 -0
- package/dist/deploy/kubernetes/mongodb.js +4 -0
- package/dist/deploy/types/executeBase.d.ts +24 -0
- package/dist/deploy/types/executeBase.js +5 -0
- package/dist/deploy/types/googleCloudRun.d.ts +13 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +2 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.js +5 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +5 -1
- package/dist/utils/measureTime.d.ts +6 -0
- package/dist/utils/measureTime.js +49 -0
- package/examples/__snapshots__/automatic-releases.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +1505 -0
- package/examples/__snapshots__/cloud-run-existing-image.test.ts.snap +657 -0
- package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +5 -14
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +21 -134
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +1489 -0
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +29 -138
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +101 -414
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +69 -278
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +37 -142
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +37 -142
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +5 -126
- package/examples/__snapshots__/custom-build-job.test.ts.snap +5 -126
- package/examples/__snapshots__/custom-deploy.test.ts.snap +37 -130
- package/examples/__snapshots__/custom-docker-file.test.ts.snap +1525 -0
- package/examples/__snapshots__/custom-envs.test.ts.snap +33 -152
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +5 -14
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +37 -142
- package/examples/__snapshots__/git-submodule.test.ts.snap +37 -142
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +37 -142
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +37 -142
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +69 -278
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +57 -142
- package/examples/__snapshots__/local-dot-env.test.ts.snap +37 -142
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +41 -134
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +21 -102
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +21 -102
- package/examples/__snapshots__/multiline-var.test.ts.snap +101 -414
- package/examples/__snapshots__/native-app.test.ts.snap +53 -254
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +37 -142
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +37 -142
- package/examples/__snapshots__/override-secrets.test.ts.snap +37 -142
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +5 -126
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +5 -126
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +101 -414
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +37 -230
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +53 -270
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +45 -270
- package/examples/automatic-releases.test.ts +1 -0
- package/examples/cloud-run-execute-script-on-deploy.test.ts +12 -0
- package/examples/cloud-run-execute-script-on-deploy.ts +47 -0
- package/examples/cloud-run-existing-image.test.ts +12 -0
- package/examples/cloud-run-existing-image.ts +26 -0
- package/examples/cloud-run-health-check-defaults.test.ts +1 -0
- package/examples/cloud-run-health-check-only-startup.test.ts +1 -0
- package/examples/cloud-run-health-check.test.ts +1 -0
- package/examples/cloud-run-http2.test.ts +1 -0
- package/examples/cloud-run-llama.test.ts +1 -0
- package/examples/cloud-run-memory-limit.test.ts +1 -0
- package/examples/cloud-run-meteor-with-worker.test.ts +1 -0
- package/examples/cloud-run-nextjs.test.ts +1 -0
- package/examples/cloud-run-no-cpu-throttling.test.ts +1 -0
- package/examples/cloud-run-no-service.test.ts +1 -0
- package/examples/cloud-run-non-public.test.ts +1 -0
- package/examples/cloud-run-post-stop-job.test.ts +1 -0
- package/examples/cloud-run-post-stop-job.ts +1 -1
- package/examples/cloud-run-service-custom-vpc-connector.test.ts +1 -0
- package/examples/cloud-run-service-custom-vpc.test.ts +1 -0
- package/examples/cloud-run-service-gen2.test.ts +1 -0
- package/examples/cloud-run-service-increase-timout.test.ts +1 -0
- package/examples/cloud-run-service-with-volumes.test.ts +1 -0
- package/examples/cloud-run-session-affinity.test.ts +12 -0
- package/examples/cloud-run-session-affinity.ts +29 -0
- package/examples/cloud-run-storybook.test.ts +1 -0
- package/examples/cloud-run-with-agents.test.ts +1 -0
- package/examples/cloud-run-with-gpu.test.ts +1 -0
- package/examples/cloud-run-with-ngnix.test.ts +1 -0
- package/examples/cloud-run-with-sql-legacy-jobs.test.ts +1 -0
- package/examples/cloud-run-with-sql-multiple-dbs.test.ts +1 -0
- package/examples/cloud-run-with-sql-reuse-db.test.ts +1 -0
- package/examples/cloud-run-with-sql.test.ts +1 -0
- package/examples/cloud-run-with-worker.test.ts +1 -0
- package/examples/custom-build-job-with-tests.test.ts +1 -0
- package/examples/custom-build-job.test.ts +1 -0
- package/examples/custom-deploy.test.ts +1 -0
- package/examples/{custom-sbom-java.test.ts → custom-docker-file.test.ts} +3 -2
- package/examples/custom-docker-file.ts +36 -0
- package/examples/custom-envs.test.ts +1 -0
- package/examples/custom-verify-job.test.ts +1 -0
- package/examples/git-submodule.test.ts +1 -0
- package/examples/kubernetes-application-customization.test.ts +1 -0
- package/examples/kubernetes-with-cloud-sql.test.ts +1 -0
- package/examples/kubernetes-with-jobs.test.ts +1 -0
- package/examples/kubernetes-with-mongodb.test.ts +1 -0
- package/examples/local-dot-env.test.ts +1 -0
- package/examples/meteor-kubernetes.test.ts +1 -0
- package/examples/modify-generated-files.test.ts +1 -0
- package/examples/modify-generated-yaml.test.ts +1 -0
- package/examples/multiline-var.test.ts +1 -0
- package/examples/native-app.test.ts +1 -0
- package/examples/node-build-with-custom-image.test.ts +1 -0
- package/examples/node-build-with-docker-additions.test.ts +1 -0
- package/examples/override-secrets.test.ts +1 -0
- package/examples/rails-k8s-with-worker.test.ts +1 -0
- package/examples/referencing-other-vars.test.ts +1 -0
- package/examples/wait-for-other-deploy.test.ts +1 -0
- package/examples/workspace-api-www-turbo-cache.test.ts +1 -0
- package/examples/workspace-api-www.test.ts +1 -0
- package/examples/workspace-api-www.ts +3 -0
- package/package.json +2 -4
- package/scripts/generate-examples-test.ts +1 -0
- package/src/build/artifacts/createBuildJobArtifact.ts +7 -2
- package/src/build/base/__tests__/__snapshots__/createArtifactsConfig.test.ts.snap +4 -4
- package/src/build/base/__tests__/createArtifactsConfig.test.ts +1 -0
- package/src/build/base/index.ts +0 -4
- package/src/build/custom/__tests__/testJob.test.ts +1 -0
- package/src/build/custom/testJob.ts +12 -1
- package/src/build/docker.ts +26 -6
- package/src/build/node/cache.ts +16 -1
- package/src/build/node/testJob.ts +12 -2
- package/src/build/node/yarn.ts +25 -5
- package/src/build/rails/index.ts +1 -1
- package/src/build/types.ts +27 -14
- package/src/config/__tests__/__snapshots__/getAllEnvs.test.ts.snap +4 -4
- package/src/config/__tests__/__snapshots__/getAllEnvsInAllComponents.test.ts.snap +2 -2
- package/src/config/__tests__/configruedEnvs.test.ts +1 -0
- package/src/config/__tests__/getAllEnvs.test.ts +1 -0
- package/src/config/__tests__/getAllEnvsInAllComponents.test.ts +1 -0
- package/src/config/readConfig.ts +22 -1
- package/src/context/getEnvironmentVariables.ts +15 -14
- package/src/defaults/index.ts +0 -1
- package/src/deploy/base/deploy.ts +37 -37
- package/src/deploy/base/stop.ts +0 -6
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +1 -0
- package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +45 -47
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +0 -2
- package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +0 -2
- package/src/deploy/custom/deployJob.ts +2 -9
- package/src/deploy/kubernetes/deployJob.ts +3 -10
- package/src/deploy/kubernetes/mongodb.ts +4 -0
- package/src/deploy/types/base.ts +1 -0
- package/src/deploy/types/executeBase.ts +27 -0
- package/src/deploy/types/googleCloudRun.ts +17 -3
- package/src/index.ts +1 -0
- package/src/pipeline/__tests__/__snapshots__/getPipelineStages.test.ts.snap +2 -2
- package/src/pipeline/__tests__/getPipelineStages.test.ts +1 -0
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +5 -3
- package/src/types/config.ts +5 -1
- package/src/utils/measureTime.ts +43 -0
- package/src/variables/__tests__/resolveAllReferences.test.ts +1 -0
- package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +1 -0
- package/src/variables/__tests__/resolveReferencesOnce.test.ts +1 -0
- package/src/variables/__tests__/variableValue.test.ts +1 -0
- package/tsconfig.json +2 -1
- package/dist/build/base/__tests__/createArtifactsConfig.test.d.ts +0 -1
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +0 -42
- package/dist/build/custom/__tests__/testJob.test.d.ts +0 -1
- package/dist/build/custom/__tests__/testJob.test.js +0 -36
- package/dist/build/sbom.d.ts +0 -5
- package/dist/build/sbom.js +0 -35
- package/dist/config/__tests__/configruedEnvs.test.d.ts +0 -1
- package/dist/config/__tests__/configruedEnvs.test.js +0 -112
- package/dist/config/__tests__/getAllEnvs.test.d.ts +0 -1
- package/dist/config/__tests__/getAllEnvs.test.js +0 -79
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.d.ts +0 -1
- package/dist/config/__tests__/getAllEnvsInAllComponents.test.js +0 -73
- package/dist/deploy/sbom.d.ts +0 -4
- package/dist/deploy/sbom.js +0 -21
- package/dist/pipeline/__tests__/getPipelineStages.test.d.ts +0 -1
- package/dist/pipeline/__tests__/getPipelineStages.test.js +0 -73
- package/dist/variables/__tests__/resolveAllReferences.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveAllReferences.test.js +0 -218
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +0 -171
- package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +0 -1
- package/dist/variables/__tests__/resolveReferencesOnce.test.js +0 -199
- package/dist/variables/__tests__/variableValue.test.d.ts +0 -1
- package/dist/variables/__tests__/variableValue.test.js +0 -36
- package/examples/custom-sbom-java.ts +0 -38
- package/src/build/sbom.ts +0 -53
- package/src/deploy/sbom.ts +0 -34
- /package/dist/build/rails/{test.d.ts → testJob.d.ts} +0 -0
- /package/dist/build/rails/{test.js → testJob.js} +0 -0
- /package/src/build/rails/{test.ts → testJob.ts} +0 -0
|
@@ -49,6 +49,11 @@ var path_1 = require("path");
|
|
|
49
49
|
var types_1 = require("../../types");
|
|
50
50
|
var lodash_1 = require("lodash");
|
|
51
51
|
var writeDotEnv_1 = require("../base/writeDotEnv");
|
|
52
|
+
var uniqueAndAlphabeticalSort = function (arr) {
|
|
53
|
+
return (0, lodash_1.uniq)(arr).sort(function (a, b) {
|
|
54
|
+
return a.localeCompare(b);
|
|
55
|
+
});
|
|
56
|
+
};
|
|
52
57
|
var createBuildJobArtifacts = function (context) {
|
|
53
58
|
var _a, _b;
|
|
54
59
|
var paths = context.type === "workspace" ? context.components.flatMap(function (c) {
|
|
@@ -58,11 +63,9 @@ var createBuildJobArtifacts = function (context) {
|
|
|
58
63
|
return getAllArtifactExcludePathsForComponent(c);
|
|
59
64
|
}) : getAllArtifactExcludePathsForComponent(context);
|
|
60
65
|
return __assign(__assign({
|
|
61
|
-
paths: (
|
|
62
|
-
return a.localeCompare(b);
|
|
63
|
-
})
|
|
66
|
+
paths: uniqueAndAlphabeticalSort(paths)
|
|
64
67
|
}, exclude.length > 0 ? {
|
|
65
|
-
exclude: exclude
|
|
68
|
+
exclude: uniqueAndAlphabeticalSort(exclude)
|
|
66
69
|
} : {}), {
|
|
67
70
|
expire_in: "1 day",
|
|
68
71
|
when: "always",
|
package/dist/build/base/index.js
CHANGED
|
@@ -45,21 +45,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
45
45
|
value: true
|
|
46
46
|
});
|
|
47
47
|
exports.createWorkspaceBuildJobs = exports.createComponentBuildJobs = void 0;
|
|
48
|
-
var sbom_1 = require("../../deploy/sbom");
|
|
49
48
|
var context_1 = require("../../types/context");
|
|
50
49
|
var docker_1 = require("../docker");
|
|
51
|
-
var sbom_2 = require("../sbom");
|
|
52
50
|
var constants_1 = require("./constants");
|
|
53
51
|
var createAppBuildJob_1 = require("./createAppBuildJob");
|
|
54
52
|
var createComponentBuildJobs = function (context, definitions) {
|
|
55
53
|
var _a;
|
|
56
|
-
return __spreadArray(__spreadArray(
|
|
54
|
+
return __spreadArray(__spreadArray([], __read(definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context) ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)] : []), false), __read((0, docker_1.requiresDockerBuild)(context) ? [(0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), {
|
|
57
55
|
needs: __spreadArray(__spreadArray([], __read((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : []), false), __read(definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context) ? [constants_1.APP_BUILD_JOB_NAME] : (0, context_1.componentContextHasWorkspaceBuild)(context) ? [{
|
|
58
56
|
job: constants_1.APP_BUILD_JOB_NAME,
|
|
59
57
|
artifacts: true,
|
|
60
58
|
workspaceName: context.build.workspaceName
|
|
61
59
|
}] : []), false)
|
|
62
|
-
}))] : []), false)
|
|
60
|
+
}))] : []), false);
|
|
63
61
|
};
|
|
64
62
|
exports.createComponentBuildJobs = createComponentBuildJobs;
|
|
65
63
|
var createWorkspaceBuildJobs = function (context, definitions) {
|
|
@@ -55,7 +55,7 @@ var RUNNER_CUSTOM_TEST_VARIABLES = {
|
|
|
55
55
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
56
56
|
};
|
|
57
57
|
var createCustomTestJobs = function (context) {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
59
59
|
// don't run tests after release
|
|
60
60
|
// TODO: this will be replaced by using rules
|
|
61
61
|
if (context.trigger === "taggedRelease") {
|
|
@@ -69,7 +69,6 @@ var createCustomTestJobs = function (context) {
|
|
|
69
69
|
variables: __assign({
|
|
70
70
|
APP_PATH: context.build.dir
|
|
71
71
|
}, context.environment.jobOnlyVars.build.envVars),
|
|
72
|
-
runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
|
|
73
72
|
services: buildConfig.jobServices,
|
|
74
73
|
cache: (0, createJobCache_1.createJobCacheFromConfig)(context, buildConfig),
|
|
75
74
|
stage: "test",
|
|
@@ -78,23 +77,26 @@ var createCustomTestJobs = function (context) {
|
|
|
78
77
|
var auditJob = buildConfig.audit ? __assign(__assign(__assign({
|
|
79
78
|
name: "🛡 audit"
|
|
80
79
|
}, base), {
|
|
81
|
-
|
|
80
|
+
runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
|
|
81
|
+
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : buildConfig.jobImage,
|
|
82
82
|
cache: undefined,
|
|
83
|
-
script: __spreadArray([], __read((0, utils_1.ensureArray)((
|
|
83
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)), false),
|
|
84
84
|
allow_failure: true
|
|
85
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
85
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
86
86
|
var lintJob = buildConfig.lint ? __assign(__assign(__assign({
|
|
87
87
|
name: "👮 lint"
|
|
88
88
|
}, base), {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.runnerVariables) !== null && _j !== void 0 ? _j : {}),
|
|
90
|
+
image: (_l = (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.jobImage) !== null && _l !== void 0 ? _l : buildConfig.jobImage,
|
|
91
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)), false)
|
|
92
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
|
|
92
93
|
var testJob = buildConfig.test ? __assign(__assign(__assign({
|
|
93
94
|
name: "🧪 test"
|
|
94
95
|
}, base), {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.runnerVariables) !== null && _r !== void 0 ? _r : {}),
|
|
97
|
+
image: (_t = (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.jobImage) !== null && _t !== void 0 ? _t : buildConfig.jobImage,
|
|
98
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.command)), false)
|
|
99
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifactsReports, (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.artifacts)) : null;
|
|
98
100
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
99
101
|
};
|
|
100
102
|
exports.createCustomTestJobs = createCustomTestJobs;
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -64,6 +64,6 @@ export declare const createDockerBuildJobBase: (context: ComponentContextWithBui
|
|
|
64
64
|
...def
|
|
65
65
|
}: DockerBuildJobDefinition) => CatladderJob;
|
|
66
66
|
export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
|
|
67
|
-
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild,
|
|
67
|
+
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild, fallbackType?: BuildConfigDocker["type"]) => (string | undefined)[];
|
|
68
68
|
export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
|
|
69
69
|
export declare const hasDockerfile: (context: ComponentContext) => boolean;
|
package/dist/build/docker.js
CHANGED
|
@@ -168,10 +168,22 @@ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
|
168
168
|
nginx: "ensureNginxDockerfile",
|
|
169
169
|
custom: null
|
|
170
170
|
};
|
|
171
|
-
var
|
|
172
|
-
var _a;
|
|
173
|
-
|
|
174
|
-
|
|
171
|
+
var getEnsureDockerFileScript = function (context, fallbackType) {
|
|
172
|
+
var _a, _b, _c, _d, _e, _f;
|
|
173
|
+
if ("docker" in context.build.config && context.build.config.docker && "type" in context.build.config.docker) {
|
|
174
|
+
if (((_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type) === "custom") {
|
|
175
|
+
if ((_b = context.build.config.docker) === null || _b === void 0 ? void 0 : _b.dockerfileContent) {
|
|
176
|
+
// we need to create a script that creates a Dockerfile in the current directory
|
|
177
|
+
return "\necho \"Creating Dockerfile\"\ncat >$APP_DIR/Dockerfile <<EOF\n".concat((_d = (_c = context.build.config.docker) === null || _c === void 0 ? void 0 : _c.dockerfileContent) === null || _d === void 0 ? void 0 : _d.join("\n"), "\nEOF");
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var type = (_f = (_e = context.build.config.docker) === null || _e === void 0 ? void 0 : _e.type) !== null && _f !== void 0 ? _f : fallbackType;
|
|
181
|
+
return type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null;
|
|
182
|
+
}
|
|
183
|
+
return fallbackType ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[fallbackType] : null;
|
|
184
|
+
};
|
|
185
|
+
var getDockerBuildScriptWithBuiltInDockerFile = function (context, fallbackType) {
|
|
186
|
+
return (0, exports.getDockerBuildDefaultScript)(context, getEnsureDockerFileScript(context, fallbackType));
|
|
175
187
|
};
|
|
176
188
|
exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
|
|
177
189
|
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
package/dist/build/node/cache.js
CHANGED
|
@@ -58,11 +58,12 @@ var getYarnCache = function (context, policy) {
|
|
|
58
58
|
};
|
|
59
59
|
exports.getYarnCache = getYarnCache;
|
|
60
60
|
var getNodeModulesCache = function (context, policy) {
|
|
61
|
-
var _a;
|
|
61
|
+
var _a, _b;
|
|
62
62
|
if (policy === void 0) {
|
|
63
63
|
policy = "pull-push";
|
|
64
64
|
}
|
|
65
65
|
var componentIsInWorkspace = context.type === "component" && context.packageManagerInfo.componentIsInWorkspace;
|
|
66
|
+
var isClassic = context.packageManagerInfo.isClassic;
|
|
66
67
|
// We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
|
|
67
68
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
68
69
|
return [{
|
|
@@ -72,9 +73,11 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
72
73
|
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.build.dir) + "-node-modules",
|
|
73
74
|
// we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
74
75
|
policy: policy,
|
|
75
|
-
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
|
|
76
|
+
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(__spreadArray(["node_modules"], __read((_a = context.packageManagerInfo.workspaces.map(function (w) {
|
|
76
77
|
return (0, path_1.join)(w.location, "node_modules");
|
|
77
|
-
})) !== null && _a !== void 0 ? _a : []), false)
|
|
78
|
+
})) !== null && _a !== void 0 ? _a : []), false), __read(!isClassic ? __spreadArray([".yarn/install-state.gz"], __read((_b = context.packageManagerInfo.workspaces.map(function (w) {
|
|
79
|
+
return (0, path_1.join)(w.location, ".yarn/install-state.gz");
|
|
80
|
+
})) !== null && _b !== void 0 ? _b : []), false) : []), false)) : __spreadArray([(0, path_1.join)(context.build.dir, "node_modules")], __read(!isClassic ? [(0, path_1.join)(context.build.dir, ".yarn/install-state.gz")] : []), false)), false)
|
|
78
81
|
}];
|
|
79
82
|
};
|
|
80
83
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
@@ -54,7 +54,7 @@ var constants_1 = require("./constants");
|
|
|
54
54
|
var yarn_1 = require("./yarn");
|
|
55
55
|
var createJobCache_1 = require("../cache/createJobCache");
|
|
56
56
|
var createNodeTestJobs = function (context) {
|
|
57
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
|
57
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z;
|
|
58
58
|
// don't run tests after release
|
|
59
59
|
// TODO: this will be replaced by using rules
|
|
60
60
|
if (context.trigger === "taggedRelease") {
|
|
@@ -69,7 +69,6 @@ var createNodeTestJobs = function (context) {
|
|
|
69
69
|
variables: __assign({
|
|
70
70
|
APP_PATH: context.build.dir
|
|
71
71
|
}, context.type === "component" ? __assign({}, context.environment.jobOnlyVars.build.envVars) : {}),
|
|
72
|
-
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
73
72
|
stage: "test",
|
|
74
73
|
needs: []
|
|
75
74
|
};
|
|
@@ -78,26 +77,29 @@ var createNodeTestJobs = function (context) {
|
|
|
78
77
|
var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
|
|
79
78
|
name: "🛡 audit"
|
|
80
79
|
}, base), {
|
|
81
|
-
|
|
80
|
+
runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.runnerVariables) !== null && _b !== void 0 ? _b : {}),
|
|
81
|
+
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
82
82
|
cache: undefined,
|
|
83
|
-
script: __spreadArray(["cd ".concat(context.build.dir)], __read((
|
|
83
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
|
|
84
84
|
]), false),
|
|
85
85
|
allow_failure: true
|
|
86
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
86
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
|
|
87
87
|
var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
|
|
88
88
|
name: "👮 lint"
|
|
89
89
|
}, base), {
|
|
90
|
-
|
|
90
|
+
runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.runnerVariables) !== null && _k !== void 0 ? _k : {}),
|
|
91
|
+
image: (_m = (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
|
|
91
92
|
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
92
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((
|
|
93
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
93
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_p = (0, utils_1.ensureArrayOrNull)((_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.command)) !== null && _p !== void 0 ? _p : ["yarn lint"]), false)
|
|
94
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.artifactsReports, (_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.artifacts)) : null;
|
|
94
95
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
95
96
|
name: "🧪 test"
|
|
96
97
|
}, base), {
|
|
97
|
-
|
|
98
|
+
runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_t = (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.runnerVariables) !== null && _t !== void 0 ? _t : {}),
|
|
99
|
+
image: (_v = (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.jobImage) !== null && _v !== void 0 ? _v : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
98
100
|
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
99
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((
|
|
100
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
101
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_x = (0, utils_1.ensureArrayOrNull)((_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.command)) !== null && _x !== void 0 ? _x : ["yarn test"]), false)
|
|
102
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.artifactsReports, (_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.artifacts)) : null;
|
|
101
103
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
102
104
|
};
|
|
103
105
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { BashExpression } from "../../bash/BashExpression";
|
|
2
|
+
import type { ComponentContextWithBuild } from "../../types";
|
|
2
3
|
import { type Context } from "../../types";
|
|
3
4
|
export declare const ensureNodeVersion: (context: Context) => string[];
|
|
4
5
|
export declare const getYarnInstall: (context: Context, options?: {
|
|
5
6
|
noCustomPostInstall: boolean;
|
|
6
7
|
}) => string[];
|
|
7
|
-
export declare const getDockerAppCopyAndBuildScript: (context:
|
|
8
|
+
export declare const getDockerAppCopyAndBuildScript: (context: ComponentContextWithBuild) => BashExpression;
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -39,13 +39,15 @@ var BashExpression_1 = require("../../bash/BashExpression");
|
|
|
39
39
|
var utils_1 = require("../../utils");
|
|
40
40
|
var gitlab_1 = require("../../utils/gitlab");
|
|
41
41
|
var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
|
|
42
|
+
var YARN_BERRY_PROD_INSTALL = "yarn workspaces focus --production";
|
|
42
43
|
// FIXME: check why and when rebuild is needed
|
|
43
|
-
var YARN_BERRY_PROD_REBUILD = "yarn
|
|
44
|
+
var YARN_BERRY_PROD_REBUILD = "yarn rebuild";
|
|
44
45
|
var getYarnInstallCommand = function (context) {
|
|
45
46
|
if (context.packageManagerInfo.isClassic) {
|
|
46
47
|
return YARN_INSTALL_CLASSIC;
|
|
47
48
|
}
|
|
48
|
-
|
|
49
|
+
// inline builds make debugging easier as it prints it out in the logs, instead of writing it in temp files
|
|
50
|
+
return "yarn install --immutable --inline-builds";
|
|
49
51
|
};
|
|
50
52
|
var ensureNodeVersion = function (context) {
|
|
51
53
|
return (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")(["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"]);
|
|
@@ -58,9 +60,12 @@ var getYarnInstall = function (context, options) {
|
|
|
58
60
|
exports.getYarnInstall = getYarnInstall;
|
|
59
61
|
var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
|
|
60
62
|
var getDockerAppCopyAndBuildScript = function (context) {
|
|
63
|
+
var _a, _b, _c;
|
|
61
64
|
if (context.packageManagerInfo.isClassic) {
|
|
62
65
|
return new BashExpression_1.BashExpression("\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim());
|
|
63
66
|
}
|
|
67
|
+
var yarnRebuildEnabledDefault = context.build.type === "fromWorkspace" ? (_b = (_a = context.build.workspaceBuildConfig.dockerDefaults) === null || _a === void 0 ? void 0 : _a.yarnRebuildEnabled) !== null && _b !== void 0 ? _b : true : true;
|
|
68
|
+
var yarnRebuildEnabled = "docker" in context.build.config && context.build.config.docker && "yarnRebuildEnabled" in context.build.config.docker ? (_c = context.build.config.docker.yarnRebuildEnabled) !== null && _c !== void 0 ? _c : yarnRebuildEnabledDefault : yarnRebuildEnabledDefault;
|
|
64
69
|
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
65
70
|
// trying to import those fail on this version
|
|
66
71
|
var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
|
|
@@ -69,6 +74,6 @@ var getDockerAppCopyAndBuildScript = function (context) {
|
|
|
69
74
|
var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
|
|
70
75
|
// copy first everything and then install
|
|
71
76
|
// rebuild first does not work as it will run postinstall and that might require files in the app
|
|
72
|
-
return new BashExpression_1.BashExpression("\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_REBUILD, "\n\n ").trim());
|
|
77
|
+
return new BashExpression_1.BashExpression("\n ENV YARN_ENABLE_INLINE_BUILDS=1\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_INSTALL, "\n").concat(yarnRebuildEnabled ? "RUN ".concat(YARN_BERRY_PROD_REBUILD) : "", "\n\n ").trim());
|
|
73
78
|
};
|
|
74
79
|
exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
|
|
@@ -36,8 +36,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
36
36
|
});
|
|
37
37
|
exports.createRailsJobs = void 0;
|
|
38
38
|
var build_1 = require("./build");
|
|
39
|
-
var
|
|
39
|
+
var testJob_1 = require("./testJob");
|
|
40
40
|
var createRailsJobs = function (context) {
|
|
41
|
-
return __spreadArray(__spreadArray([], __read((0,
|
|
41
|
+
return __spreadArray(__spreadArray([], __read((0, testJob_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
|
|
42
42
|
};
|
|
43
43
|
exports.createRailsJobs = createRailsJobs;
|
package/dist/build/types.d.ts
CHANGED
|
@@ -62,6 +62,10 @@ export type TestJobCustom = {
|
|
|
62
62
|
* {@link TestJobCustom.artifacts}.reports.junit is merged with {@link TestJobCustom.artifactsReports} in case both given.
|
|
63
63
|
*/
|
|
64
64
|
artifacts?: Artifacts;
|
|
65
|
+
/**
|
|
66
|
+
* additional vars for this job runner
|
|
67
|
+
*/
|
|
68
|
+
runnerVariables?: Record<string, string>;
|
|
65
69
|
};
|
|
66
70
|
export type BuildConfigBase = {
|
|
67
71
|
/**
|
|
@@ -168,6 +172,12 @@ type BuildConfigDockerWithAdditions = {
|
|
|
168
172
|
};
|
|
169
173
|
type BuildConfigDockerBuiltInNode = {
|
|
170
174
|
type: "node";
|
|
175
|
+
/**
|
|
176
|
+
* whether to run yarn rebuild after yarn install. Defaults to true.
|
|
177
|
+
*
|
|
178
|
+
* Future versions of catladder will default to false.
|
|
179
|
+
*/
|
|
180
|
+
yarnRebuildEnabled?: boolean;
|
|
171
181
|
} & BuildConfigDockerWithAdditions;
|
|
172
182
|
type BuildConfigDockerBuiltInMeteor = {
|
|
173
183
|
type: "meteor";
|
|
@@ -190,6 +200,15 @@ type BuildConfigDockerCustom = {
|
|
|
190
200
|
* Depending on your Dockerfile you may want to change it to "component"
|
|
191
201
|
*/
|
|
192
202
|
buildContextLocation?: "root" | "component";
|
|
203
|
+
/**
|
|
204
|
+
* EXPERIMENTAL: custom docker file content
|
|
205
|
+
*
|
|
206
|
+
* you can use some predefined variables:
|
|
207
|
+
* - $DOCKER_COPY_WORKSPACE_FILES
|
|
208
|
+
* - $DOCKER_COPY_AND_INSTALL_APP
|
|
209
|
+
* - and all default variables
|
|
210
|
+
*/
|
|
211
|
+
dockerfileContent?: string[];
|
|
193
212
|
};
|
|
194
213
|
export type BuildConfigDocker = BuildConfigDockerBuiltIn | BuildConfigDockerCustom;
|
|
195
214
|
export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit"> & {
|
|
@@ -212,16 +231,6 @@ export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit">
|
|
|
212
231
|
* custom audit, disabled when not set
|
|
213
232
|
*/
|
|
214
233
|
audit?: TestJobCustom;
|
|
215
|
-
/**
|
|
216
|
-
* custom sbom (software bill of materials), set false to disable
|
|
217
|
-
*/
|
|
218
|
-
sbom?: false | {
|
|
219
|
-
/**
|
|
220
|
-
* needs to create a file at `/__sbom.json` in CycloneDX format
|
|
221
|
-
*/
|
|
222
|
-
command: string | string[];
|
|
223
|
-
jobImage: GitlabJobImage;
|
|
224
|
-
};
|
|
225
234
|
};
|
|
226
235
|
export type BuildConfigRails = BuildConfigBase & {
|
|
227
236
|
type: "rails";
|
|
@@ -323,7 +332,7 @@ export type WorkspaceBuildConfigBase = {
|
|
|
323
332
|
*/
|
|
324
333
|
audit?: false | TestJobCustom;
|
|
325
334
|
/**
|
|
326
|
-
* additional vars only for the
|
|
335
|
+
* additional vars only for the build job.
|
|
327
336
|
* Also if you use services: that require env vars, you need to set them here.
|
|
328
337
|
*
|
|
329
338
|
*/
|
|
@@ -342,6 +351,11 @@ export type WorkspaceBuildConfigBase = {
|
|
|
342
351
|
export type WorkspaceBuildConfigNode = {
|
|
343
352
|
type: "node";
|
|
344
353
|
buildCommand?: string | string[];
|
|
354
|
+
/**
|
|
355
|
+
* set docker config defaults for the node build type.
|
|
356
|
+
* Currently not all options are supported.
|
|
357
|
+
*/
|
|
358
|
+
dockerDefaults?: Pick<BuildConfigDockerBuiltInNode, "yarnRebuildEnabled">;
|
|
345
359
|
} & WorkspaceBuildConfigBase;
|
|
346
360
|
export type WorkspaceBuildConfig = WorkspaceBuildConfigNode;
|
|
347
361
|
export {};
|
|
@@ -151,13 +151,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
151
151
|
});
|
|
152
152
|
exports.readConfig = void 0;
|
|
153
153
|
var fs_1 = require("fs");
|
|
154
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
154
155
|
var tsx = require("tsx/cjs/api");
|
|
155
156
|
var yaml_1 = require("yaml");
|
|
156
157
|
// allows us to load ts files
|
|
157
158
|
var fullPath = function (directory, ext) {
|
|
158
159
|
return directory + "/catladder." + ext;
|
|
159
160
|
};
|
|
160
|
-
var
|
|
161
|
+
var readConfigInternal = function () {
|
|
161
162
|
var args_1 = [];
|
|
162
163
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
163
164
|
args_1[_i] = arguments[_i];
|
|
@@ -199,4 +200,32 @@ var readConfig = function () {
|
|
|
199
200
|
});
|
|
200
201
|
});
|
|
201
202
|
};
|
|
203
|
+
var readConfig = function () {
|
|
204
|
+
var args_1 = [];
|
|
205
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
206
|
+
args_1[_i] = arguments[_i];
|
|
207
|
+
}
|
|
208
|
+
return __awaiter(void 0, __spreadArray([], __read(args_1), false), void 0, function (directory) {
|
|
209
|
+
var error_1;
|
|
210
|
+
if (directory === void 0) {
|
|
211
|
+
directory = process.cwd();
|
|
212
|
+
}
|
|
213
|
+
return __generator(this, function (_a) {
|
|
214
|
+
switch (_a.label) {
|
|
215
|
+
case 0:
|
|
216
|
+
_a.trys.push([0, 2,, 3]);
|
|
217
|
+
return [4 /*yield*/, readConfigInternal(directory)];
|
|
218
|
+
case 1:
|
|
219
|
+
return [2 /*return*/, _a.sent()];
|
|
220
|
+
case 2:
|
|
221
|
+
error_1 = _a.sent();
|
|
222
|
+
console.error("Error reading config in ".concat(directory, ":"), error_1);
|
|
223
|
+
console.error("\nThis may happen due to various reasons:\n - Syntax errors in your catladder.ts file\n - tsx (the TypeScript loader used by catladder) needs to understand the syntax in your project.\n If your project uses newer TypeScript/JavaScript syntax, you may need to update catladder\n to get a newer version of tsx that supports it.\n - Missing or incorrect dependencies in your project\n - TypeScript configuration issues in your tsconfig.json\n");
|
|
224
|
+
return [2 /*return*/, null];
|
|
225
|
+
case 3:
|
|
226
|
+
return [2 /*return*/];
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
};
|
|
202
231
|
exports.readConfig = readConfig;
|
package/dist/constants.js
CHANGED
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
7
|
-
exports.PIPELINE_IMAGE_TAG = "remove-
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "remove-sbom-91cda0a4" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -13,10 +13,10 @@ declare const getBasePredefinedVariables: (ctx: EnvironmentContext) => {
|
|
|
13
13
|
};
|
|
14
14
|
type BasePredefinedVariables = ReturnType<typeof getBasePredefinedVariables>;
|
|
15
15
|
export type PredefinedVariables = BasePredefinedVariables & {
|
|
16
|
-
HOSTNAME
|
|
17
|
-
ROOT_URL
|
|
18
|
-
HOSTNAME_INTERNAL
|
|
19
|
-
ROOT_URL_INTERNAL
|
|
16
|
+
HOSTNAME?: StringOrBashExpression;
|
|
17
|
+
ROOT_URL?: StringOrBashExpression;
|
|
18
|
+
HOSTNAME_INTERNAL?: StringOrBashExpression;
|
|
19
|
+
ROOT_URL_INTERNAL?: StringOrBashExpression;
|
|
20
20
|
};
|
|
21
21
|
export declare const getEnvironmentVariables: (ctx: CreateComponentContextContext, options?: {
|
|
22
22
|
shouldResolveReferences?: boolean;
|
|
@@ -197,17 +197,22 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
197
197
|
basePredefinedVariables = getBasePredefinedVariables(environmentContext);
|
|
198
198
|
if (envType === "local") {
|
|
199
199
|
devLocalConfig = envConfigRaw;
|
|
200
|
-
port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
|
|
201
|
-
host = "localhost:" + port.toString();
|
|
202
|
-
url = "http://" + host;
|
|
203
|
-
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
204
|
-
ENV_SHORT: "local"
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
200
|
+
port = devLocalConfig.port !== false ? (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000 : null;
|
|
201
|
+
host = port ? "localhost:" + port.toString() : null;
|
|
202
|
+
url = host ? "http://" + host : null;
|
|
203
|
+
predefinedVariables = __assign(__assign(__assign(__assign(__assign(__assign(__assign({}, basePredefinedVariables), {
|
|
204
|
+
ENV_SHORT: "local"
|
|
205
|
+
}), url ? {
|
|
206
|
+
ROOT_URL: url
|
|
207
|
+
} : {}), host ? {
|
|
208
|
+
HOSTNAME: host
|
|
209
|
+
} : {}), host ? {
|
|
210
|
+
HOSTNAME_INTERNAL: host
|
|
211
|
+
} : {}), host ? {
|
|
212
|
+
ROOT_URL_INTERNAL: "http://" + host
|
|
213
|
+
} : {}), port ? {
|
|
209
214
|
PORT: port.toString()
|
|
210
|
-
});
|
|
215
|
+
} : {});
|
|
211
216
|
} else {
|
|
212
217
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
213
218
|
HOSTNAME_INTERNAL = (_e = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
|
package/dist/defaults/index.js
CHANGED
|
@@ -47,9 +47,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
47
47
|
exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
|
|
48
48
|
var createJobCache_1 = require("../../build/cache/createJobCache");
|
|
49
49
|
var docker_1 = require("../../build/docker");
|
|
50
|
-
var sbom_1 = require("../../build/sbom");
|
|
51
50
|
var context_1 = require("../../types/context");
|
|
52
|
-
var sbom_2 = require("../sbom");
|
|
53
51
|
var utils_1 = require("../utils");
|
|
54
52
|
var stop_1 = require("./stop");
|
|
55
53
|
var variables_1 = require("./variables");
|
|
@@ -76,18 +74,16 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
76
74
|
services: jobDefinition.services,
|
|
77
75
|
envMode: "stagePerEnv",
|
|
78
76
|
// makes it easier to run manual tasks er env
|
|
79
|
-
needs: __spreadArray(
|
|
80
|
-
job: sbom_1.SBOM_BUILD_JOB_NAME,
|
|
81
|
-
artifacts: true
|
|
82
|
-
}]), false), __read(deployConfig ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) {
|
|
77
|
+
needs: __spreadArray([], __read(deployConfig ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) {
|
|
83
78
|
return {
|
|
84
79
|
componentName: c,
|
|
85
80
|
job: exports.DEPLOY_JOB_NAME,
|
|
86
81
|
artifacts: false
|
|
87
82
|
};
|
|
88
83
|
})) !== null && _d !== void 0 ? _d : [] : []), false),
|
|
89
|
-
|
|
90
|
-
|
|
84
|
+
needsStages:
|
|
85
|
+
// if the build is disabled, we don't need to wait for it
|
|
86
|
+
context.build.type !== "disabled" ? __spreadArray(__spreadArray([], __read((0, context_1.componentContextHasWorkspaceBuild)(context) ? hasDocker // docker build is per component,
|
|
91
87
|
? [
|
|
92
88
|
// we don't need artifacts, but have to wait for the component build
|
|
93
89
|
{
|
|
@@ -101,12 +97,14 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
101
97
|
}] : [{
|
|
102
98
|
stage: "build",
|
|
103
99
|
artifacts: hasDocker ? false : true // we asume that no-docker deployments need build artifacts,
|
|
104
|
-
}]), false), [
|
|
100
|
+
}]), false), [
|
|
101
|
+
// we don't want to deploy when there is a broken test
|
|
102
|
+
{
|
|
105
103
|
stage: "test",
|
|
106
104
|
artifacts: false,
|
|
107
105
|
// use test from workspace build
|
|
108
106
|
workspaceName: (0, context_1.componentContextHasWorkspaceBuild)(context) ? context.build.workspaceName : undefined
|
|
109
|
-
}], false),
|
|
107
|
+
}], false) : [],
|
|
110
108
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
111
109
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
112
110
|
stage: "deploy",
|
package/dist/deploy/base/stop.js
CHANGED
|
@@ -27,11 +27,6 @@ var createStopJob = function (context, jobDefinition) {
|
|
|
27
27
|
allow_failure: true,
|
|
28
28
|
when: "manual",
|
|
29
29
|
// stop is always manual
|
|
30
|
-
rules: [{
|
|
31
|
-
if: "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
|
|
32
|
-
// automatic on hotfix branches
|
|
33
|
-
when: "on_success"
|
|
34
|
-
}],
|
|
35
30
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
|
|
36
31
|
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), {
|
|
37
32
|
GIT_STRATEGY: "none"
|
|
@@ -84,6 +84,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
|
|
|
84
84
|
"use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
|
|
85
85
|
"allow-unauthenticated": (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _e !== void 0 ? _e : true,
|
|
86
86
|
ingress: (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _f !== void 0 ? _f : "all",
|
|
87
|
+
"session-affinity": customConfig === null || customConfig === void 0 ? void 0 : customConfig.sessionAffinity,
|
|
87
88
|
"cpu-boost": true,
|
|
88
89
|
"execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
|
|
89
90
|
gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
|