@catladder/pipeline 0.0.0-new-release-a895e12e โ 0.0.0-new-cli-80ac360a
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 +20 -9
- package/dist/build/base/createBuildJobDefinition.js +1 -1
- package/dist/build/base/index.js +2 -4
- package/dist/build/custom/buildJob.js +1 -1
- package/dist/build/custom/testJob.js +17 -14
- package/dist/build/docker.d.ts +1 -1
- package/dist/build/docker.js +16 -4
- package/dist/build/index.js +2 -1
- package/dist/build/node/cache.js +6 -3
- package/dist/build/node/meteor.js +15 -3
- package/dist/build/node/testJob.js +17 -14
- package/dist/build/node/yarn.d.ts +2 -1
- package/dist/build/node/yarn.js +8 -3
- package/dist/build/rails/build.js +1 -1
- package/dist/build/rails/index.js +2 -2
- package/dist/build/rails/{test.js โ testJob.js} +10 -9
- package/dist/build/types.d.ts +42 -13
- 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/cloudRunWorkerPools.d.ts +4 -0
- package/dist/deploy/cloudRun/createJobs/cloudRunWorkerPools.js +92 -0
- package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +33 -34
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +14 -4
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +12 -3
- package/dist/deploy/cloudRun/createJobs/volumes.d.ts +1 -1
- 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 +58 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/pipeline/agent/createAgentReviewJob.js +1 -0
- package/dist/pipeline/agent/shared.d.ts +1 -1
- package/dist/pipeline/agent/shared.js +0 -1
- package/dist/pipeline/createMainPipeline.js +1 -0
- package/dist/pipeline/gitlab/cache.d.ts +9 -0
- package/dist/pipeline/gitlab/cache.js +47 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +7 -7
- package/dist/pipeline/gitlab/createGitlabPipeline.js +2 -2
- 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/types/hooks.d.ts +15 -6
- package/dist/types/jobs.d.ts +2 -3
- package/dist/utils/measureTime.d.ts +6 -0
- package/dist/utils/measureTime.js +49 -0
- package/dist/utils/writeFiles.d.ts +2 -0
- package/dist/utils/writeFiles.js +74 -15
- package/examples/__snapshots__/automatic-releases.test.ts.snap +169 -164
- 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 +169 -164
- package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-llama.test.ts.snap +7 -16
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +157 -176
- package/examples/__snapshots__/cloud-run-n8n.test.ts.snap +940 -0
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +172 -165
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +1489 -0
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +44 -143
- package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +172 -165
- package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +493 -476
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +331 -320
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +169 -164
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +175 -170
- package/examples/__snapshots__/cloud-run-worker-pool.test.ts.snap +1495 -0
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +100 -150
- package/examples/__snapshots__/custom-build-job.test.ts.snap +7 -128
- package/examples/__snapshots__/custom-deploy.test.ts.snap +169 -152
- package/examples/__snapshots__/custom-docker-file.test.ts.snap +1525 -0
- package/examples/__snapshots__/custom-envs.test.ts.snap +324 -149
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +7 -16
- package/examples/__snapshots__/custom-verify-job.test.ts.snap +172 -165
- package/examples/__snapshots__/git-submodule.test.ts.snap +169 -164
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +173 -164
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +173 -164
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +335 -320
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +193 -164
- package/examples/__snapshots__/local-dot-env.test.ts.snap +173 -164
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +169 -168
- package/examples/__snapshots__/modify-generated-files.test.ts.snap +134 -107
- package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +667 -0
- package/examples/__snapshots__/multiline-var.test.ts.snap +493 -476
- package/examples/__snapshots__/native-app.test.ts.snap +318 -295
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +169 -164
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +169 -164
- package/examples/__snapshots__/override-secrets.test.ts.snap +169 -164
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +91 -150
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +95 -150
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +493 -476
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +293 -270
- package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +201 -300
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +193 -300
- 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-meteor-with-worker.ts +4 -5
- package/examples/{custom-sbom-java.test.ts โ cloud-run-n8n.test.ts} +3 -2
- package/examples/cloud-run-n8n.ts +62 -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/cloud-run-with-worker.ts +5 -6
- package/examples/cloud-run-worker-pool.test.ts +12 -0
- package/examples/cloud-run-worker-pool.ts +42 -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-docker-file.test.ts +12 -0
- 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 +12 -0
- package/examples/modify-generated-yaml.ts +43 -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 +42 -9
- 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/createBuildJobDefinition.ts +2 -1
- package/src/build/base/index.ts +0 -4
- package/src/build/custom/__tests__/testJob.test.ts +71 -0
- package/src/build/custom/buildJob.ts +1 -1
- package/src/build/custom/testJob.ts +15 -3
- package/src/build/docker.ts +26 -6
- package/src/build/index.ts +1 -0
- package/src/build/node/cache.ts +16 -1
- package/src/build/node/meteor.ts +38 -6
- package/src/build/node/testJob.ts +17 -6
- package/src/build/node/yarn.ts +25 -5
- package/src/build/rails/build.ts +1 -0
- package/src/build/rails/index.ts +1 -1
- package/src/build/rails/{test.ts โ testJob.ts} +3 -2
- package/src/build/types.ts +46 -16
- 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/cloudRunWorkerPools.ts +75 -0
- package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +45 -47
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +14 -3
- package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +4 -2
- package/src/deploy/cloudRun/createJobs/volumes.ts +1 -1
- 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 +72 -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/agent/createAgentReviewJob.ts +1 -0
- package/src/pipeline/agent/shared.ts +2 -2
- package/src/pipeline/createMainPipeline.ts +1 -0
- package/src/pipeline/gitlab/cache.ts +49 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +7 -9
- package/src/pipeline/gitlab/createGitlabPipeline.ts +2 -2
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +5 -3
- package/src/types/config.ts +5 -1
- package/src/types/hooks.ts +18 -6
- package/src/types/jobs.ts +2 -3
- package/src/utils/measureTime.ts +43 -0
- package/src/utils/writeFiles.ts +20 -6
- 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
|
@@ -49,21 +49,23 @@ 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) {
|
|
55
60
|
return getArtifactsPathForComponent(c);
|
|
56
61
|
}) : getArtifactsPathForComponent(context, ["__build_info.json"]);
|
|
57
|
-
// esxclude .env files if generated
|
|
58
62
|
var exclude = context.type === "workspace" ? context.components.flatMap(function (c) {
|
|
59
|
-
return
|
|
60
|
-
}) :
|
|
63
|
+
return getAllArtifactExcludePathsForComponent(c);
|
|
64
|
+
}) : getAllArtifactExcludePathsForComponent(context);
|
|
61
65
|
return __assign(__assign({
|
|
62
|
-
paths: (
|
|
63
|
-
return a.localeCompare(b);
|
|
64
|
-
})
|
|
66
|
+
paths: uniqueAndAlphabeticalSort(paths)
|
|
65
67
|
}, exclude.length > 0 ? {
|
|
66
|
-
exclude: exclude
|
|
68
|
+
exclude: uniqueAndAlphabeticalSort(exclude)
|
|
67
69
|
} : {}), {
|
|
68
70
|
expire_in: "1 day",
|
|
69
71
|
when: "always",
|
|
@@ -77,9 +79,9 @@ var createBuildJobArtifacts = function (context) {
|
|
|
77
79
|
});
|
|
78
80
|
};
|
|
79
81
|
exports.createBuildJobArtifacts = createBuildJobArtifacts;
|
|
80
|
-
var
|
|
82
|
+
var _getArtifactPathsForComponent = function (c, configKey, additionalPaths) {
|
|
81
83
|
var _a, _b;
|
|
82
|
-
return (_b = __spreadArray(__spreadArray([], __read(c.build.type !== "disabled" ? (_a = c.build.config
|
|
84
|
+
return (_b = __spreadArray(__spreadArray([], __read(c.build.type !== "disabled" ? (_a = c.build.config[configKey]) !== null && _a !== void 0 ? _a : [] : []), false), __read(additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : []), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
|
|
83
85
|
return c.build
|
|
84
86
|
// in theory, we only need "direct",
|
|
85
87
|
// but in some cases project may have packages in the workspace that create build artifacts, which aren't components
|
|
@@ -89,6 +91,15 @@ var getArtifactsPathForComponent = function (c, additionalPaths) {
|
|
|
89
91
|
});
|
|
90
92
|
});
|
|
91
93
|
};
|
|
94
|
+
var getArtifactsPathForComponent = function (c, additionalPaths) {
|
|
95
|
+
return _getArtifactPathsForComponent(c, "artifactsPaths", additionalPaths);
|
|
96
|
+
};
|
|
97
|
+
var getAllArtifactExcludePathsForComponent = function (c) {
|
|
98
|
+
return __spreadArray(__spreadArray([], __read(getDotEnvPathsForComponent(c)), false), __read(getArtifactExcludePathsForComponent(c)), false);
|
|
99
|
+
};
|
|
100
|
+
var getArtifactExcludePathsForComponent = function (c, additionalPaths) {
|
|
101
|
+
return _getArtifactPathsForComponent(c, "artifactsExcludePaths", additionalPaths);
|
|
102
|
+
};
|
|
92
103
|
var getDotEnvPathsForComponent = function (c) {
|
|
93
104
|
if ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c)) {
|
|
94
105
|
return [(0, path_1.join)(c.build.dir, ".env")];
|
|
@@ -44,7 +44,7 @@ var createBuildJobDefinition = function (context, buildConfig, customize) {
|
|
|
44
44
|
if (customize === void 0) {
|
|
45
45
|
customize = {};
|
|
46
46
|
}
|
|
47
|
-
if (buildConfig.buildCommand === null) return undefined;
|
|
47
|
+
if (buildConfig.buildCommand === null || buildConfig.buildCommand === false) return undefined;
|
|
48
48
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
49
49
|
return {
|
|
50
50
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
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) {
|
|
@@ -14,7 +14,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
14
14
|
throw new Error("deploy config is not custom");
|
|
15
15
|
}
|
|
16
16
|
return (0, base_1.createComponentBuildJobs)(context, {
|
|
17
|
-
appBuild: buildConfig.buildCommand !== null ? (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig) : undefined,
|
|
17
|
+
appBuild: buildConfig.buildCommand !== null && buildConfig.buildCommand !== false ? (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig) : undefined,
|
|
18
18
|
dockerBuild: {
|
|
19
19
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
|
|
20
20
|
variables: {}
|
|
@@ -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, _x, _y, _z, _0;
|
|
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,33 +69,36 @@ 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",
|
|
76
|
-
needs: []
|
|
77
|
-
envMode: "none"
|
|
75
|
+
needs: []
|
|
78
76
|
};
|
|
79
77
|
var auditJob = buildConfig.audit ? __assign(__assign(__assign({
|
|
80
78
|
name: "๐ก audit"
|
|
81
79
|
}, base), {
|
|
82
|
-
|
|
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,
|
|
83
82
|
cache: undefined,
|
|
84
|
-
script: __spreadArray([], __read((0, utils_1.ensureArray)((
|
|
85
|
-
allow_failure: true
|
|
86
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
83
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)), false),
|
|
84
|
+
allow_failure: (_g = (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.allowFailure) !== null && _g !== void 0 ? _g : true
|
|
85
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifactsReports, (_j = buildConfig.audit) === null || _j === void 0 ? void 0 : _j.artifacts)) : null;
|
|
87
86
|
var lintJob = buildConfig.lint ? __assign(__assign(__assign({
|
|
88
87
|
name: "๐ฎ lint"
|
|
89
88
|
}, base), {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_l = (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.runnerVariables) !== null && _l !== void 0 ? _l : {}),
|
|
90
|
+
image: (_o = (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage,
|
|
91
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.command)), false),
|
|
92
|
+
allow_failure: (_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.allowFailure
|
|
93
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_r = buildConfig.lint) === null || _r === void 0 ? void 0 : _r.artifactsReports, (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.artifacts)) : null;
|
|
93
94
|
var testJob = buildConfig.test ? __assign(__assign(__assign({
|
|
94
95
|
name: "๐งช test"
|
|
95
96
|
}, base), {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
runnerVariables: __assign(__assign({}, RUNNER_CUSTOM_TEST_VARIABLES), (_u = (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.runnerVariables) !== null && _u !== void 0 ? _u : {}),
|
|
98
|
+
image: (_w = (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.jobImage) !== null && _w !== void 0 ? _w : buildConfig.jobImage,
|
|
99
|
+
script: __spreadArray([], __read((0, utils_1.ensureArray)((_x = buildConfig.test) === null || _x === void 0 ? void 0 : _x.command)), false),
|
|
100
|
+
allow_failure: (_y = buildConfig.test) === null || _y === void 0 ? void 0 : _y.allowFailure
|
|
101
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.artifactsReports, (_0 = buildConfig.test) === null || _0 === void 0 ? void 0 : _0.artifacts)) : null;
|
|
99
102
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
100
103
|
};
|
|
101
104
|
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/index.js
CHANGED
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;
|
|
@@ -35,6 +35,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
35
35
|
value: true
|
|
36
36
|
});
|
|
37
37
|
exports.createMeteorBuildJobs = void 0;
|
|
38
|
+
var BashExpression_1 = require("../../bash/BashExpression");
|
|
38
39
|
var runner_1 = require("../../runner");
|
|
39
40
|
var base_1 = require("../base");
|
|
40
41
|
var docker_1 = require("../docker");
|
|
@@ -48,6 +49,17 @@ var getMeteorCache = function (context) {
|
|
|
48
49
|
paths: [".meteor/local/resolver-result-cache.json", ".meteor/local/plugin-cache", ".meteor/local/isopacks", ".meteor/local/bundler-cache/scanner"]
|
|
49
50
|
}];
|
|
50
51
|
};
|
|
52
|
+
var getMeteorDockerInstallScripts = function (context) {
|
|
53
|
+
if (context.packageManagerInfo.isClassic) {
|
|
54
|
+
return new BashExpression_1.BashExpression("\nCOPY $APP_DIR/package.json $APP_DIR/yarn.lock ./\n\nRUN yarn --frozen-lockfile --production=true --ignore-scripts --ignore-engines\nCOPY $APP_DIR .\nRUN yarn --frozen-lockfile --production=true --ignore-engines\n ".trim());
|
|
55
|
+
}
|
|
56
|
+
// yarn >= 4 ships with built-in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
57
|
+
var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
|
|
58
|
+
return context.packageManagerInfo.version.startsWith(v);
|
|
59
|
+
});
|
|
60
|
+
var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
|
|
61
|
+
return new BashExpression_1.BashExpression("\nENV YARN_ENABLE_INLINE_BUILDS=1\nCOPY $APP_DIR .\n".concat(maybeAddWorkspaceToolsCommand, "\nRUN yarn workspaces focus --production\n ").trim());
|
|
62
|
+
};
|
|
51
63
|
var createMeteorBuildJobs = function (context) {
|
|
52
64
|
var buildConfig = context.build.config;
|
|
53
65
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
@@ -55,18 +67,18 @@ var createMeteorBuildJobs = function (context) {
|
|
|
55
67
|
}
|
|
56
68
|
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
57
69
|
return (0, base_1.createComponentBuildJobs)(context, {
|
|
58
|
-
appBuild: buildConfig.buildCommand !== null ? {
|
|
70
|
+
appBuild: buildConfig.buildCommand !== null && buildConfig.buildCommand !== false ? {
|
|
59
71
|
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
|
|
60
72
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
61
73
|
variables: {
|
|
62
74
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
63
75
|
},
|
|
64
|
-
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['
|
|
76
|
+
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory', "cp ./__build_info.json ./dist/bundle/programs/server"], false)
|
|
65
77
|
} : undefined,
|
|
66
78
|
dockerBuild: {
|
|
67
79
|
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
|
|
68
80
|
variables: {
|
|
69
|
-
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ?
|
|
81
|
+
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? getMeteorDockerInstallScripts(context) : ""
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
84
|
});
|
|
@@ -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, _0, _1, _2, _3;
|
|
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,36 +69,39 @@ 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
|
-
needs: []
|
|
75
|
-
envMode: "none"
|
|
73
|
+
needs: []
|
|
76
74
|
};
|
|
77
75
|
var buildConfig = context.build.config;
|
|
78
76
|
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
79
77
|
var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
|
|
80
78
|
name: "๐ก audit"
|
|
81
79
|
}, base), {
|
|
82
|
-
|
|
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,
|
|
83
82
|
cache: undefined,
|
|
84
|
-
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 --level critical" : "yarn npm audit --environment production --severity critical" // yarn 2
|
|
85
84
|
]), false),
|
|
86
|
-
allow_failure: true
|
|
87
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (
|
|
85
|
+
allow_failure: (_h = (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.allowFailure) !== null && _h !== void 0 ? _h : true
|
|
86
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.audit) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.audit) === null || _k === void 0 ? void 0 : _k.artifacts)) : null;
|
|
88
87
|
var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
|
|
89
88
|
name: "๐ฎ lint"
|
|
90
89
|
}, base), {
|
|
91
|
-
|
|
90
|
+
runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_m = (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.runnerVariables) !== null && _m !== void 0 ? _m : {}),
|
|
91
|
+
image: (_p = (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
|
|
92
92
|
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
93
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((
|
|
94
|
-
|
|
93
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn lint"]), false),
|
|
94
|
+
allow_failure: (_s = buildConfig.lint) === null || _s === void 0 ? void 0 : _s.allowFailure
|
|
95
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.lint) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.lint) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
95
96
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
96
97
|
name: "๐งช test"
|
|
97
98
|
}, base), {
|
|
98
|
-
|
|
99
|
+
runnerVariables: __assign(__assign({}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_w = (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.runnerVariables) !== null && _w !== void 0 ? _w : {}),
|
|
100
|
+
image: (_y = (_x = buildConfig.test) === null || _x === void 0 ? void 0 : _x.jobImage) !== null && _y !== void 0 ? _y : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
99
101
|
cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
|
|
100
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((
|
|
101
|
-
|
|
102
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_0 = (0, utils_1.ensureArrayOrNull)((_z = buildConfig.test) === null || _z === void 0 ? void 0 : _z.command)) !== null && _0 !== void 0 ? _0 : ["yarn test"]), false),
|
|
103
|
+
allow_failure: (_1 = buildConfig.test) === null || _1 === void 0 ? void 0 : _1.allowFailure
|
|
104
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_2 = buildConfig.test) === null || _2 === void 0 ? void 0 : _2.artifactsReports, (_3 = buildConfig.test) === null || _3 === void 0 ? void 0 : _3.artifacts)) : null;
|
|
102
105
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
103
106
|
};
|
|
104
107
|
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;
|
|
@@ -83,7 +83,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
83
83
|
// custom script
|
|
84
84
|
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["cd ".concat(context.build.dir), "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
85
85
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
86
|
-
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
|
|
86
|
+
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack config registry-mirrors add index.docker.io --mirror mirror.gcr.io", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
|
|
87
87
|
}
|
|
88
88
|
});
|
|
89
89
|
};
|
|
@@ -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;
|
|
@@ -48,7 +48,7 @@ exports.createRailsTestJobs = void 0;
|
|
|
48
48
|
var __1 = require("../..");
|
|
49
49
|
var utils_1 = require("../../utils");
|
|
50
50
|
var createRailsTestJobs = function (context) {
|
|
51
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
|
51
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
52
52
|
// don't run tests after release
|
|
53
53
|
// TODO: this will be replaced by using rules
|
|
54
54
|
if (context.trigger === "taggedRelease") {
|
|
@@ -62,8 +62,7 @@ var createRailsTestJobs = function (context) {
|
|
|
62
62
|
var base = {
|
|
63
63
|
variables: __assign({}, context.environment.jobOnlyVars.build.envVars),
|
|
64
64
|
stage: "test",
|
|
65
|
-
needs: []
|
|
66
|
-
envMode: "none"
|
|
65
|
+
needs: []
|
|
67
66
|
};
|
|
68
67
|
var defaultImage = "docker.io/ruby";
|
|
69
68
|
var bundlerCacheDir = "tmp/cache";
|
|
@@ -81,27 +80,29 @@ var createRailsTestJobs = function (context) {
|
|
|
81
80
|
cache: undefined,
|
|
82
81
|
image: (_c = (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
|
|
83
82
|
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : ["gem install bundler-audit", "bundle audit check"]), false),
|
|
84
|
-
allow_failure: true
|
|
83
|
+
allow_failure: (_g = (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.allowFailure) !== null && _g !== void 0 ? _g : true
|
|
85
84
|
}) : null;
|
|
86
85
|
var lintJob = buildConfig.lint !== false ? __assign(__assign({
|
|
87
86
|
name: "๐ฎ lint"
|
|
88
87
|
}, base), {
|
|
89
88
|
cache: bundlerCache,
|
|
90
|
-
image: (
|
|
91
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((
|
|
89
|
+
image: (_k = (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage) !== null && _k !== void 0 ? _k : defaultImage,
|
|
90
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_m = (0, utils_1.ensureArrayOrNull)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["bundle exec rubocop"]), false),
|
|
91
|
+
allow_failure: (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.allowFailure
|
|
92
92
|
}) : null;
|
|
93
93
|
var testJob = buildConfig.test !== false ? __assign(__assign({
|
|
94
94
|
name: "๐งช test"
|
|
95
95
|
}, base), {
|
|
96
96
|
cache: bundlerCache,
|
|
97
|
-
image: (
|
|
98
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((
|
|
97
|
+
image: (_r = (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage) !== null && _r !== void 0 ? _r : defaultImage,
|
|
98
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_t = (0, utils_1.ensureArrayOrNull)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["bundle exec rake db:test:prepare", "bundle exec rake assets:precompile assets:clean", "bundle exec rspec"]), false),
|
|
99
|
+
allow_failure: (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.allowFailure,
|
|
99
100
|
runnerVariables: {
|
|
100
101
|
RAILS_ENV: "test",
|
|
101
102
|
DATABASE_URL: "postgresql://postgres@database"
|
|
102
103
|
},
|
|
103
104
|
services: [{
|
|
104
|
-
name: buildConfig.test && "databaseImage" in buildConfig.test ? (
|
|
105
|
+
name: buildConfig.test && "databaseImage" in buildConfig.test ? (_w = (_v = buildConfig === null || buildConfig === void 0 ? void 0 : buildConfig.test) === null || _v === void 0 ? void 0 : _v.databaseImage) !== null && _w !== void 0 ? _w : "docker.io/postgres:latest" : "docker.io/postgres:latest",
|
|
105
106
|
alias: "database",
|
|
106
107
|
variables: {
|
|
107
108
|
POSTGRES_HOST_AUTH_METHOD: "trust"
|
package/dist/build/types.d.ts
CHANGED
|
@@ -62,6 +62,15 @@ 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>;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the job is allowed to fail without blocking the pipeline.
|
|
71
|
+
* Defaults to `true` for audit jobs, `undefined` (not set) for lint and test jobs.
|
|
72
|
+
*/
|
|
73
|
+
allowFailure?: boolean;
|
|
65
74
|
};
|
|
66
75
|
export type BuildConfigBase = {
|
|
67
76
|
/**
|
|
@@ -82,7 +91,7 @@ export type BuildConfigBase = {
|
|
|
82
91
|
/**
|
|
83
92
|
* define the build command
|
|
84
93
|
*/
|
|
85
|
-
buildCommand?: string | string[] | null;
|
|
94
|
+
buildCommand?: string | string[] | null | false;
|
|
86
95
|
/**
|
|
87
96
|
* customize lint, set false to disable
|
|
88
97
|
*/
|
|
@@ -100,6 +109,11 @@ export type BuildConfigBase = {
|
|
|
100
109
|
* by default "dist" and ".next" are allways included
|
|
101
110
|
*/
|
|
102
111
|
artifactsPaths?: string[];
|
|
112
|
+
/**
|
|
113
|
+
* paths for artifacts to exclude,
|
|
114
|
+
*
|
|
115
|
+
*/
|
|
116
|
+
artifactsExcludePaths?: string[];
|
|
103
117
|
/**
|
|
104
118
|
* additional CI/CD artifacts reports,
|
|
105
119
|
* use to display information in merge requests, pipeline views and security dashboards.
|
|
@@ -163,6 +177,12 @@ type BuildConfigDockerWithAdditions = {
|
|
|
163
177
|
};
|
|
164
178
|
type BuildConfigDockerBuiltInNode = {
|
|
165
179
|
type: "node";
|
|
180
|
+
/**
|
|
181
|
+
* whether to run yarn rebuild after yarn install. Defaults to true.
|
|
182
|
+
*
|
|
183
|
+
* Future versions of catladder will default to false.
|
|
184
|
+
*/
|
|
185
|
+
yarnRebuildEnabled?: boolean;
|
|
166
186
|
} & BuildConfigDockerWithAdditions;
|
|
167
187
|
type BuildConfigDockerBuiltInMeteor = {
|
|
168
188
|
type: "meteor";
|
|
@@ -185,6 +205,15 @@ type BuildConfigDockerCustom = {
|
|
|
185
205
|
* Depending on your Dockerfile you may want to change it to "component"
|
|
186
206
|
*/
|
|
187
207
|
buildContextLocation?: "root" | "component";
|
|
208
|
+
/**
|
|
209
|
+
* EXPERIMENTAL: custom docker file content
|
|
210
|
+
*
|
|
211
|
+
* you can use some predefined variables:
|
|
212
|
+
* - $DOCKER_COPY_WORKSPACE_FILES
|
|
213
|
+
* - $DOCKER_COPY_AND_INSTALL_APP
|
|
214
|
+
* - and all default variables
|
|
215
|
+
*/
|
|
216
|
+
dockerfileContent?: string[];
|
|
188
217
|
};
|
|
189
218
|
export type BuildConfigDocker = BuildConfigDockerBuiltIn | BuildConfigDockerCustom;
|
|
190
219
|
export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit"> & {
|
|
@@ -207,16 +236,6 @@ export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit">
|
|
|
207
236
|
* custom audit, disabled when not set
|
|
208
237
|
*/
|
|
209
238
|
audit?: TestJobCustom;
|
|
210
|
-
/**
|
|
211
|
-
* custom sbom (software bill of materials), set false to disable
|
|
212
|
-
*/
|
|
213
|
-
sbom?: false | {
|
|
214
|
-
/**
|
|
215
|
-
* needs to create a file at `/__sbom.json` in CycloneDX format
|
|
216
|
-
*/
|
|
217
|
-
command: string | string[];
|
|
218
|
-
jobImage: GitlabJobImage;
|
|
219
|
-
};
|
|
220
239
|
};
|
|
221
240
|
export type BuildConfigRails = BuildConfigBase & {
|
|
222
241
|
type: "rails";
|
|
@@ -277,6 +296,11 @@ export type BuildConfigFromWorkspace = {
|
|
|
277
296
|
* by default "dist" and ".next" are allways included
|
|
278
297
|
*/
|
|
279
298
|
artifactsPaths?: string[];
|
|
299
|
+
/**
|
|
300
|
+
* paths for artifacts to exclude,
|
|
301
|
+
*
|
|
302
|
+
*/
|
|
303
|
+
artifactsExcludePaths?: string[];
|
|
280
304
|
} & WithCacheConfig;
|
|
281
305
|
export type BuildConfigStandalone = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor | BuildConfigCustom | BuildConfigRails;
|
|
282
306
|
export type BuildConfig = BuildConfigFromWorkspace | BuildConfigStandalone;
|
|
@@ -313,7 +337,7 @@ export type WorkspaceBuildConfigBase = {
|
|
|
313
337
|
*/
|
|
314
338
|
audit?: false | TestJobCustom;
|
|
315
339
|
/**
|
|
316
|
-
* additional vars only for the
|
|
340
|
+
* additional vars only for the build job.
|
|
317
341
|
* Also if you use services: that require env vars, you need to set them here.
|
|
318
342
|
*
|
|
319
343
|
*/
|
|
@@ -331,7 +355,12 @@ export type WorkspaceBuildConfigBase = {
|
|
|
331
355
|
} & WithCacheConfig;
|
|
332
356
|
export type WorkspaceBuildConfigNode = {
|
|
333
357
|
type: "node";
|
|
334
|
-
buildCommand?: string | string[];
|
|
358
|
+
buildCommand?: string | string[] | null | false;
|
|
359
|
+
/**
|
|
360
|
+
* set docker config defaults for the node build type.
|
|
361
|
+
* Currently not all options are supported.
|
|
362
|
+
*/
|
|
363
|
+
dockerDefaults?: Pick<BuildConfigDockerBuiltInNode, "yarnRebuildEnabled">;
|
|
335
364
|
} & WorkspaceBuildConfigBase;
|
|
336
365
|
export type WorkspaceBuildConfig = WorkspaceBuildConfigNode;
|
|
337
366
|
export {};
|