@catladder/pipeline 0.0.0-fix-scripts-set-e-ae9c708f → 0.0.0-fix-values-as-files-73f39da5

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.
@@ -25,6 +25,8 @@ var __rest = this && this.__rest || function (s, e) {
25
25
  return t;
26
26
  };
27
27
 
28
+ var _a;
29
+
28
30
  exports.__esModule = true;
29
31
 
30
32
  var fs_1 = require("fs");
@@ -37,11 +39,11 @@ var constants_1 = require("./constants");
37
39
 
38
40
  var pipeline_1 = require("./pipeline");
39
41
 
40
- var _a = process.env,
41
- CI_MERGE_REQUEST_ID = _a.CI_MERGE_REQUEST_ID,
42
- CI_COMMIT_TAG = _a.CI_COMMIT_TAG,
43
- CI_COMMIT_BRANCH = _a.CI_COMMIT_BRANCH,
44
- CI_DEFAULT_BRANCH = _a.CI_DEFAULT_BRANCH;
42
+ var _b = process.env,
43
+ CI_MERGE_REQUEST_ID = _b.CI_MERGE_REQUEST_ID,
44
+ CI_COMMIT_TAG = _b.CI_COMMIT_TAG,
45
+ CI_COMMIT_BRANCH = _b.CI_COMMIT_BRANCH,
46
+ CI_DEFAULT_BRANCH = _b.CI_DEFAULT_BRANCH;
45
47
  var isDefaultBranch = Boolean(CI_DEFAULT_BRANCH) && CI_COMMIT_BRANCH === CI_DEFAULT_BRANCH;
46
48
  var isHotfixBranch = false; // TODO: $CI_COMMIT_BRANCH =~ /^[0-9]+\.([0-9]+|x)\.x$/
47
49
 
@@ -51,7 +53,7 @@ console.info("catladder version ".concat(constants_1.PIPELINE_IMAGE_TAG));
51
53
  var trigger = isMergeRequest || isHotfixBranch ? "mr" : isDefaultBranch ? "mainBranch" : isTaggedRelease ? "taggedRelease" : null;
52
54
 
53
55
  if (trigger) {
54
- var config = (0, config_1.readConfigSync)();
56
+ var config = (_a = (0, config_1.readConfigSync)()) === null || _a === void 0 ? void 0 : _a.config;
55
57
 
56
58
  if (!config) {
57
59
  throw new Error("no catladder config found");
@@ -1,2 +1,6 @@
1
1
  import { Config } from "../types";
2
- export declare const readConfigSync: (directory?: string) => Config | null;
2
+ export declare const readConfigSync: (directory?: string) => {
3
+ config: Config;
4
+ path: string;
5
+ ext: string;
6
+ } | null;
@@ -14,6 +14,11 @@ var fullPath = function (directory, ext) {
14
14
  return directory + "/catladder." + ext;
15
15
  };
16
16
 
17
+ function requireUncached(module) {
18
+ delete require.cache[require.resolve(module)];
19
+ return require(module);
20
+ }
21
+
17
22
  var readConfigSync = function (directory) {
18
23
  if (directory === void 0) {
19
24
  directory = process.cwd();
@@ -31,13 +36,23 @@ var readConfigSync = function (directory) {
31
36
  });
32
37
 
33
38
  if (found) {
39
+ var filePath = fullPath(directory, found);
40
+
34
41
  if (found === "ts" || found === "js") {
35
- // eslint-disable-next-line @typescript-eslint/no-var-requires
36
- return require(fullPath(directory, found))["default"];
42
+ return {
43
+ path: filePath,
44
+ ext: found,
45
+ // eslint-disable-next-line @typescript-eslint/no-var-requires
46
+ config: requireUncached(filePath)["default"]
47
+ };
37
48
  } else {
38
- return (0, js_yaml_1.load)((0, fs_1.readFileSync)(fullPath(directory, found), {
39
- encoding: "utf-8"
40
- }));
49
+ return {
50
+ path: filePath,
51
+ ext: found,
52
+ config: (0, js_yaml_1.load)((0, fs_1.readFileSync)(filePath, {
53
+ encoding: "utf-8"
54
+ }))
55
+ };
41
56
  }
42
57
  }
43
58
 
package/dist/constants.js CHANGED
@@ -2,5 +2,5 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
5
- exports.PIPELINE_IMAGE_TAG = "fix-scripts-set-e-ae9c708f" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "fix-values-as-files-73f39da5" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -2,5 +2,5 @@ import { Config } from "../types/config";
2
2
  import { CommitInfo, Context, Environment } from "../types/context";
3
3
  export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
4
4
  export declare const getSecretVarNameForContext: (context: Context, key: string) => string;
5
- export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, skipReferences?: boolean) => Environment;
5
+ export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined) => Environment;
6
6
  export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, packageManagerInfo?: import("../types/context").YarnPackageManagerInfo | undefined) => Context;
@@ -48,6 +48,8 @@ var __importDefault = this && this.__importDefault || function (mod) {
48
48
  exports.__esModule = true;
49
49
  exports.createContext = exports.getEnvironment = exports.getSecretVarNameForContext = exports.getSecretVarName = void 0;
50
50
 
51
+ var lodash_1 = require("lodash");
52
+
51
53
  var slugify_1 = __importDefault(require("slugify"));
52
54
 
53
55
  var build_1 = require("../build");
@@ -58,6 +60,8 @@ var config_1 = require("../types/config");
58
60
 
59
61
  var utils_1 = require("../utils");
60
62
 
63
+ var resolveReferences_1 = require("./resolveReferences");
64
+
61
65
  var sanitizeForEnVar = function (s) {
62
66
  return s.replace(/-/g, "_");
63
67
  };
@@ -75,14 +79,9 @@ var getSecretVarNameForContext = function (context, key) {
75
79
 
76
80
  exports.getSecretVarNameForContext = getSecretVarNameForContext;
77
81
 
78
- var getEnvironment = function (config, componentName, env, commitInfo, skipReferences // to prevent infinit loop
79
- ) {
82
+ var getEnvironment = function (config, componentName, env, commitInfo) {
80
83
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
81
84
 
82
- if (skipReferences === void 0) {
83
- skipReferences = false;
84
- }
85
-
86
85
  var componentConfig = config.components[componentName];
87
86
 
88
87
  if (!componentConfig) {
@@ -121,6 +120,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
121
120
  host = "localhost:" + port;
122
121
  url = "http://" + host;
123
122
  predefinedVariables = {
123
+ ENV_SHORT: "local",
124
124
  ROOT_URL: url,
125
125
  PORT: port.toString()
126
126
  };
@@ -145,30 +145,28 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
145
145
  });
146
146
  }
147
147
 
148
- var publicEnvVars = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
148
+ var publicEnvVarsRaw = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
149
149
  var secretEnvVarKeys = (_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : [];
150
150
  var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
151
151
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
152
- }));
153
- var referencedRaw = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
154
- var referenced = skipReferences ? {} : Object.entries(referencedRaw).reduce(function (acc, _a) {
155
- var _b = __read(_a, 2),
156
- otherApp = _b[0],
157
- mapping = _b[1];
152
+ })); // this is deprecated, we now support: $componentname:FOO
158
153
 
159
- var envVars = (0, exports.getEnvironment)(config, otherApp, env, commitInfo, true // prevent infinit loop
160
- ).envVars;
161
- return __assign(__assign({}, acc), Object.fromEntries(Object.entries(mapping).map(function (_a) {
162
- var _b = __read(_a, 2),
163
- ourKey = _b[0],
164
- otherKey = _b[1];
154
+ var legacyFromComponents = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
155
+ var publicEnvVarsRawWithLegasyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
156
+ var publicEnvVarsRawSanitized = Object.fromEntries(Object.entries(publicEnvVarsRawWithLegasyFromComponents).map(function (_a) {
157
+ var _b = __read(_a, 2),
158
+ key = _b[0],
159
+ value = _b[1];
165
160
 
166
- return [ourKey, envVars[otherKey]];
167
- })));
168
- }, {});
161
+ return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
162
+ }));
169
163
 
170
- var envVars = __assign(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), referenced), publicEnvVars);
164
+ var envVarsRaw = __assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized);
171
165
 
166
+ var envVars = (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName) {
167
+ var envVars = (0, exports.getEnvironment)(config, componentName, env, commitInfo).envVars;
168
+ return envVars[variableName];
169
+ });
172
170
  return {
173
171
  envType: envType,
174
172
  host: host,
@@ -0,0 +1,6 @@
1
+ export declare const resolveReferences: (vars: Record<string, string>, getOtherVariables?: ((componentName: string, variableName: string) => string | null) | undefined) => {
2
+ [k: string]: string;
3
+ };
4
+ export declare const translateLegacyFromComponents: (fromComponents: Record<string, Record<string, string>>) => {
5
+ [k: string]: string;
6
+ };
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+
3
+ var __read = this && this.__read || function (o, n) {
4
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5
+ if (!m) return o;
6
+ var i = m.call(o),
7
+ r,
8
+ ar = [],
9
+ e;
10
+
11
+ try {
12
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
13
+ } catch (error) {
14
+ e = {
15
+ error: error
16
+ };
17
+ } finally {
18
+ try {
19
+ if (r && !r.done && (m = i["return"])) m.call(i);
20
+ } finally {
21
+ if (e) throw e.error;
22
+ }
23
+ }
24
+
25
+ return ar;
26
+ };
27
+
28
+ exports.__esModule = true;
29
+ exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
30
+
31
+ var lodash_1 = require("lodash");
32
+
33
+ var REGEX = /\$\{(([^:]+):)?([^}]+)}/gm;
34
+
35
+ var resolveReferences = function (vars, getOtherVariables) {
36
+ var replaceSingleValue = function (value, alreadyVisited) {
37
+ if (alreadyVisited === void 0) {
38
+ alreadyVisited = {};
39
+ }
40
+
41
+ if (REGEX.test(value)) {
42
+ return value.replace(REGEX, function (match, _, componentName, variableName) {
43
+ var _a, _b;
44
+
45
+ var _c, _d;
46
+
47
+ if ((_c = alreadyVisited[componentName]) === null || _c === void 0 ? void 0 : _c[variableName]) {
48
+ return match; // prevent endless loop
49
+ }
50
+
51
+ var result = componentName ? (_d = getOtherVariables === null || getOtherVariables === void 0 ? void 0 : getOtherVariables(componentName, variableName)) !== null && _d !== void 0 ? _d : null : vars[variableName]; // is self reference
52
+
53
+ var replaced = result !== null && result !== undefined ? replaceSingleValue(result, (0, lodash_1.merge)({}, alreadyVisited, (_a = {}, _a[componentName] = (_b = {}, _b[variableName] = true, _b), _a))) : match;
54
+ return replaced;
55
+ });
56
+ } else {
57
+ return value;
58
+ }
59
+ };
60
+
61
+ return Object.fromEntries(Object.entries(vars).map(function (_a) {
62
+ var _b = __read(_a, 2),
63
+ key = _b[0],
64
+ value = _b[1];
65
+
66
+ return [key, replaceSingleValue(value)];
67
+ }));
68
+ };
69
+
70
+ exports.resolveReferences = resolveReferences;
71
+
72
+ var translateLegacyFromComponents = function (fromComponents) {
73
+ return Object.fromEntries(Object.entries(fromComponents).flatMap(function (_a) {
74
+ var _b = __read(_a, 2),
75
+ componentName = _b[0],
76
+ variables = _b[1];
77
+
78
+ return Object.entries(variables).map(function (_a) {
79
+ var _b = __read(_a, 2),
80
+ ourName = _b[0],
81
+ otherName = _b[1];
82
+
83
+ return [ourName, "${" + componentName + ":" + otherName + "}"];
84
+ });
85
+ }));
86
+ };
87
+
88
+ exports.translateLegacyFromComponents = translateLegacyFromComponents;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,141 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+
5
+ var resolveReferences_1 = require("./resolveReferences");
6
+
7
+ describe("resolveReferences", function () {
8
+ it("replaces occurences of ${componentName:VARIABLE_NAME}", function () {
9
+ var variables = {
10
+ a: "hello world",
11
+ b: "a replaced value looks like this: '${api:FOO}', nice!"
12
+ };
13
+ var otherVariables = {
14
+ api: {
15
+ FOO: "foo from api"
16
+ },
17
+ frontend: {
18
+ FOO: "foo from frontend"
19
+ }
20
+ };
21
+ var result = (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
22
+ var _a;
23
+
24
+ return (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName];
25
+ });
26
+ expect(result).toEqual({
27
+ a: "hello world",
28
+ b: "a replaced value looks like this: 'foo from api', nice!"
29
+ });
30
+ });
31
+ it("replaces self references with structure ${VARIABLE_NAME}", function () {
32
+ var variables = {
33
+ FOO: "hello world",
34
+ BAR: "this: ${FOO}!"
35
+ };
36
+ var result = (0, resolveReferences_1.resolveReferences)(variables);
37
+ expect(result).toEqual({
38
+ FOO: "hello world",
39
+ BAR: "this: hello world!"
40
+ });
41
+ });
42
+ it("replaces self references mixed with other vars", function () {
43
+ var variables = {
44
+ FOO: "hello from ${api:FOO}",
45
+ BAR: "this: ${FOO}!"
46
+ };
47
+ var otherVariables = {
48
+ api: {
49
+ FOO: "foo from api"
50
+ }
51
+ };
52
+ var result = (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
53
+ var _a;
54
+
55
+ return (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName];
56
+ });
57
+ expect(result).toEqual({
58
+ FOO: "hello from foo from api",
59
+ BAR: "this: hello from foo from api!"
60
+ });
61
+ });
62
+ it("keeps variables as is if not found (when null is returned)", function () {
63
+ var variables = {
64
+ a: "hello world",
65
+ b: "a not found value looks like this: '${api:FOO}'"
66
+ };
67
+ var otherVariables = {};
68
+ var result = (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
69
+ var _a;
70
+
71
+ return (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName];
72
+ });
73
+ expect(result).toEqual({
74
+ a: "hello world",
75
+ b: "a not found value looks like this: '${api:FOO}'"
76
+ });
77
+ });
78
+ it("replaces mulitple levels deep", function () {
79
+ var variables = {
80
+ a: "value is ${frontend:FOO}!"
81
+ };
82
+ var otherVariables = {
83
+ api: {
84
+ FOO: "foo from api"
85
+ },
86
+ frontend: {
87
+ FOO: "hi, ${api:FOO}"
88
+ }
89
+ };
90
+ var result = (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
91
+ var _a, _b;
92
+
93
+ return (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : "";
94
+ });
95
+ expect(result).toEqual({
96
+ a: "value is hi, foo from api!"
97
+ });
98
+ });
99
+ it("prevents endless loops", function () {
100
+ var variables = {
101
+ a: "value is ${frontend:FOO}!"
102
+ };
103
+ var otherVariables = {
104
+ api: {
105
+ FOO: "api ${frontend:FOO}"
106
+ },
107
+ frontend: {
108
+ FOO: "frontend ${api:FOO}"
109
+ }
110
+ };
111
+ var result = (0, resolveReferences_1.resolveReferences)(variables, function (componentName, variableName) {
112
+ var _a, _b;
113
+
114
+ return (_b = (_a = otherVariables[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) !== null && _b !== void 0 ? _b : "";
115
+ });
116
+ expect(result).toEqual({
117
+ a: "value is frontend api ${frontend:FOO}!"
118
+ });
119
+ });
120
+ });
121
+ describe("translateLegacyFromComponents", function () {
122
+ it("translatetes the old `fromComponents` approach to ${componentName:variableName}", function () {
123
+ var fromComponents = {
124
+ api: {
125
+ API_FOO: "FOO",
126
+ API_BAR: "BAR"
127
+ },
128
+ www: {
129
+ WWW_X: "X",
130
+ WWW_Y: "Y"
131
+ }
132
+ };
133
+ var result = (0, resolveReferences_1.translateLegacyFromComponents)(fromComponents);
134
+ expect(result).toEqual({
135
+ API_FOO: "${api:FOO}",
136
+ API_BAR: "${api:BAR}",
137
+ WWW_X: "${www:X}",
138
+ WWW_Y: "${www:Y}"
139
+ });
140
+ });
141
+ });
@@ -70,6 +70,8 @@ var cloudsql_1 = require("./cloudsql");
70
70
 
71
71
  var mongodb_1 = require("./mongodb");
72
72
 
73
+ var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
74
+
73
75
  var createKubernetesDeployJobs = function (context) {
74
76
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
75
77
 
@@ -135,7 +137,7 @@ var createKubernetesDeployJobs = function (context) {
135
137
  env: env
136
138
  }, ((_l = (_k = deployConfig.values) === null || _k === void 0 ? void 0 : _k.cloudsql) === null || _l === void 0 ? void 0 : _l.enabled) ? (0, cloudsql_1.createCloudsqlBaseConfig)(context) : {}), ((_o = (_m = deployConfig.values) === null || _m === void 0 ? void 0 : _m.mongodb) === null || _o === void 0 ? void 0 : _o.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
137
139
 
138
- var kubeValues = (0, utils_1.mergeWithMergingArrays)(defaultKubeValues, deployConfig.values);
140
+ var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, deployConfig.values));
139
141
  var kubernetesEnvironment = {
140
142
  namespace: context.environment.envVars.KUBE_NAMESPACE
141
143
  };
@@ -0,0 +1,86 @@
1
+ export declare const processSecretsAsFiles: <T extends {
2
+ env: {
3
+ secret: Record<string, string>;
4
+ };
5
+ } & {
6
+ cloudsql?: {
7
+ enabled: boolean;
8
+ instanceId?: string | undefined;
9
+ projectId?: string | undefined;
10
+ region?: string | undefined;
11
+ } | undefined;
12
+ mongodb?: ({
13
+ enabled: boolean;
14
+ } & Record<string, unknown>) | undefined;
15
+ mailhog?: {
16
+ enabled: boolean;
17
+ } | undefined;
18
+ jobs?: Record<string, {
19
+ command: string;
20
+ } & Record<string, unknown>> | undefined;
21
+ cronjobs?: Record<string, {
22
+ schedule: string;
23
+ command: string;
24
+ concurrencyPolicy?: "Forbid" | "Allow" | "Replace" | undefined;
25
+ } & Record<string, unknown>> | undefined;
26
+ application?: ({
27
+ redirects?: ({
28
+ host: string;
29
+ } & Record<string, unknown>)[] | undefined;
30
+ replicas?: number | undefined;
31
+ resources?: {
32
+ limits?: {
33
+ cpu?: string | undefined;
34
+ memory?: string | undefined;
35
+ } | undefined;
36
+ requests?: {
37
+ cpu?: string | undefined;
38
+ memory?: string | undefined;
39
+ } | undefined;
40
+ } | undefined;
41
+ healthRoute?: string | undefined;
42
+ startupProbe?: {
43
+ httpGet?: {
44
+ path?: string | undefined;
45
+ port?: number | undefined;
46
+ httpHeaders?: {
47
+ name: string;
48
+ value: string;
49
+ }[] | undefined;
50
+ failureThreshold?: number | undefined;
51
+ timeoutSeconds?: number | undefined;
52
+ periodSeconds?: number | undefined;
53
+ successThreshold?: number | undefined;
54
+ } | undefined;
55
+ } | undefined;
56
+ readinessProbe?: {
57
+ httpGet?: {
58
+ path?: string | undefined;
59
+ port?: number | undefined;
60
+ httpHeaders?: {
61
+ name: string;
62
+ value: string;
63
+ }[] | undefined;
64
+ failureThreshold?: number | undefined;
65
+ timeoutSeconds?: number | undefined;
66
+ periodSeconds?: number | undefined;
67
+ successThreshold?: number | undefined;
68
+ } | undefined;
69
+ } | undefined;
70
+ livenessProbe?: {
71
+ httpGet?: {
72
+ path?: string | undefined;
73
+ port?: number | undefined;
74
+ httpHeaders?: {
75
+ name: string;
76
+ value: string;
77
+ }[] | undefined;
78
+ failureThreshold?: number | undefined;
79
+ timeoutSeconds?: number | undefined;
80
+ periodSeconds?: number | undefined;
81
+ successThreshold?: number | undefined;
82
+ } | undefined;
83
+ } | undefined;
84
+ } & Record<string, unknown>) | undefined;
85
+ secretsAsFile?: string[] | undefined;
86
+ } & Record<string, unknown>>(values: T) => T;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ var __assign = this && this.__assign || function () {
4
+ __assign = Object.assign || function (t) {
5
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
6
+ s = arguments[i];
7
+
8
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
+ }
10
+
11
+ return t;
12
+ };
13
+
14
+ return __assign.apply(this, arguments);
15
+ };
16
+
17
+ exports.__esModule = true;
18
+ exports.processSecretsAsFiles = void 0;
19
+
20
+ var lodash_1 = require("lodash");
21
+
22
+ var processSecretsAsFiles = function (values) {
23
+ if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
24
+ return values;
25
+ } // the initial idea was that we "shadow" secrets that we mount as files,
26
+ // but there is a weird kubernetes issue with that (https://github.com/kubernetes/kubernetes/issues/46861),
27
+ // so instead we rename the secrets and append _content, so that inside kuberentes, we can use the original name to contain the path and name+_content as the actual content
28
+
29
+
30
+ return __assign(__assign({}, values), {
31
+ env: __assign(__assign({}, values.env), {
32
+ secret: __assign(__assign({}, (0, lodash_1.omit)(values.env.secret, values.secretsAsFile)), Object.fromEntries(values.secretsAsFile.map(function (key) {
33
+ return [key + "_content", values.env.secret[key]];
34
+ })))
35
+ })
36
+ });
37
+ };
38
+
39
+ exports.processSecretsAsFiles = processSecretsAsFiles;
@@ -120,6 +120,12 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
120
120
  readinessProbe?: KubernetesHealthDef;
121
121
  livenessProbe?: KubernetesHealthDef;
122
122
  }>;
123
+ /**
124
+ * Mount secrets as files in the filesystem.
125
+ * These secrets are still available as env vars, but will contain the path of the file instead
126
+ */
127
+
128
+ secretsAsFile?: string[];
123
129
  }>;
124
130
  export declare type DeployConfigKubernetes = {
125
131
  type: "kubernetes";