@catladder/pipeline 1.75.4 → 1.76.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.
Files changed (112) hide show
  1. package/dist/build/base/createBuildJob.js +5 -27
  2. package/dist/build/base/writeBuildInfo.js +0 -3
  3. package/dist/build/custom/buildJob.js +3 -23
  4. package/dist/build/custom/index.js +3 -10
  5. package/dist/build/docker.js +5 -40
  6. package/dist/build/index.js +0 -8
  7. package/dist/build/node/buildJob.js +3 -25
  8. package/dist/build/node/cache.js +3 -21
  9. package/dist/build/node/index.js +3 -16
  10. package/dist/build/node/meteor.js +3 -20
  11. package/dist/build/node/testJob.js +5 -22
  12. package/dist/build/node/yarn.js +5 -18
  13. package/dist/build/rails/build.js +2 -8
  14. package/dist/build/rails/index.js +3 -11
  15. package/dist/build/rails/test.js +5 -18
  16. package/dist/build/types.d.ts +0 -9
  17. package/dist/build/types.js +0 -4
  18. package/dist/bundles/catladder-gitlab/index.js +1 -1
  19. package/dist/catladder-gitlab.js +6 -24
  20. package/dist/config/{configruedEnvs.test.d.ts → __tests__/configruedEnvs.test.d.ts} +0 -0
  21. package/dist/config/{configruedEnvs.test.js → __tests__/configruedEnvs.test.js} +10 -12
  22. package/dist/config/configruedEnvs.js +7 -22
  23. package/dist/config/index.js +0 -4
  24. package/dist/config/readConfig.js +2 -13
  25. package/dist/constants.js +1 -1
  26. package/dist/context/{resolveReferences.test.d.ts → __tests__/resolveReferences.test.d.ts} +0 -0
  27. package/dist/context/{resolveReferences.test.js → __tests__/resolveReferences.test.js} +52 -103
  28. package/dist/context/getEnvConfig.js +0 -8
  29. package/dist/context/getEnvType.js +0 -5
  30. package/dist/context/getEnvironment.js +13 -49
  31. package/dist/context/getEnvironmentContext.js +0 -5
  32. package/dist/context/getEnvironmentVariables.js +20 -83
  33. package/dist/context/getLabels.js +2 -13
  34. package/dist/context/index.js +13 -58
  35. package/dist/context/resolveReferences.js +36 -126
  36. package/dist/deploy/base.js +4 -19
  37. package/dist/deploy/cloudRun/deployJob.js +19 -61
  38. package/dist/deploy/cloudRun/index.js +17 -39
  39. package/dist/deploy/cloudRun/utils/database.js +11 -29
  40. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +0 -4
  41. package/dist/deploy/cloudRun/utils/jobName.js +0 -2
  42. package/dist/deploy/custom/deployJob.js +3 -18
  43. package/dist/deploy/custom/index.js +0 -2
  44. package/dist/deploy/dockerTag/deployJob.js +0 -9
  45. package/dist/deploy/dockerTag/index.js +0 -2
  46. package/dist/deploy/index.js +0 -11
  47. package/dist/deploy/kubernetes/additionalSecretKeys.js +0 -9
  48. package/dist/deploy/kubernetes/cloudSql/index.js +0 -12
  49. package/dist/deploy/kubernetes/deployJob.js +3 -24
  50. package/dist/deploy/kubernetes/index.js +7 -17
  51. package/dist/deploy/kubernetes/kubeEnv.d.ts +0 -1
  52. package/dist/deploy/kubernetes/kubeEnv.js +5 -23
  53. package/dist/deploy/kubernetes/kubeValues.js +6 -24
  54. package/dist/deploy/kubernetes/mongodb.js +0 -24
  55. package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
  56. package/dist/deploy/types/base.d.ts +0 -1
  57. package/dist/deploy/types/custom.d.ts +0 -6
  58. package/dist/deploy/types/googleCloudRun.d.ts +4 -12
  59. package/dist/deploy/types/index.js +0 -10
  60. package/dist/deploy/types/kubernetes.d.ts +0 -28
  61. package/dist/deploy/utils.js +0 -11
  62. package/dist/index.js +0 -10
  63. package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
  64. package/dist/pipeline/{createChildPipeline.test.js → commitInfo/getBuildId.js} +25 -84
  65. package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
  66. package/dist/{build/tests/storybook.test.js → pipeline/commitInfo/getCommitInfo.js} +30 -104
  67. package/dist/pipeline/createChildPipeline.js +19 -76
  68. package/dist/pipeline/createJobs.js +35 -135
  69. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +1 -0
  70. package/dist/pipeline/gitlab/makeGitlabJob.js +13 -15
  71. package/dist/pipeline/index.js +0 -4
  72. package/dist/pipeline/packageManager.js +20 -173
  73. package/dist/pipeline/yarn/yarnUtils.d.ts +4 -0
  74. package/dist/pipeline/yarn/yarnUtils.js +193 -0
  75. package/dist/runner/index.js +0 -3
  76. package/dist/tsconfig.tsbuildinfo +1 -1
  77. package/dist/types/config.d.ts +0 -13
  78. package/dist/types/config.js +5 -15
  79. package/dist/types/context.d.ts +0 -2
  80. package/dist/types/environmentContext.d.ts +0 -1
  81. package/dist/types/gitlab-types.d.ts +0 -1
  82. package/dist/types/index.js +0 -6
  83. package/dist/types/jobs.d.ts +5 -15
  84. package/dist/utils/gitlab.js +3 -13
  85. package/dist/utils/index.js +5 -15
  86. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1765 -0
  87. package/examples/__snapshots__/custom-build-job.ts.snap +1174 -0
  88. package/examples/__snapshots__/custom-envs.ts.snap +261 -0
  89. package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
  90. package/examples/__utils__/helpers.ts +14 -0
  91. package/examples/{cloud-sql.ts → cloud-run-with-sql.ts} +12 -15
  92. package/examples/custom-build-job.ts +4 -1
  93. package/examples/custom-envs.ts +31 -0
  94. package/examples/wait-for-other-deploy.ts +36 -0
  95. package/package.json +2 -2
  96. package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
  97. package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +3 -3
  98. package/src/deploy/cloudRun/index.ts +2 -1
  99. package/src/deploy/types/googleCloudRun.ts +5 -0
  100. package/src/pipeline/commitInfo/getBuildId.ts +6 -0
  101. package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
  102. package/src/pipeline/createChildPipeline.ts +6 -1
  103. package/src/pipeline/createJobs.ts +3 -10
  104. package/src/pipeline/gitlab/makeGitlabJob.ts +7 -1
  105. package/src/pipeline/packageManager.ts +4 -38
  106. package/src/pipeline/yarn/yarnUtils.ts +37 -0
  107. package/src/types/jobs.ts +2 -1
  108. package/tsconfig.json +1 -1
  109. package/dist/build/tests/storybook.test.d.ts +0 -1
  110. package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
  111. package/src/build/tests/storybook.test.ts +0 -54
  112. package/src/pipeline/createChildPipeline.test.ts +0 -49
@@ -2,35 +2,24 @@
2
2
 
3
3
  exports.__esModule = true;
4
4
  exports.createCloudsqlBaseConfig = exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
5
-
6
5
  var context_1 = require("../../../context");
7
-
8
6
  var types_1 = require("../../types");
9
-
10
7
  var hasKubernetesCloudSQL = function (context) {
11
8
  var _a, _b;
12
-
13
9
  if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14
10
  return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
15
11
  }
16
-
17
12
  return false;
18
13
  };
19
-
20
14
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
21
-
22
15
  var getKubernetesCloudSQLConfig = function (context) {
23
16
  var _a;
24
-
25
17
  if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
26
18
  return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
27
19
  }
28
-
29
20
  throw new Error("cannot get cloud sql config");
30
21
  };
31
-
32
22
  exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
33
-
34
23
  var createCloudsqlBaseConfig = function (context) {
35
24
  return {
36
25
  cloudsql: {
@@ -38,5 +27,4 @@ var createCloudsqlBaseConfig = function (context) {
38
27
  }
39
28
  };
40
29
  };
41
-
42
30
  exports.createCloudsqlBaseConfig = createCloudsqlBaseConfig;
@@ -4,24 +4,19 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  var __read = this && this.__read || function (o, n) {
18
14
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19
15
  if (!m) return o;
20
16
  var i = m.call(o),
21
- r,
22
- ar = [],
23
- e;
24
-
17
+ r,
18
+ ar = [],
19
+ e;
25
20
  try {
26
21
  while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
22
  } catch (error) {
@@ -35,10 +30,8 @@ var __read = this && this.__read || function (o, n) {
35
30
  if (e) throw e.error;
36
31
  }
37
32
  }
38
-
39
33
  return ar;
40
34
  };
41
-
42
35
  var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43
36
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
37
  if (ar || !(i in from)) {
@@ -48,38 +41,25 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
48
41
  }
49
42
  return to.concat(ar || Array.prototype.slice.call(from));
50
43
  };
51
-
52
44
  exports.__esModule = true;
53
45
  exports.createKubernetesDeployJobs = void 0;
54
-
55
46
  var js_yaml_1 = require("js-yaml");
56
-
57
47
  var lodash_1 = require("lodash");
58
-
59
48
  var __1 = require("../..");
60
-
61
49
  var runner_1 = require("../../runner");
62
-
63
50
  var base_1 = require("../base");
64
-
65
51
  var types_1 = require("../types");
66
-
67
52
  var kubeValues_1 = require("./kubeValues");
68
-
69
53
  var createKubernetesDeployJobs = function (context) {
70
54
  var _a, _b;
71
-
72
55
  var deployConfig = context.componentConfig.deploy;
73
-
74
56
  if (deployConfig === false) {
75
57
  return [];
76
58
  }
77
-
78
59
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
79
60
  // should not happen
80
61
  throw new Error("deploy config is not kubernetes");
81
62
  }
82
-
83
63
  var kubeValues = (0, kubeValues_1.createKubeValues)(context);
84
64
  var kubernetesEnvironment = {
85
65
  namespace: context.environment.envVars.KUBE_NAMESPACE
@@ -123,5 +103,4 @@ var createKubernetesDeployJobs = function (context) {
123
103
  }
124
104
  })];
125
105
  };
126
-
127
106
  exports.createKubernetesDeployJobs = createKubernetesDeployJobs;
@@ -12,30 +12,21 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
12
12
  if (k2 === undefined) k2 = k;
13
13
  o[k2] = m[k];
14
14
  });
15
-
16
15
  var __exportStar = this && this.__exportStar || function (m, exports) {
17
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
17
  };
19
-
20
18
  var __importDefault = this && this.__importDefault || function (mod) {
21
19
  return mod && mod.__esModule ? mod : {
22
20
  "default": mod
23
21
  };
24
22
  };
25
-
26
23
  exports.__esModule = true;
27
24
  exports.KUBERNETES_DEPLOY_TYPE = void 0;
28
-
29
25
  var slugify_1 = __importDefault(require("slugify"));
30
-
31
26
  var __1 = require("..");
32
-
33
27
  var additionalSecretKeys_1 = require("./additionalSecretKeys");
34
-
35
28
  var deployJob_1 = require("./deployJob");
36
-
37
29
  __exportStar(require("./cloudSql"), exports);
38
-
39
30
  exports.KUBERNETES_DEPLOY_TYPE = {
40
31
  jobs: deployJob_1.createKubernetesDeployJobs,
41
32
  defaults: function () {
@@ -44,22 +35,21 @@ exports.KUBERNETES_DEPLOY_TYPE = {
44
35
  additionalSecretKeys: additionalSecretKeys_1.additionalKubernetesSecretKeys,
45
36
  getAdditionalEnvVars: function (_a) {
46
37
  var _b;
47
-
48
38
  var componentName = _a.componentName,
49
- fullConfig = _a.fullConfig,
50
- deployConfigRaw = _a.deployConfigRaw,
51
- env = _a.env,
52
- envType = _a.envType,
53
- commitInfo = _a.commitInfo;
39
+ fullConfig = _a.fullConfig,
40
+ deployConfigRaw = _a.deployConfigRaw,
41
+ env = _a.env,
42
+ envType = _a.envType,
43
+ commitInfo = _a.commitInfo;
54
44
  var KUBE_APP_NAME_PREFIX = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, "-") : "";
55
45
  var KUBE_APP_NAME = "".concat(KUBE_APP_NAME_PREFIX).concat(componentName);
56
46
  var KUBE_NAMESPACE = (0, __1.getKubernetesNamespace)(fullConfig, env);
57
47
  var componentSlug = (0, slugify_1["default"])(componentName);
58
48
  var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.reviewSlug, ".").concat(env) : env;
59
- var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) || // 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
49
+ var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) ||
50
+ // 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
60
51
  fullConfig.domainCanonical || "panter.cloud";
61
52
  var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
62
-
63
53
  return {
64
54
  KUBE_NAMESPACE: KUBE_NAMESPACE,
65
55
  KUBE_APP_NAME: KUBE_APP_NAME,
@@ -3,7 +3,6 @@ import type { Context } from "../../types";
3
3
  * separate by secrets and public.
4
4
  * we evalulate the actual values later, but want to store the secrets in kubernetes secrets
5
5
  */
6
-
7
6
  export declare const createKubeEnv: (context: Context) => {
8
7
  secret: Record<string, string>;
9
8
  public: Record<string, string>;
@@ -4,24 +4,19 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  var __read = this && this.__read || function (o, n) {
18
14
  var m = typeof Symbol === "function" && o[Symbol.iterator];
19
15
  if (!m) return o;
20
16
  var i = m.call(o),
21
- r,
22
- ar = [],
23
- e;
24
-
17
+ r,
18
+ ar = [],
19
+ e;
25
20
  try {
26
21
  while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
27
22
  } catch (error) {
@@ -35,49 +30,37 @@ var __read = this && this.__read || function (o, n) {
35
30
  if (e) throw e.error;
36
31
  }
37
32
  }
38
-
39
33
  return ar;
40
34
  };
41
-
42
35
  exports.__esModule = true;
43
36
  exports.createKubeEnv = void 0;
44
-
45
37
  var types_1 = require("../types");
46
-
47
38
  var shouldGoIntoSecrets = function (key, value) {
48
39
  var _a;
49
-
50
40
  if ((_a = String(value)) === null || _a === void 0 ? void 0 : _a.includes("$CL_")) {
51
41
  return true;
52
42
  }
53
-
54
43
  return false;
55
44
  };
56
45
  /**
57
46
  * separate by secrets and public.
58
47
  * we evalulate the actual values later, but want to store the secrets in kubernetes secrets
59
48
  */
60
-
61
-
62
49
  var createKubeEnv = function (context) {
63
50
  if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
64
51
  // should not happen
65
52
  throw new Error("deploy config is not kubernetes");
66
53
  }
67
-
68
54
  var allEnvVars = context.environment.envVars;
69
55
  var env = Object.entries(allEnvVars).reduce(function (acc, _a) {
70
56
  var _b, _c;
71
-
72
57
  var _d = __read(_a, 2),
73
- key = _d[0],
74
- value = _d[1];
75
-
58
+ key = _d[0],
59
+ value = _d[1];
76
60
  if (shouldGoIntoSecrets(key, value)) {
77
61
  acc.secret = __assign(__assign({}, acc.secret), (_b = {}, _b[key] = value, _b));
78
62
  return acc;
79
63
  }
80
-
81
64
  acc.public = __assign(__assign({}, acc.public), (_c = {}, _c[key] = value, _c));
82
65
  return acc;
83
66
  }, {
@@ -86,5 +69,4 @@ var createKubeEnv = function (context) {
86
69
  });
87
70
  return env;
88
71
  };
89
-
90
72
  exports.createKubeEnv = createKubeEnv;
@@ -2,41 +2,28 @@
2
2
 
3
3
  var __rest = this && this.__rest || function (s, e) {
4
4
  var t = {};
5
-
6
5
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
7
-
8
6
  if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
9
7
  if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
10
8
  }
11
9
  return t;
12
10
  };
13
-
14
11
  exports.__esModule = true;
15
12
  exports.createKubeValues = void 0;
16
-
17
13
  var lodash_1 = require("lodash");
18
-
19
14
  var utils_1 = require("../../utils");
20
-
21
15
  var types_1 = require("../types");
22
-
23
16
  var cloudSql_1 = require("./cloudSql");
24
-
25
17
  var kubeEnv_1 = require("./kubeEnv");
26
-
27
18
  var mongodb_1 = require("./mongodb");
28
-
29
19
  var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
30
-
31
20
  var createAppConfig = function (context, application) {
32
21
  var _a, _b, _c;
33
-
34
22
  if (application === false) {
35
23
  return {
36
24
  enabled: false
37
25
  };
38
26
  }
39
-
40
27
  return (0, utils_1.mergeWithMergingArrays)({
41
28
  host: context.environment.host,
42
29
  command: context.componentConfig.build.startCommand,
@@ -55,33 +42,29 @@ var createAppConfig = function (context, application) {
55
42
  path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
56
43
  }
57
44
  }
58
- }, // default
45
+ },
46
+ // default
59
47
  application // merge rest in
60
48
  );
61
49
  };
62
50
 
63
51
  var createKubeValues = function (context) {
64
52
  var _a, _b;
65
-
66
53
  var deployConfig = context.componentConfig.deploy;
67
-
68
54
  if (deployConfig === false) {
69
55
  return [];
70
56
  }
71
-
72
57
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
73
58
  // should not happen
74
59
  throw new Error("deploy config is not kubernetes");
75
60
  }
76
-
77
- var values = deployConfig.values; // we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
61
+ var values = deployConfig.values;
62
+ // we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
78
63
  // we only merge the rest of the values in
79
64
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
80
-
81
65
  var _c = values !== null && values !== void 0 ? values : {},
82
- application = _c.application,
83
- rest = __rest(_c, ["application"]);
84
-
66
+ application = _c.application,
67
+ rest = __rest(_c, ["application"]);
85
68
  var env = (0, kubeEnv_1.createKubeEnv)(context);
86
69
  var defaultKubeValues = (0, lodash_1.merge)({
87
70
  env: env,
@@ -90,5 +73,4 @@ var createKubeValues = function (context) {
90
73
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, rest));
91
74
  return kubeValues;
92
75
  };
93
-
94
76
  exports.createKubeValues = createKubeValues;
@@ -4,53 +4,39 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  exports.__esModule = true;
18
14
  exports.createMongodbBaseConfig = void 0;
19
-
20
15
  var lodash_1 = require("lodash");
21
-
22
16
  var __1 = require("../..");
23
-
24
17
  var getCredentialString = function (context) {
25
18
  return "root:$".concat((0, __1.getSecretVarNameForContext)(context, "MONGODB_ROOT_PASSWORD"), "@");
26
19
  };
27
-
28
20
  var getMongodbHost = function (context, name) {
29
21
  var namespace = context.environment.envVars.KUBE_NAMESPACE;
30
22
  return "".concat(name, ".").concat(namespace, ".svc.cluster.local:27017");
31
23
  };
32
-
33
24
  var getMongodbStandaloneHost = function (context) {
34
25
  var fullAppname = context.environment.envVars.KUBE_APP_NAME;
35
26
  return getMongodbHost(context, "".concat(fullAppname, "-mongodb"));
36
27
  };
37
-
38
28
  var getMongodbReplicasetHost = function (context, index) {
39
29
  var fullAppname = context.environment.envVars.KUBE_APP_NAME;
40
30
  return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
41
31
  };
42
-
43
32
  var createMongodbUrl = function (context, dbName) {
44
33
  var _a, _b;
45
-
46
34
  if (!(0, __1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
47
35
  throw new Error("can only createMongodbUrl on supported deploys");
48
36
  }
49
-
50
37
  var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
51
38
  var queryParams = undefined;
52
39
  var hosts = "";
53
-
54
40
  if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
55
41
  hosts = (0, lodash_1.range)(0, (_b = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _b !== void 0 ? _b : 2).map(function (i) {
56
42
  return getMongodbReplicasetHost(context, i);
@@ -60,23 +46,18 @@ var createMongodbUrl = function (context, dbName) {
60
46
  hosts = getMongodbStandaloneHost(context);
61
47
  queryParams = "authSource=admin";
62
48
  }
63
-
64
49
  return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
65
50
  };
66
-
67
51
  var createMongoBackupDefaultConfig = function (context) {
68
52
  var _a;
69
-
70
53
  if (!(0, __1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
71
54
  throw new Error("can only create mongodb base config on supported deploys");
72
55
  }
73
-
74
56
  var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
75
57
  var fullAppName = context.environment.envVars.KUBE_APP_NAME;
76
58
  var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
77
59
  var hostToBackup;
78
60
  var pvcToBackup;
79
-
80
61
  if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
81
62
  // bit quirky, we need to specify the host and its volume
82
63
  // on replicaset its probably best to not use the first one, whcih usually starts as master, so we take the second (last one would also be ok)
@@ -87,7 +68,6 @@ var createMongoBackupDefaultConfig = function (context) {
87
68
  hostToBackup = getMongodbStandaloneHost(context);
88
69
  pvcToBackup = "".concat(fullAppName, "-mongodb");
89
70
  }
90
-
91
71
  return {
92
72
  enabled: backupEnabled,
93
73
  hostToBackup: hostToBackup,
@@ -97,14 +77,11 @@ var createMongoBackupDefaultConfig = function (context) {
97
77
  volumeSnapshotClass: "snapshotclass"
98
78
  };
99
79
  };
100
-
101
80
  var createMongodbBaseConfig = function (context) {
102
81
  var _a, _b;
103
-
104
82
  if (!(0, __1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
105
83
  throw new Error("can only create mongodb base config on supported deploys");
106
84
  }
107
-
108
85
  var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
109
86
  return {
110
87
  mongodb: {
@@ -129,5 +106,4 @@ var createMongodbBaseConfig = function (context) {
129
106
  }
130
107
  };
131
108
  };
132
-
133
109
  exports.createMongodbBaseConfig = createMongodbBaseConfig;
@@ -4,29 +4,22 @@ var __assign = this && this.__assign || function () {
4
4
  __assign = Object.assign || function (t) {
5
5
  for (var s, i = 1, n = arguments.length; i < n; i++) {
6
6
  s = arguments[i];
7
-
8
7
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
9
8
  }
10
-
11
9
  return t;
12
10
  };
13
-
14
11
  return __assign.apply(this, arguments);
15
12
  };
16
-
17
13
  exports.__esModule = true;
18
14
  exports.processSecretsAsFiles = void 0;
19
-
20
15
  var lodash_1 = require("lodash");
21
-
22
16
  var processSecretsAsFiles = function (values) {
23
17
  if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
24
18
  return values;
25
- } // the initial idea was that we "shadow" secrets that we mount as files,
19
+ }
20
+ // the initial idea was that we "shadow" secrets that we mount as files,
26
21
  // but there is a weird kubernetes issue with that (https://github.com/kubernetes/kubernetes/issues/46861),
27
22
  // 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
23
  return __assign(__assign({}, values), {
31
24
  env: __assign(__assign({}, values.env), {
32
25
  secret: __assign(__assign({}, (0, lodash_1.omit)(values.env.secret, values.secretsAsFile)), Object.fromEntries(values.secretsAsFile.map(function (key) {
@@ -35,5 +28,4 @@ var processSecretsAsFiles = function (values) {
35
28
  })
36
29
  });
37
30
  };
38
-
39
31
  exports.processSecretsAsFiles = processSecretsAsFiles;
@@ -9,7 +9,6 @@ export declare type DeployConfigBase = {
9
9
  * EXPERIMENTAL
10
10
  * wait for other components to deploy first, before doing this deployment
11
11
  */
12
-
13
12
  waitFor?: string[];
14
13
  };
15
14
  export declare type AllowUnknownProps<T extends Record<string, unknown>> = T & Record<string, unknown>;
@@ -8,31 +8,25 @@ export declare type DeployConfigCustom = {
8
8
  /**
9
9
  * whether the deploy script requires a docker image to be built
10
10
  */
11
-
12
11
  requiresDocker: boolean;
13
12
  /**
14
13
  * whether your custom script requires yarn install
15
14
  */
16
-
17
15
  requiresYarnInstall?: boolean;
18
16
  /**
19
17
  * your custom script
20
18
  */
21
-
22
19
  script: string[];
23
20
  /**
24
21
  * script to run to stop the environment
25
22
  */
26
-
27
23
  stopScript?: string[];
28
24
  /**
29
25
  * image to use
30
26
  */
31
-
32
27
  jobImage?: string;
33
28
  /**
34
29
  * customize cache for the job
35
30
  */
36
-
37
31
  jobCache?: CatladderJob["cache"];
38
32
  } & DeployConfigBase;
@@ -3,23 +3,24 @@ export declare type Gcloudregion = "asia-east1" | "asia-northeast1" | "asia-nort
3
3
  export declare type DeployConfigCloudRunCloudSql = {
4
4
  type: "unmanaged";
5
5
  instanceConnectionName: string;
6
+ /**
7
+ * the database username, defaults to "postgres"
8
+ */
9
+ dbUser?: string;
6
10
  /**
7
11
  * the prefix of the database, the full db name is this plus the environment slug
8
12
  *
9
13
  * defaults to customerName-appName
10
14
  */
11
-
12
15
  dbNamePrefix?: string | false;
13
16
  /**
14
17
  * whether to delete the database if the environment is stopped
15
18
  * defaults to true for review envs, to false for every other environment
16
19
  */
17
-
18
20
  deleteDatabaseOnStop?: boolean;
19
21
  /**
20
22
  * add additional query params to the database connection string
21
23
  */
22
-
23
24
  dbAdditionalQueryParams?: Record<string, string | number> & {
24
25
  /**
25
26
  * set to 0 for prisma in review or dev apps where you reset the db occasionally without restarting any server
@@ -36,17 +37,14 @@ export declare type DeployConfigCloudRunService = {
36
37
  * how many instances to keep around when there are no requests. defaults to 0.
37
38
  * Set to 1 for workers
38
39
  */
39
-
40
40
  minInstances?: number;
41
41
  /**
42
42
  * maximum amount of instances. Defaults to 100
43
43
  */
44
-
45
44
  maxInstances?: number;
46
45
  /**
47
46
  * set to true for workers
48
47
  */
49
-
50
48
  noCpuThrottling?: true;
51
49
  };
52
50
  export declare type DeployConfigCloudRunJobBase = {
@@ -57,7 +55,6 @@ export declare type DeployConfigCloudRunJobBase = {
57
55
  /**
58
56
  * memory limit of the job, defaults to 51Mi
59
57
  */
60
-
61
58
  memory?: `${number}${"M" | "G" | "Mi" | "Gi"}`;
62
59
  };
63
60
  declare type Minute = string;
@@ -85,22 +82,18 @@ export declare type DeployConfigCloudRun = {
85
82
  /**
86
83
  * the google cloud porject id
87
84
  */
88
-
89
85
  projectId: string;
90
86
  /**
91
87
  * the region. Set to europe-west6 for switzerland
92
88
  */
93
-
94
89
  region: Gcloudregion;
95
90
  /**
96
91
  * whether to enable the service, defaults to true
97
92
  */
98
-
99
93
  service?: boolean | DeployConfigCloudRunService;
100
94
  /**
101
95
  * deploy additional services with different entry pointss
102
96
  */
103
-
104
97
  additionalServices?: {
105
98
  [name: string]: DeployConfigCloudRunService;
106
99
  };
@@ -110,7 +103,6 @@ export declare type DeployConfigCloudRun = {
110
103
  /**
111
104
  * add cloudSql
112
105
  */
113
-
114
106
  cloudSql?: DeployConfigCloudRunCloudSql | false;
115
107
  } & DeployConfigBase;
116
108
  export {};
@@ -12,30 +12,20 @@ var __createBinding = this && this.__createBinding || (Object.create ? function
12
12
  if (k2 === undefined) k2 = k;
13
13
  o[k2] = m[k];
14
14
  });
15
-
16
15
  var __exportStar = this && this.__exportStar || function (m, exports) {
17
16
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
17
  };
19
-
20
18
  exports.__esModule = true;
21
19
  exports.isOfDeployType = void 0;
22
-
23
20
  __exportStar(require("./custom"), exports);
24
-
25
21
  __exportStar(require("./googleCloudRun"), exports);
26
-
27
22
  __exportStar(require("./kubernetes"), exports);
28
-
29
23
  __exportStar(require("./dockerTag"), exports);
30
-
31
24
  var isOfDeployType = function (t) {
32
25
  var types = [];
33
-
34
26
  for (var _i = 1; _i < arguments.length; _i++) {
35
27
  types[_i - 1] = arguments[_i];
36
28
  }
37
-
38
29
  return t && types.includes(t.type);
39
30
  };
40
-
41
31
  exports.isOfDeployType = isOfDeployType;