@catladder/pipeline 1.170.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bash/BashExpression.d.ts +2 -6
- package/dist/bash/BashExpression.js +5 -15
- package/dist/bash/bashEscape.d.ts +34 -0
- package/dist/bash/bashEscape.js +114 -0
- package/dist/bash/bashYaml.js +25 -2
- package/dist/bash/getInjectVarsScript.js +4 -2
- package/dist/bash/index.d.ts +2 -0
- package/dist/bash/index.js +26 -0
- package/dist/build/base/createAppBuildJob.js +3 -3
- package/dist/build/base/writeDotEnv.js +6 -4
- package/dist/build/custom/testJob.js +12 -12
- package/dist/build/docker.d.ts +3 -3
- package/dist/build/node/buildJob.js +1 -1
- package/dist/build/node/cache.d.ts +2 -4
- package/dist/build/node/cache.js +3 -24
- package/dist/build/node/testJob.js +11 -11
- package/dist/build/rails/build.js +1 -1
- package/dist/build/rails/test.js +8 -8
- package/dist/build/types.d.ts +0 -10
- package/dist/constants.js +1 -1
- package/dist/context/createComponentContext.js +0 -1
- package/dist/context/getEnvConfig.js +2 -1
- package/dist/context/getEnvironment.js +1 -2
- package/dist/context/getEnvironmentVariables.d.ts +5 -6
- package/dist/context/getEnvironmentVariables.js +50 -38
- package/dist/deploy/base/deploy.js +3 -3
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -2
- package/dist/deploy/cloudRun/index.js +2 -2
- package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +2 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +3 -14
- package/dist/deploy/kubernetes/deployJob.js +1 -3
- package/dist/deploy/kubernetes/index.js +2 -2
- package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -3
- package/dist/deploy/kubernetes/kubeValues.d.ts +3 -4
- package/dist/deploy/kubernetes/kubeValues.js +2 -3
- package/dist/deploy/types/base.d.ts +0 -6
- package/dist/deploy/types/kubernetes.d.ts +1 -34
- package/dist/globalScriptFunctions/index.d.ts +14 -0
- package/dist/globalScriptFunctions/index.js +37 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/pipeline/gitlab/createGitlabJobs.js +3 -5
- package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +1 -0
- package/dist/pipeline/gitlab/createGitlabPipeline.js +38 -2
- package/dist/pipeline/packageManager.js +1 -1
- package/dist/runner/index.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +6 -9
- package/dist/types/context.d.ts +2 -9
- package/dist/types/gitlab-types.d.ts +1 -0
- package/dist/types/jobs.d.ts +0 -8
- package/dist/utils/gitlab.js +4 -1
- package/dist/utils/writeFiles.js +1 -7
- package/dist/variables/VariableValue.d.ts +3 -0
- package/dist/variables/VariableValue.js +5 -0
- package/dist/variables/VariableValueContainingReferences.d.ts +24 -0
- package/dist/variables/VariableValueContainingReferences.js +97 -0
- package/dist/variables/__tests__/resolveAllReferences.test.js +219 -0
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +1 -0
- package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +171 -0
- package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +1 -0
- package/dist/variables/__tests__/resolveReferencesOnce.test.js +202 -0
- package/dist/variables/__tests__/variableValue.test.d.ts +1 -0
- package/dist/variables/__tests__/variableValue.test.js +36 -0
- package/dist/variables/resolveAllReferences.d.ts +3 -0
- package/dist/{bash/replaceAsync.js → variables/resolveAllReferences.js} +60 -41
- package/dist/variables/resolveAllReferencesOnce.d.ts +5 -0
- package/dist/variables/resolveAllReferencesOnce.js +191 -0
- package/dist/variables/resolveReferencesOnce.d.ts +8 -0
- package/dist/variables/resolveReferencesOnce.js +22 -0
- package/examples/__snapshots__/cloud-run-http2.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +312 -222
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1436 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +316 -238
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +313 -238
- package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +316 -238
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +294 -220
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +312 -238
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +652 -486
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +282 -288
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +312 -238
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +284 -194
- package/examples/__snapshots__/custom-build-job.test.ts.snap +278 -188
- package/examples/__snapshots__/custom-deploy.test.ts.snap +220 -154
- package/examples/__snapshots__/custom-envs.test.ts.snap +216 -126
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +278 -188
- package/examples/__snapshots__/git-submodule.test.ts.snap +312 -238
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +231 -253
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +240 -262
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +504 -506
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +239 -261
- package/examples/__snapshots__/local-dot-env.test.ts.snap +236 -238
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +236 -242
- package/examples/__snapshots__/multiline-var.test.ts.snap +1355 -973
- package/examples/__snapshots__/native-app.test.ts.snap +438 -392
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +312 -238
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +312 -238
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +186 -188
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +162 -164
- package/examples/__snapshots__/referencing-other-vars.test.ts.snap +4741 -0
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +330 -228
- package/examples/__snapshots__/{workspace-api-www-custom-cache.test.ts.snap → workspace-api-www-turbo-cache.test.ts.snap} +457 -499
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +452 -482
- package/examples/{workspace-api-www-custom-cache.test.ts → cloud-run-nextjs.test.ts} +2 -2
- package/examples/cloud-run-nextjs.ts +28 -0
- package/examples/cloud-run-with-sql.ts +0 -1
- package/examples/kubernetes-application-customization.ts +1 -0
- package/examples/kubernetes-with-cloud-sql.ts +1 -0
- package/examples/kubernetes-with-jobs.ts +1 -0
- package/examples/kubernetes-with-mongodb.ts +1 -0
- package/examples/meteor-kubernetes.ts +1 -1
- package/examples/native-app.ts +10 -7
- package/examples/rails-k8s-with-worker.ts +7 -1
- package/examples/{kubernetes-with-cloud-sql-legacy.test.ts → referencing-other-vars.test.ts} +2 -2
- package/examples/referencing-other-vars.ts +83 -0
- package/examples/workspace-api-www-turbo-cache.test.ts +11 -0
- package/examples/{workspace-api-www-custom-cache.ts → workspace-api-www-turbo-cache.ts} +4 -3
- package/examples/workspace-api-www.ts +3 -2
- package/package.json +2 -6
- package/src/bash/BashExpression.ts +10 -13
- package/src/bash/bashEscape.ts +158 -0
- package/src/bash/bashYaml.ts +36 -2
- package/src/bash/getInjectVarsScript.ts +11 -2
- package/src/bash/index.ts +2 -0
- package/src/build/base/createAppBuildJob.ts +0 -1
- package/src/build/base/writeDotEnv.ts +6 -6
- package/src/build/custom/testJob.ts +0 -1
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +0 -29
- package/src/build/node/testJob.ts +0 -1
- package/src/build/rails/build.ts +0 -1
- package/src/build/rails/test.ts +0 -1
- package/src/build/types.ts +0 -13
- package/src/context/createComponentContext.ts +0 -1
- package/src/context/getEnvConfig.ts +2 -2
- package/src/context/getEnvironment.ts +1 -1
- package/src/context/getEnvironmentContext.ts +1 -1
- package/src/context/getEnvironmentVariables.ts +44 -51
- package/src/deploy/base/deploy.ts +1 -1
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +4 -12
- package/src/deploy/cloudRun/index.ts +2 -2
- package/src/deploy/kubernetes/cloudSql/index.ts +3 -16
- package/src/deploy/kubernetes/deployJob.ts +0 -2
- package/src/deploy/kubernetes/index.ts +2 -2
- package/src/deploy/kubernetes/kubeEnv.ts +3 -3
- package/src/deploy/kubernetes/kubeValues.ts +5 -8
- package/src/deploy/types/base.ts +0 -6
- package/src/deploy/types/kubernetes.ts +1 -36
- package/src/globalScriptFunctions/index.ts +30 -0
- package/src/index.ts +2 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +1 -4
- package/src/pipeline/gitlab/createGitlabPipeline.ts +8 -1
- package/src/pipeline/packageManager.ts +7 -5
- package/src/runner/index.ts +0 -1
- package/src/types/config.ts +6 -9
- package/src/types/context.ts +3 -9
- package/src/types/gitlab-types.ts +1 -0
- package/src/types/jobs.ts +0 -8
- package/src/utils/gitlab.ts +19 -2
- package/src/utils/writeFiles.ts +1 -2
- package/src/variables/VariableValue.ts +6 -0
- package/src/variables/VariableValueContainingReferences.ts +89 -0
- package/src/variables/__tests__/resolveAllReferences.test.ts +110 -0
- package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +64 -0
- package/src/variables/__tests__/resolveReferencesOnce.test.ts +117 -0
- package/src/variables/__tests__/variableValue.test.ts +73 -0
- package/src/variables/resolveAllReferences.ts +46 -0
- package/src/variables/resolveAllReferencesOnce.ts +44 -0
- package/src/variables/resolveReferencesOnce.ts +29 -0
- package/bin/catladder-gitlab-dev.js +0 -3
- package/bin/catladder-gitlab.js +0 -3
- package/dist/bash/replaceAsync.d.ts +0 -2
- package/dist/bundles/catladder-gitlab/index.js +0 -15
- package/dist/context/__tests__/resolveReferences.test.js +0 -368
- package/dist/context/resolveReferences.d.ts +0 -6
- package/dist/context/resolveReferences.js +0 -286
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +0 -85
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +0 -33
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +0 -1795
- package/examples/kubernetes-with-cloud-sql-legacy.ts +0 -35
- package/scripts/bundle +0 -2
- package/src/bash/replaceAsync.ts +0 -54
- package/src/context/__tests__/resolveReferences.test.ts +0 -148
- package/src/context/resolveReferences.ts +0 -93
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +0 -35
- /package/dist/{context/__tests__/resolveReferences.test.d.ts → variables/__tests__/resolveAllReferences.test.d.ts} +0 -0
package/dist/build/types.d.ts
CHANGED
|
@@ -73,12 +73,6 @@ export type BuildConfigBase = {
|
|
|
73
73
|
* Can curently not reference other variables from other components
|
|
74
74
|
*/
|
|
75
75
|
jobVars?: EnvVars;
|
|
76
|
-
/**
|
|
77
|
-
* additional env vars for the buid jobs
|
|
78
|
-
*
|
|
79
|
-
* @deprecated use jobVars or runnerVariables
|
|
80
|
-
*/
|
|
81
|
-
extraVars?: Record<string, string>;
|
|
82
76
|
/**
|
|
83
77
|
* additional vars only for the runner.
|
|
84
78
|
* Also if you use services: that require env vars, you need to set them here.
|
|
@@ -193,10 +187,6 @@ type BuildConfigDockerCustom = {
|
|
|
193
187
|
buildContextLocation?: "root" | "component";
|
|
194
188
|
};
|
|
195
189
|
export type BuildConfigDocker = BuildConfigDockerBuiltIn | BuildConfigDockerCustom;
|
|
196
|
-
/**
|
|
197
|
-
* @deprecated this type is no longer used. Use {@link BuildConfigDocker} instead.
|
|
198
|
-
*/
|
|
199
|
-
export type BuildConfigCustomDocker = BuildConfigDockerCustom | BuildConfigDockerBuiltInNgninx;
|
|
200
190
|
export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit"> & {
|
|
201
191
|
type: "custom";
|
|
202
192
|
jobImage: GitlabJobImage;
|
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 = "
|
|
7
|
+
exports.PIPELINE_IMAGE_TAG = "v2-0-0-03e9a0a2" || "latest";
|
|
8
8
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
|
|
@@ -13,7 +13,8 @@ var getEnvConfig = function (config, componentName, env) {
|
|
|
13
13
|
}
|
|
14
14
|
var envCustomizations = (_b = (_a = defaultConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
15
15
|
if (envCustomizations === false) {
|
|
16
|
-
|
|
16
|
+
// env is disabled, still return the default config
|
|
17
|
+
return defaultConfig;
|
|
17
18
|
}
|
|
18
19
|
return (0, utils_1.mergeWithMergingArrays)(defaultConfig, envCustomizations);
|
|
19
20
|
};
|
|
@@ -148,8 +148,7 @@ var getEnvironment = function (ctx) {
|
|
|
148
148
|
fullName: envContext.fullName,
|
|
149
149
|
slugPrefix: envContext.environmentSlugPrefix,
|
|
150
150
|
reviewSlug: envContext.reviewSlug,
|
|
151
|
-
slug: envContext.environmentSlug
|
|
152
|
-
shortName: env
|
|
151
|
+
slug: envContext.environmentSlug
|
|
153
152
|
}, variables)];
|
|
154
153
|
}
|
|
155
154
|
});
|
|
@@ -13,15 +13,14 @@ declare const getBasePredefinedVariables: (ctx: EnvironmentContext) => {
|
|
|
13
13
|
};
|
|
14
14
|
type BasePredefinedVariables = ReturnType<typeof getBasePredefinedVariables>;
|
|
15
15
|
export type PredefinedVariables = BasePredefinedVariables & {
|
|
16
|
-
|
|
17
|
-
* undefined in rails, Rails before 6.1 (mis)uses the `HOST` environment variable to specify the IP to bind to
|
|
18
|
-
*/
|
|
19
|
-
HOST?: StringOrBashExpression;
|
|
16
|
+
HOSTNAME?: StringOrBashExpression;
|
|
20
17
|
ROOT_URL: StringOrBashExpression;
|
|
21
|
-
|
|
18
|
+
HOSTNAME_INTERNAL: StringOrBashExpression;
|
|
22
19
|
ROOT_URL_INTERNAL: StringOrBashExpression;
|
|
23
20
|
};
|
|
24
|
-
export declare const getEnvironmentVariables: (ctx: CreateComponentContextContext,
|
|
21
|
+
export declare const getEnvironmentVariables: (ctx: CreateComponentContextContext, options?: {
|
|
22
|
+
shouldResolveReferences?: boolean;
|
|
23
|
+
}) => Promise<EnvironmentVariables>;
|
|
25
24
|
export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
|
|
26
25
|
export declare const getSecretVarNameForContext: (context: ComponentContext, key: string) => string;
|
|
27
26
|
export {};
|
|
@@ -160,13 +160,13 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
160
160
|
value: true
|
|
161
161
|
});
|
|
162
162
|
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
|
|
163
|
-
var lodash_1 = require("lodash");
|
|
164
163
|
var deploy_1 = require("../deploy");
|
|
165
164
|
var BashExpression_1 = require("../bash/BashExpression");
|
|
166
165
|
var types_1 = require("../build/types");
|
|
166
|
+
var VariableValueContainingReferences_1 = require("../variables/VariableValueContainingReferences");
|
|
167
|
+
var resolveAllReferences_1 = require("../variables/resolveAllReferences");
|
|
167
168
|
var getBuildInfoVariables_1 = require("./getBuildInfoVariables");
|
|
168
169
|
var getEnvironmentContext_1 = require("./getEnvironmentContext");
|
|
169
|
-
var resolveReferences_1 = require("./resolveReferences");
|
|
170
170
|
var transformJobOnlyVars_1 = require("./transformJobOnlyVars");
|
|
171
171
|
var envVars_1 = require("./utils/envVars");
|
|
172
172
|
var getBasePredefinedVariables = function (ctx) {
|
|
@@ -181,12 +181,12 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
181
181
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
182
182
|
args_1[_i - 1] = arguments[_i];
|
|
183
183
|
}
|
|
184
|
-
return __awaiter(void 0, __spreadArray([ctx_1], __read(args_1), false), void 0, function (ctx,
|
|
185
|
-
var environmentContext, config, env, componentName, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars,
|
|
186
|
-
var
|
|
187
|
-
var
|
|
188
|
-
if (
|
|
189
|
-
|
|
184
|
+
return __awaiter(void 0, __spreadArray([ctx_1], __read(args_1), false), void 0, function (ctx, options) {
|
|
185
|
+
var environmentContext, config, env, componentName, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, HOSTNAME_INTERNAL, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, publicEnvVarsRawSanitized, publicEnvVarsUnresolved, publicEnvVars, _a, envVars;
|
|
186
|
+
var _b, _c;
|
|
187
|
+
var _d, _e, _f, _g, _h, _j, _k, _l;
|
|
188
|
+
if (options === void 0) {
|
|
189
|
+
options = {};
|
|
190
190
|
}
|
|
191
191
|
return __generator(this, function (_m) {
|
|
192
192
|
switch (_m.label) {
|
|
@@ -197,43 +197,45 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
197
197
|
basePredefinedVariables = getBasePredefinedVariables(environmentContext);
|
|
198
198
|
if (envType === "local") {
|
|
199
199
|
devLocalConfig = envConfigRaw;
|
|
200
|
-
port = (
|
|
200
|
+
port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
|
|
201
201
|
host = "localhost:" + port.toString();
|
|
202
202
|
url = "http://" + host;
|
|
203
|
-
predefinedVariables = __assign(__assign(
|
|
203
|
+
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
204
204
|
ENV_SHORT: "local",
|
|
205
|
-
ROOT_URL: url
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}), {
|
|
209
|
-
HOST_INTERNAL: host,
|
|
205
|
+
ROOT_URL: url,
|
|
206
|
+
HOSTNAME: host,
|
|
207
|
+
HOSTNAME_INTERNAL: host,
|
|
210
208
|
ROOT_URL_INTERNAL: "http://" + host,
|
|
211
209
|
PORT: port.toString()
|
|
212
210
|
});
|
|
213
211
|
} else {
|
|
214
212
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
215
|
-
|
|
216
|
-
host = (
|
|
213
|
+
HOSTNAME_INTERNAL = (_e = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
|
|
214
|
+
host = (_f = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _f !== void 0 ? _f : HOSTNAME_INTERNAL;
|
|
217
215
|
url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
|
|
218
216
|
predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) && buildConfigRaw.type === "rails" ? {} : {
|
|
219
|
-
|
|
217
|
+
HOSTNAME: host
|
|
220
218
|
}), {
|
|
221
219
|
ROOT_URL: url,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
HOST_CANONICAL: HOST_INTERNAL,
|
|
225
|
-
ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOST_INTERNAL])
|
|
220
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL,
|
|
221
|
+
ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOSTNAME_INTERNAL])
|
|
226
222
|
}), additionalEnvVars);
|
|
227
223
|
}
|
|
228
|
-
publicEnvVarsRaw = (
|
|
224
|
+
publicEnvVarsRaw = (_h = (_g = envConfigRaw.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
|
|
229
225
|
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
230
|
-
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((0, envVars_1.stringListToSecreteEnvVarList)((
|
|
226
|
+
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((0, envVars_1.stringListToSecreteEnvVarList)((_k = (_j = envConfigRaw.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : [])), false), __read(additionalSecretKeys), false);
|
|
231
227
|
secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
228
|
+
publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRaw);
|
|
229
|
+
publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(function (_a) {
|
|
230
|
+
var _b = __read(_a, 2),
|
|
231
|
+
key = _b[0],
|
|
232
|
+
value = _b[1];
|
|
233
|
+
return [key, (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
|
|
234
|
+
componentName: ctx.componentName
|
|
235
|
+
})];
|
|
236
|
+
}));
|
|
237
|
+
if (!((_l = options.shouldResolveReferences) !== null && _l !== void 0 ? _l : true)) return [3 /*break*/, 2];
|
|
238
|
+
return [4 /*yield*/, (0, resolveAllReferences_1.resolveAllReferences)(publicEnvVarsUnresolved, function (otherComponentName) {
|
|
237
239
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
238
240
|
var otherEnvVars;
|
|
239
241
|
return __generator(this, function (_a) {
|
|
@@ -241,27 +243,37 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
241
243
|
case 0:
|
|
242
244
|
return [4 /*yield*/, (0, exports.getEnvironmentVariables)(__assign(__assign({}, ctx), {
|
|
243
245
|
componentName: otherComponentName
|
|
244
|
-
}),
|
|
246
|
+
}), {
|
|
247
|
+
shouldResolveReferences: false // we already do this here with replaceAllReferences recursivly until re replaced all
|
|
248
|
+
})];
|
|
249
|
+
|
|
245
250
|
case 1:
|
|
246
251
|
otherEnvVars = _a.sent().envVars;
|
|
247
252
|
return [2 /*return*/, otherEnvVars];
|
|
248
253
|
}
|
|
249
254
|
});
|
|
250
255
|
});
|
|
251
|
-
}
|
|
256
|
+
})];
|
|
252
257
|
case 1:
|
|
253
|
-
|
|
254
|
-
|
|
258
|
+
_a = _m.sent();
|
|
259
|
+
return [3 /*break*/, 3];
|
|
260
|
+
case 2:
|
|
261
|
+
_a = publicEnvVarsUnresolved;
|
|
262
|
+
_m.label = 3;
|
|
263
|
+
case 3:
|
|
264
|
+
publicEnvVars = _a;
|
|
265
|
+
envVars = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVars));
|
|
266
|
+
_b = {
|
|
255
267
|
envVars: envVars,
|
|
256
268
|
secretEnvVarKeys: secretEnvVarKeys
|
|
257
269
|
};
|
|
258
|
-
|
|
270
|
+
_c = {};
|
|
259
271
|
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, buildConfigRaw && (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) && buildConfigRaw.jobVars || null)];
|
|
260
|
-
case
|
|
261
|
-
|
|
272
|
+
case 4:
|
|
273
|
+
_c.build = _m.sent();
|
|
262
274
|
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, deployConfigRaw && deployConfigRaw.jobVars || null)];
|
|
263
|
-
case
|
|
264
|
-
return [2 /*return*/, (
|
|
275
|
+
case 5:
|
|
276
|
+
return [2 /*return*/, (_b.jobOnlyVars = (_c.deploy = _m.sent(), _c), _b.host = host, _b.url = url, _b)];
|
|
265
277
|
}
|
|
266
278
|
});
|
|
267
279
|
});
|
|
@@ -55,7 +55,7 @@ var stop_1 = require("./stop");
|
|
|
55
55
|
var variables_1 = require("./variables");
|
|
56
56
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
57
57
|
var createDeployJob = function (context, jobDefinition) {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f
|
|
58
|
+
var _a, _b, _c, _d, _e, _f;
|
|
59
59
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
60
60
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
61
61
|
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
@@ -110,8 +110,8 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
110
110
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
111
111
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
112
112
|
stage: "deploy",
|
|
113
|
-
variables: __assign(__assign(__assign(__assign(
|
|
114
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), (
|
|
113
|
+
variables: __assign(__assign(__assign(__assign({}, context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
|
|
114
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), (_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}), deployConfig ? (_f = deployConfig.runnerVariables) !== null && _f !== void 0 ? _f : {} : {}),
|
|
115
115
|
environment: isStoppable ? {
|
|
116
116
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
117
117
|
auto_stop_in: autoStop
|
|
@@ -38,15 +38,15 @@ exports.getCloudRunDeployScripts = void 0;
|
|
|
38
38
|
var lodash_1 = require("lodash");
|
|
39
39
|
var gitlab_1 = require("../../../utils/gitlab");
|
|
40
40
|
var sbom_1 = require("../../sbom");
|
|
41
|
+
var __1 = require("..");
|
|
42
|
+
var bashYaml_1 = require("../../../bash/bashYaml");
|
|
41
43
|
var cleanup_1 = require("../cleanup");
|
|
42
44
|
var database_1 = require("../utils/database");
|
|
43
45
|
var gcloudServiceAccountLoginCommands_1 = require("../utils/gcloudServiceAccountLoginCommands");
|
|
44
46
|
var cloudRunJobs_1 = require("./cloudRunJobs");
|
|
45
47
|
var cloudRunServices_1 = require("./cloudRunServices");
|
|
46
48
|
var common_1 = require("./common");
|
|
47
|
-
var __1 = require("..");
|
|
48
49
|
var constants_1 = require("./constants");
|
|
49
|
-
var bashYaml_1 = require("../../../bash/bashYaml");
|
|
50
50
|
function getCloudRunDeployScripts(context) {
|
|
51
51
|
var _a;
|
|
52
52
|
var deployConfig = (0, common_1.getCloudRunDeployConfig)(context);
|
|
@@ -111,7 +111,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
111
111
|
env = ctx.env,
|
|
112
112
|
componentName = ctx.componentName,
|
|
113
113
|
deployConfigRaw = ctx.deployConfigRaw;
|
|
114
|
-
var
|
|
114
|
+
var HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([fullName, (0, BashExpression_1.getBashVariable)((0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX))], "-").toLowerCase();
|
|
115
115
|
var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
|
|
116
116
|
var _b = __read(_a, 2),
|
|
117
117
|
name = _b[0],
|
|
@@ -119,7 +119,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
119
119
|
return ["CLOUD_RUN_JOB_TRIGGER_URL_" + (0, gitlab_1.sanitizeForBashVariable)(name), "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat((0, jobName_1.getCloudRunJobName)(fullName, name), ":run")];
|
|
120
120
|
})) : {};
|
|
121
121
|
return __assign(__assign(__assign({
|
|
122
|
-
|
|
122
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL
|
|
123
123
|
}, getCloudSqlVariables(ctx)), jobTriggers), {
|
|
124
124
|
DEPLOY_CLOUD_RUN_PROJECT_ID: deployConfigRaw ? deployConfigRaw.projectId : undefined,
|
|
125
125
|
DEPLOY_CLOUD_RUN_REGION: deployConfigRaw ? deployConfigRaw.region : undefined
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { ComponentContext } from "../../../types/context";
|
|
2
|
-
export declare const getServiceName: (context: ComponentContext) => string | import("
|
|
2
|
+
export declare const getServiceName: (context: ComponentContext) => string | import("../../..").BashExpression;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type { StringOrBashExpression } from "../../../bash/BashExpression";
|
|
2
1
|
import type { ComponentContext } from "../../../types";
|
|
2
|
+
import type { VariableValue } from "../../../variables/VariableValue";
|
|
3
3
|
export declare const hasKubernetesCloudSQL: (context: ComponentContext) => boolean | undefined;
|
|
4
4
|
type CloudSqlValues = {
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
proxyCredentials: string;
|
|
7
7
|
instanceConnectionName: string;
|
|
8
|
-
fullDbName:
|
|
8
|
+
fullDbName: VariableValue;
|
|
9
9
|
dbUser: string;
|
|
10
10
|
};
|
|
11
11
|
export declare const createKubernetesCloudsqlBaseValues: (context: ComponentContext) => {
|
|
@@ -17,7 +17,7 @@ var hasKubernetesCloudSQL = function (context) {
|
|
|
17
17
|
};
|
|
18
18
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
19
19
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
20
|
-
var _a, _b, _c
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
22
22
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
23
23
|
throw new Error("cannot get cloud sql config");
|
|
@@ -27,22 +27,11 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
27
27
|
throw new Error("cannot get cloud sql config");
|
|
28
28
|
}
|
|
29
29
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
30
|
-
if (
|
|
31
|
-
var instanceConnectionName = "".concat((_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509", ":").concat((_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6", ":").concat((_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE);
|
|
32
|
-
return {
|
|
33
|
-
cloudsql: {
|
|
34
|
-
enabled: config.enabled,
|
|
35
|
-
dbUser: "postgres",
|
|
36
|
-
instanceConnectionName: instanceConnectionName,
|
|
37
|
-
proxyCredentials: proxyCredentials,
|
|
38
|
-
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : ""
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
} else if (config.type === "unmanaged") {
|
|
30
|
+
if (config.type === "unmanaged") {
|
|
42
31
|
return {
|
|
43
32
|
cloudsql: {
|
|
44
33
|
enabled: config.enabled,
|
|
45
|
-
dbUser: (
|
|
34
|
+
dbUser: (_c = config.dbUser) !== null && _c !== void 0 ? _c : "postgres",
|
|
46
35
|
instanceConnectionName: config.instanceConnectionName,
|
|
47
36
|
proxyCredentials: proxyCredentials,
|
|
48
37
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name)
|
|
@@ -77,9 +77,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
77
77
|
KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.name),
|
|
78
78
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
79
79
|
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : []), false).join(" "),
|
|
80
|
-
COMPONENT_NAME: context.name
|
|
81
|
-
/** @deprecated */
|
|
82
|
-
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID
|
|
80
|
+
COMPONENT_NAME: context.name
|
|
83
81
|
})
|
|
84
82
|
});
|
|
85
83
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -86,12 +86,12 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
86
86
|
var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) ||
|
|
87
87
|
// for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
88
88
|
fullConfig.domainCanonical || "panter.cloud";
|
|
89
|
-
var
|
|
89
|
+
var HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)(__spreadArray(__spreadArray([componentSlug], __read(envType === "review" && reviewSlug ? [reviewSlug] : []), false), [env, fullConfig.appName, fullConfig.customerName, domainCanonical], false), "."); // default for kubernetes and rest
|
|
90
90
|
return {
|
|
91
91
|
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
92
92
|
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
93
93
|
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
94
|
-
|
|
94
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { StringOrBashExpression } from "../../bash/BashExpression";
|
|
2
1
|
import type { ComponentContext } from "../../types";
|
|
2
|
+
import type { VariableValue } from "../../variables/VariableValue";
|
|
3
3
|
/**
|
|
4
4
|
* separate by secrets and public.
|
|
5
5
|
* we evalulate the actual values later, but want to store the secrets in kubernetes secrets
|
|
6
6
|
*/
|
|
7
7
|
export declare const createKubeEnv: (context: ComponentContext) => {
|
|
8
|
-
secret: Record<string,
|
|
9
|
-
public: Record<string,
|
|
8
|
+
secret: Record<string, VariableValue>;
|
|
9
|
+
public: Record<string, VariableValue>;
|
|
10
10
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
export declare const createKubeValues: (context: ComponentContext) => never[] | ({
|
|
3
3
|
env: {
|
|
4
|
-
secret: Record<string, import("
|
|
5
|
-
public: Record<string, import("
|
|
4
|
+
secret: Record<string, import("../..").VariableValue>;
|
|
5
|
+
public: Record<string, import("../..").VariableValue>;
|
|
6
6
|
};
|
|
7
7
|
application: false | import("../types/base").AllowUnknownProps<{
|
|
8
8
|
command?: string | undefined;
|
|
@@ -62,7 +62,7 @@ export declare const createKubeValues: (context: ComponentContext) => never[] |
|
|
|
62
62
|
} | undefined;
|
|
63
63
|
}> | undefined;
|
|
64
64
|
} & {
|
|
65
|
-
cloudsql?: import("../types").
|
|
65
|
+
cloudsql?: import("../types").DeployConfigKubernetesValuesCloudSQLUnmanaged | undefined;
|
|
66
66
|
mongodb?: import("../types").DeployConfigMongodb | undefined;
|
|
67
67
|
mailhog?: {
|
|
68
68
|
enabled: boolean;
|
|
@@ -73,7 +73,6 @@ export declare const createKubeValues: (context: ComponentContext) => never[] |
|
|
|
73
73
|
mapServiceUrlToEnv?: {
|
|
74
74
|
[envVar: string]: string;
|
|
75
75
|
} | undefined;
|
|
76
|
-
secretsAsFile?: string[] | undefined;
|
|
77
76
|
jobs: {
|
|
78
77
|
[k: string]: false | import("../types/base").AllowUnknownProps<{
|
|
79
78
|
command: string;
|
|
@@ -50,7 +50,6 @@ var types_1 = require("../types");
|
|
|
50
50
|
var cloudSql_1 = require("./cloudSql");
|
|
51
51
|
var kubeEnv_1 = require("./kubeEnv");
|
|
52
52
|
var mongodb_1 = require("./mongodb");
|
|
53
|
-
var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
|
|
54
53
|
var createAppConfig = function (context, application) {
|
|
55
54
|
if (application === false) {
|
|
56
55
|
return {
|
|
@@ -114,10 +113,10 @@ var createKubeValues = function (context) {
|
|
|
114
113
|
env: env,
|
|
115
114
|
application: createAppConfig(context, application)
|
|
116
115
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context) : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
|
|
117
|
-
var kubeValues = (0,
|
|
116
|
+
var kubeValues = (0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
|
|
118
117
|
jobs: removeFalsy(jobs),
|
|
119
118
|
cronjobs: removeFalsy(cronjobs)
|
|
120
|
-
}, rest))
|
|
119
|
+
}, rest));
|
|
121
120
|
return kubeValues;
|
|
122
121
|
};
|
|
123
122
|
exports.createKubeValues = createKubeValues;
|
|
@@ -20,12 +20,6 @@ export type DeployConfigBase = {
|
|
|
20
20
|
* Can curently not reference other variables from other components
|
|
21
21
|
*/
|
|
22
22
|
jobVars?: EnvVars;
|
|
23
|
-
/**
|
|
24
|
-
* additional env vars for the deploy job
|
|
25
|
-
*
|
|
26
|
-
* @deprecated use deploy.jobVars for deploy job specific variables
|
|
27
|
-
*/
|
|
28
|
-
extraVars?: Record<string, string>;
|
|
29
23
|
/**
|
|
30
24
|
* additional vars only for the runner.
|
|
31
25
|
* Also if you use services: that require env vars, you need to set them here.
|
|
@@ -152,32 +152,6 @@ export type DeployConfigMongodbReplicaset = {
|
|
|
152
152
|
replicaCount?: number;
|
|
153
153
|
};
|
|
154
154
|
export type DeployConfigMongodb = DeployConfigMongodbBase & (DeployConfigMongodbStandalone | DeployConfigMongodbReplicaset);
|
|
155
|
-
/**
|
|
156
|
-
* @deprecated use config with instanceConnectionName
|
|
157
|
-
*/
|
|
158
|
-
type DeployConfigKubernetesValuesCloudSQLLegacy = {
|
|
159
|
-
enabled: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* @deprecated use config with instanceConnectionName
|
|
162
|
-
*/
|
|
163
|
-
instanceId?: string;
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated use config with instanceConnectionName
|
|
166
|
-
*/
|
|
167
|
-
projectId?: string;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated use config with instanceConnectionName
|
|
170
|
-
*/
|
|
171
|
-
region?: string;
|
|
172
|
-
/**
|
|
173
|
-
* @deprecated use type "unmanaged".
|
|
174
|
-
*
|
|
175
|
-
* Be aware that "unmanaged" is not fully backward compatible with "legacy".
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*/
|
|
179
|
-
type?: "legacy";
|
|
180
|
-
};
|
|
181
155
|
export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
182
156
|
enabled: boolean;
|
|
183
157
|
instanceConnectionName: string;
|
|
@@ -204,7 +178,7 @@ export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
|
204
178
|
*/
|
|
205
179
|
dbBaseName?: string;
|
|
206
180
|
};
|
|
207
|
-
export type DeployConfigKubernetesValuesCloudSQL =
|
|
181
|
+
export type DeployConfigKubernetesValuesCloudSQL = DeployConfigKubernetesValuesCloudSQLUnmanaged;
|
|
208
182
|
export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
209
183
|
/**
|
|
210
184
|
* enable cloudsql db. Currently you have to manually set it up
|
|
@@ -323,13 +297,6 @@ export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
323
297
|
mapServiceUrlToEnv?: {
|
|
324
298
|
[envVar: string]: string;
|
|
325
299
|
};
|
|
326
|
-
/**
|
|
327
|
-
* Mount secrets as files in the filesystem.
|
|
328
|
-
* These secrets are still available as env vars, but will contain the path of the file instead
|
|
329
|
-
*
|
|
330
|
-
* @deprecated this will be removed in the future, because its very niche and not used
|
|
331
|
-
*/
|
|
332
|
-
secretsAsFile?: string[];
|
|
333
300
|
}>;
|
|
334
301
|
export type DeployConfigKubernetes = {
|
|
335
302
|
type: "kubernetes";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class GlobalScriptFunction {
|
|
2
|
+
name: string;
|
|
3
|
+
script: string;
|
|
4
|
+
constructor(name: string, script: string);
|
|
5
|
+
toBashFunction(): string;
|
|
6
|
+
invoke(...args: string[]): string;
|
|
7
|
+
}
|
|
8
|
+
export declare const globalScriptFunctions: Map<string, GlobalScriptFunction>;
|
|
9
|
+
/**
|
|
10
|
+
* registers a global script function
|
|
11
|
+
* only use that in top-level scopes as it will attach the function to the global scope
|
|
12
|
+
*/
|
|
13
|
+
export declare const registerGlobalScriptFunction: (name: string, script: string) => GlobalScriptFunction;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerGlobalScriptFunction = exports.globalScriptFunctions = void 0;
|
|
7
|
+
var GlobalScriptFunction = /** @class */function () {
|
|
8
|
+
function GlobalScriptFunction(name, script) {
|
|
9
|
+
this.name = name;
|
|
10
|
+
this.script = script;
|
|
11
|
+
}
|
|
12
|
+
GlobalScriptFunction.prototype.toBashFunction = function () {
|
|
13
|
+
return "function ".concat(this.name, " () {\n").concat(this.script.trim(), "\n}").trim();
|
|
14
|
+
};
|
|
15
|
+
GlobalScriptFunction.prototype.invoke = function () {
|
|
16
|
+
var args = [];
|
|
17
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
18
|
+
args[_i] = arguments[_i];
|
|
19
|
+
}
|
|
20
|
+
return "".concat(this.name, " ").concat(args.join(" "));
|
|
21
|
+
};
|
|
22
|
+
return GlobalScriptFunction;
|
|
23
|
+
}();
|
|
24
|
+
exports.globalScriptFunctions = new Map();
|
|
25
|
+
/**
|
|
26
|
+
* registers a global script function
|
|
27
|
+
* only use that in top-level scopes as it will attach the function to the global scope
|
|
28
|
+
*/
|
|
29
|
+
var registerGlobalScriptFunction = function (name, script) {
|
|
30
|
+
if (exports.globalScriptFunctions.has(name)) {
|
|
31
|
+
throw new Error("Global script function ".concat(name, " already exists"));
|
|
32
|
+
}
|
|
33
|
+
var scriptFunction = new GlobalScriptFunction(name, script);
|
|
34
|
+
exports.globalScriptFunctions.set(name, scriptFunction);
|
|
35
|
+
return scriptFunction;
|
|
36
|
+
};
|
|
37
|
+
exports.registerGlobalScriptFunction = registerGlobalScriptFunction;
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -30,4 +30,6 @@ __exportStar(require("./config"), exports);
|
|
|
30
30
|
__exportStar(require("./context"), exports);
|
|
31
31
|
__exportStar(require("./build"), exports);
|
|
32
32
|
__exportStar(require("./deploy"), exports);
|
|
33
|
-
__exportStar(require("./utils/writeFiles"), exports);
|
|
33
|
+
__exportStar(require("./utils/writeFiles"), exports);
|
|
34
|
+
__exportStar(require("./variables/VariableValue"), exports);
|
|
35
|
+
__exportStar(require("./bash"), exports);
|
|
@@ -235,7 +235,6 @@ var makeGitlabJob = function (context, job, allJobs, baseRules) {
|
|
|
235
235
|
var environment = job.environment,
|
|
236
236
|
envMode = job.envMode,
|
|
237
237
|
needsStages = job.needsStages,
|
|
238
|
-
needsOtherComponent = job.needsOtherComponent,
|
|
239
238
|
name = job.name,
|
|
240
239
|
needs = job.needs,
|
|
241
240
|
jobTags = job.jobTags,
|
|
@@ -243,7 +242,7 @@ var makeGitlabJob = function (context, job, allJobs, baseRules) {
|
|
|
243
242
|
variables = job.variables,
|
|
244
243
|
runnerVariables = job.runnerVariables,
|
|
245
244
|
when = job.when,
|
|
246
|
-
rest = __rest(job, ["environment", "envMode", "needsStages", "
|
|
245
|
+
rest = __rest(job, ["environment", "envMode", "needsStages", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
|
|
247
246
|
var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(context.env) : job.stage;
|
|
248
247
|
var deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
|
|
249
248
|
var fullJobName = getFullJobName({
|
|
@@ -364,8 +363,7 @@ function deduplicateNeeds(needs) {
|
|
|
364
363
|
}
|
|
365
364
|
function getGitlabNeedsForComponentJob(context, _a, allJobs) {
|
|
366
365
|
var needsStages = _a.needsStages,
|
|
367
|
-
needs = _a.needs
|
|
368
|
-
needsOtherComponent = _a.needsOtherComponent;
|
|
366
|
+
needs = _a.needs;
|
|
369
367
|
var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
|
|
370
368
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
371
369
|
var componentName = context.name;
|
|
@@ -407,7 +405,7 @@ function getGitlabNeedsForComponentJob(context, _a, allJobs) {
|
|
|
407
405
|
});
|
|
408
406
|
}
|
|
409
407
|
});
|
|
410
|
-
var cleanedNeeds = __spreadArray(__spreadArray(
|
|
408
|
+
var cleanedNeeds = __spreadArray(__spreadArray([], __read(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []), false), __read(needs !== null && needs !== void 0 ? needs : []), false);
|
|
411
409
|
return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
412
410
|
var _a;
|
|
413
411
|
return (0, lodash_1.isObject)(n) ? "workspaceName" in n ? {
|
|
@@ -3,6 +3,7 @@ type PickRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
|
3
3
|
export declare const createGitlabPipelineWithDefaults: ({
|
|
4
4
|
image,
|
|
5
5
|
variables,
|
|
6
|
+
before_script,
|
|
6
7
|
...config
|
|
7
8
|
}: PickRequired<Partial<Pipeline<"gitlab">>, "stages" | "jobs">) => Pipeline<"gitlab">;
|
|
8
9
|
export {};
|