@catladder/pipeline 0.0.0-fix-command-710f75f1 → 0.0.0-fix-error-sql-db-delete-a719775a

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 (98) hide show
  1. package/dist/build/custom/buildJob.js +1 -0
  2. package/dist/build/docker.d.ts +4 -18
  3. package/dist/build/docker.js +15 -9
  4. package/dist/build/index.js +7 -1
  5. package/dist/build/rails/build.js +37 -16
  6. package/dist/build/rails/index.d.ts +2 -2
  7. package/dist/build/rails/test.js +1 -2
  8. package/dist/build/types.d.ts +36 -4
  9. package/dist/bundles/catladder-gitlab/index.js +543 -218
  10. package/dist/constants.js +1 -1
  11. package/dist/context/getEnvironment.js +1 -0
  12. package/dist/context/getEnvironmentContext.js +5 -3
  13. package/dist/context/getEnvironmentVariables.d.ts +5 -1
  14. package/dist/context/getEnvironmentVariables.js +7 -2
  15. package/dist/deploy/base.js +1 -1
  16. package/dist/deploy/cloudRun/index.js +14 -6
  17. package/dist/deploy/custom/deployJob.js +6 -3
  18. package/dist/deploy/index.d.ts +2 -1
  19. package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  20. package/dist/deploy/kubernetes/additionalSecretKeys.js +5 -1
  21. package/dist/deploy/kubernetes/deployJob.js +4 -4
  22. package/dist/deploy/kubernetes/kubeValues.d.ts +1 -0
  23. package/dist/deploy/kubernetes/kubeValues.js +9 -6
  24. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +1 -0
  25. package/dist/deploy/types/custom.d.ts +2 -1
  26. package/dist/deploy/types/googleCloudRun.d.ts +5 -1
  27. package/dist/deploy/types/kubernetes.d.ts +9 -0
  28. package/dist/pipeline/createAllJobs.d.ts +8 -0
  29. package/dist/pipeline/createAllJobs.js +164 -0
  30. package/dist/pipeline/createChildPipeline.js +24 -48
  31. package/dist/pipeline/createJobsForComponent.d.ts +3 -0
  32. package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +8 -105
  33. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
  34. package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
  35. package/dist/pipeline/index.d.ts +1 -1
  36. package/dist/pipeline/index.js +1 -1
  37. package/dist/tsconfig.tsbuildinfo +1 -1
  38. package/dist/types/config.d.ts +3 -3
  39. package/dist/types/context.d.ts +3 -1
  40. package/dist/types/environmentContext.d.ts +7 -0
  41. package/dist/types/gitlab-types.d.ts +5 -1
  42. package/dist/types/jobs.d.ts +9 -2
  43. package/dist/utils/gitlab.js +1 -1
  44. package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +32 -32
  45. package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +32 -32
  46. package/examples/__snapshots__/cloud-run-non-public.ts.snap +32 -32
  47. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3116 -0
  48. package/examples/__snapshots__/cloud-run-with-sql.ts.snap +64 -64
  49. package/examples/__snapshots__/custom-build-job.ts.snap +32 -32
  50. package/examples/__snapshots__/custom-deploy.ts.snap +1384 -0
  51. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
  52. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +2204 -0
  53. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +24 -24
  54. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
  55. package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
  56. package/examples/custom-deploy.ts +25 -0
  57. package/examples/kubernetes-application-customization.ts +57 -0
  58. package/examples/kubernetes-with-cloud-sql-legacy.ts +33 -0
  59. package/examples/rails-k8s-with-worker.ts +95 -0
  60. package/package.json +1 -1
  61. package/src/build/custom/buildJob.ts +1 -0
  62. package/src/build/docker.ts +13 -6
  63. package/src/build/index.ts +7 -1
  64. package/src/build/node/cache.ts +2 -2
  65. package/src/build/rails/build.ts +20 -10
  66. package/src/build/rails/index.ts +2 -2
  67. package/src/build/rails/test.ts +43 -39
  68. package/src/build/types.ts +40 -5
  69. package/src/config/configruedEnvs.ts +2 -8
  70. package/src/context/getEnvironment.ts +1 -0
  71. package/src/context/getEnvironmentContext.ts +6 -6
  72. package/src/context/getEnvironmentVariables.ts +9 -4
  73. package/src/deploy/base.ts +1 -1
  74. package/src/deploy/cloudRun/deployJob.ts +1 -1
  75. package/src/deploy/cloudRun/index.ts +12 -4
  76. package/src/deploy/custom/deployJob.ts +9 -1
  77. package/src/deploy/index.ts +4 -1
  78. package/src/deploy/kubernetes/additionalSecretKeys.ts +1 -1
  79. package/src/deploy/kubernetes/deployJob.ts +2 -1
  80. package/src/deploy/kubernetes/kubeValues.ts +7 -5
  81. package/src/deploy/types/custom.ts +2 -1
  82. package/src/deploy/types/googleCloudRun.ts +6 -1
  83. package/src/deploy/types/kubernetes.ts +11 -1
  84. package/src/pipeline/createAllJobs.ts +38 -0
  85. package/src/pipeline/createChildPipeline.ts +6 -22
  86. package/src/pipeline/createJobsForComponent.ts +64 -0
  87. package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
  88. package/src/pipeline/index.ts +1 -1
  89. package/src/types/context.ts +3 -1
  90. package/src/types/environmentContext.ts +7 -0
  91. package/src/types/gitlab-types.ts +10 -3
  92. package/src/types/jobs.ts +11 -2
  93. package/src/utils/gitlab.ts +1 -1
  94. package/dist/pipeline/createJobs.d.ts +0 -3
  95. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -10
  96. package/dist/pipeline/gitlab/makeGitlabJob.js +0 -44
  97. package/src/pipeline/createJobs.ts +0 -199
  98. package/src/pipeline/gitlab/makeGitlabJob.ts +0 -23
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-command-710f75f1" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "fix-error-sql-db-delete-a719775a" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -139,6 +139,7 @@ var getEnvironment = function (config, componentName, env, commitInfo) {
139
139
  url: url
140
140
  },
141
141
  fullName: envContext.fullName,
142
+ slugPrefix: envContext.environmentSlugPrefix,
142
143
  slug: envContext.environmentSlug,
143
144
  shortName: env,
144
145
  envVars: envVars,
@@ -4,20 +4,22 @@ exports.__esModule = true;
4
4
  exports.getEnvironmentContext = void 0;
5
5
  var getEnvConfig_1 = require("./getEnvConfig");
6
6
  var getEnvType_1 = require("./getEnvType");
7
- var getEnvironmentSlug = function (envConfig, env, componentName, commitInfo) {
7
+ var getEnvironmentSlugPrefix = function (envConfig, env, commitInfo) {
8
8
  var envType = (0, getEnvType_1.getEnvType)(env, envConfig);
9
- return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
9
+ return envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.reviewSlug) : "".concat(env);
10
10
  };
11
11
  var getEnvironmentContext = function (config, env, componentName, commitInfo) {
12
12
  var envConfigRaw = (0, getEnvConfig_1.getEnvConfig)(config, componentName, env);
13
13
  var envType = (0, getEnvType_1.getEnvType)(env, envConfigRaw);
14
- var environmentSlug = getEnvironmentSlug(envConfigRaw, env, componentName, commitInfo);
14
+ var environmentSlugPrefix = getEnvironmentSlugPrefix(envConfigRaw, env, commitInfo);
15
+ var environmentSlug = "".concat(environmentSlugPrefix, "-").concat(componentName);
15
16
  var gitlabEnvironmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
16
17
  var fullName = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
17
18
  return {
18
19
  envConfigRaw: envConfigRaw,
19
20
  deployConfigRaw: envConfigRaw.deploy,
20
21
  buildConfigRaw: envConfigRaw.build,
22
+ environmentSlugPrefix: environmentSlugPrefix,
21
23
  environmentSlug: environmentSlug,
22
24
  gitlabEnvironmentName: gitlabEnvironmentName,
23
25
  fullName: fullName,
@@ -1,8 +1,12 @@
1
1
  import type { CommitInfo, Context } from "../types";
2
2
  import type { Config } from "../types/config";
3
+ export declare type SecretEnvVar = {
4
+ key: string;
5
+ hidden?: boolean;
6
+ };
3
7
  export declare const getEnvironmentVariables: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<{
4
8
  envVars: Record<string, string>;
5
- secretEnvVarKeys: string[];
9
+ secretEnvVarKeys: SecretEnvVar[];
6
10
  host: string;
7
11
  url: string;
8
12
  }>;
@@ -202,8 +202,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
202
202
  }
203
203
  publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
204
204
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
205
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
206
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
205
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
206
+ return {
207
+ key: key
208
+ };
209
+ })), false), __read(additionalSecretKeys), false);
210
+ secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
211
+ var key = _a.key;
207
212
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
208
213
  }));
209
214
  legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
@@ -38,7 +38,7 @@ var getBaseDeploymentJob = function (context) {
38
38
  return {
39
39
  name: exports.DEPLOY_JOB_NAME,
40
40
  envMode: "stagePerEnv",
41
- needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
41
+ needs: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
42
42
  return {
43
43
  componentName: c,
44
44
  job: exports.DEPLOY_JOB_NAME,
@@ -50,15 +50,15 @@ var jobName_1 = require("./utils/jobName");
50
50
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
51
51
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
52
52
  var getCloudSqlVariables = function (_a) {
53
- var _b, _c, _d;
53
+ var _b, _c, _d, _e;
54
54
  var deployConfigRaw = _a.deployConfigRaw,
55
- environmentSlug = _a.environmentSlug,
55
+ environmentSlugPrefix = _a.environmentSlugPrefix,
56
56
  env = _a.env,
57
57
  componentName = _a.componentName,
58
58
  fullConfig = _a.fullConfig;
59
59
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
60
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlug].filter(Boolean).join("-");
61
- var additionalQueryParamsString = Object.entries((_c = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
60
+ var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
61
+ var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
62
62
  var _b = __read(_a, 2),
63
63
  key = _b[0],
64
64
  value = _b[1];
@@ -67,7 +67,7 @@ var getCloudSqlVariables = function (_a) {
67
67
  return {
68
68
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
69
69
  DB_NAME: DB_NAME,
70
- DB_USER: (_d = deployConfigRaw.cloudSql.dbUser) !== null && _d !== void 0 ? _d : "postgres",
70
+ DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
71
71
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
72
72
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
73
73
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -90,7 +90,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
90
90
  return {};
91
91
  },
92
92
  additionalSecretKeys: function (ctx) {
93
- return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
93
+ return __spreadArray([{
94
+ key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
95
+ hidden: true
96
+ }, {
97
+ key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
98
+ hidden: true
99
+ }], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
100
+ key: "DB_PASSWORD"
101
+ }] : []), false);
94
102
  },
95
103
  getAdditionalEnvVars: function (ctx) {
96
104
  var _a;
@@ -39,7 +39,7 @@ var runner_1 = require("../../runner");
39
39
  var base_1 = require("../base");
40
40
  var types_1 = require("../types");
41
41
  var createCustomDeployJobs = function (context) {
42
- var _a, _b;
42
+ var _a, _b, _c;
43
43
  var deployConfig = context.componentConfig.deploy;
44
44
  if (deployConfig === false) {
45
45
  return [];
@@ -50,10 +50,13 @@ var createCustomDeployJobs = function (context) {
50
50
  }
51
51
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
52
52
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
53
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
53
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
54
54
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
55
55
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
56
56
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
57
- })];
57
+ })], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
58
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
59
+ script: deployConfig.stopScript
60
+ })] : []), false);
58
61
  };
59
62
  exports.createCustomDeployJobs = createCustomDeployJobs;
@@ -1,3 +1,4 @@
1
+ import type { SecretEnvVar } from "..";
1
2
  import type { Context } from "../types/context";
2
3
  import type { EnvironmentContext } from "../types/environmentContext";
3
4
  import type { CatladderJob } from "../types/jobs";
@@ -10,7 +11,7 @@ export * from "./utils";
10
11
  export declare type DeployTypeDefinition<T extends DeployConfigType> = {
11
12
  jobs: (context: Context) => CatladderJob[];
12
13
  defaults: (envContext: EnvironmentContext<any, T>) => PartialDeep<DeployConfigGeneric<T>>;
13
- additionalSecretKeys: (envContext: EnvironmentContext<any, T>) => string[];
14
+ additionalSecretKeys: (envContext: EnvironmentContext<any, T>) => SecretEnvVar[];
14
15
  getAdditionalEnvVars: (envContext: EnvironmentContext<any, T>) => Record<string, string | undefined | null>;
15
16
  };
16
17
  export declare type DeployTypes = { [T in DeployConfigType]: DeployTypeDefinition<T> };
@@ -1,4 +1,6 @@
1
1
  import type { EnvironmentContext } from "../../types/environmentContext";
2
2
  export declare const additionalKubernetesSecretKeys: ({
3
3
  deployConfigRaw
4
- }: EnvironmentContext<any, "kubernetes">) => string[];
4
+ }: EnvironmentContext<any, "kubernetes">) => {
5
+ key: string;
6
+ }[];
@@ -19,6 +19,10 @@ var additionalKubernetesSecretKeys = function (_a) {
19
19
  keys.push("POSTGRESQL_PASSWORD");
20
20
  keys.push("cloudsqlProxyCredentials");
21
21
  }
22
- return keys;
22
+ return keys.map(function (key) {
23
+ return {
24
+ key: key
25
+ };
26
+ });
23
27
  };
24
28
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
@@ -51,7 +51,7 @@ var base_1 = require("../base");
51
51
  var types_1 = require("../types");
52
52
  var kubeValues_1 = require("./kubeValues");
53
53
  var createKubernetesDeployJobs = function (context) {
54
- var _a, _b;
54
+ var _a, _b, _c;
55
55
  var deployConfig = context.componentConfig.deploy;
56
56
  if (deployConfig === false) {
57
57
  return [];
@@ -75,10 +75,10 @@ var createKubernetesDeployJobs = function (context) {
75
75
  quotingType: "'",
76
76
  forceQuotes: true
77
77
  }),
78
- HELM_GITLAB_CHART_NAME: "the-panter-chart",
79
- HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_a = deployConfig.additionalHelmArgs) !== null && _a !== void 0 ? _a : []), false).join(" "),
78
+ HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart",
79
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : []), false).join(" "),
80
80
  COMPONENT_NAME: context.componentName,
81
- BUILD_ID: (_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildId
81
+ BUILD_ID: (_c = context.commitInfo) === null || _c === void 0 ? void 0 : _c.buildId
82
82
  })
83
83
  };
84
84
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
@@ -5,6 +5,7 @@ export declare const createKubeValues: (context: Context) => never[] | ({
5
5
  public: Record<string, string>;
6
6
  };
7
7
  application: false | import("../types/base").AllowUnknownProps<{
8
+ command?: string | undefined;
8
9
  enabled?: boolean | undefined;
9
10
  redirects?: import("../types/base").AllowUnknownProps<{
10
11
  host: string;
@@ -50,33 +50,36 @@ var kubeEnv_1 = require("./kubeEnv");
50
50
  var mongodb_1 = require("./mongodb");
51
51
  var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
52
52
  var createAppConfig = function (context, application) {
53
- var _a, _b, _c;
54
53
  if (application === false) {
55
54
  return {
56
55
  enabled: false
57
56
  };
58
57
  }
58
+ var _a = application !== null && application !== void 0 ? application : {},
59
+ healthRoute = _a.healthRoute,
60
+ command = _a.command,
61
+ rest = __rest(_a, ["healthRoute", "command"]);
59
62
  return (0, utils_1.mergeWithMergingArrays)({
60
63
  host: context.environment.host,
61
- command: context.componentConfig.build.startCommand,
64
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
62
65
  livenessProbe: {
63
66
  httpGet: {
64
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
67
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
65
68
  }
66
69
  },
67
70
  readinessProbe: {
68
71
  httpGet: {
69
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
72
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
70
73
  }
71
74
  },
72
75
  startupProbe: {
73
76
  httpGet: {
74
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
77
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
75
78
  }
76
79
  }
77
80
  },
78
81
  // default
79
- application // merge rest in
82
+ rest // merge rest in
80
83
  );
81
84
  };
82
85
 
@@ -23,6 +23,7 @@ export declare const processSecretsAsFiles: <T extends {
23
23
  concurrencyPolicy?: "Forbid" | "Allow" | "Replace" | undefined;
24
24
  }>> | undefined;
25
25
  application?: false | import("../types/base").AllowUnknownProps<{
26
+ command?: string | undefined;
26
27
  enabled?: boolean | undefined;
27
28
  redirects?: import("../types/base").AllowUnknownProps<{
28
29
  host: string;
@@ -1,3 +1,4 @@
1
+ import type { GitlabJobImage } from "../../types";
1
2
  import type { CatladderJob } from "../../types/jobs";
2
3
  import type { DeployConfigBase } from "./base";
3
4
  export declare type DeployConfigCustom = {
@@ -24,7 +25,7 @@ export declare type DeployConfigCustom = {
24
25
  /**
25
26
  * image to use
26
27
  */
27
- jobImage?: string;
28
+ jobImage?: GitlabJobImage;
28
29
  /**
29
30
  * customize cache for the job
30
31
  */
@@ -8,11 +8,15 @@ export declare type DeployConfigCloudRunCloudSql = {
8
8
  */
9
9
  dbUser?: string;
10
10
  /**
11
- * the prefix of the database, the full db name is this plus the environment slug
11
+ * the prefix of the database, the full db name is this plus the environment slug prefix plus the componentName
12
12
  *
13
13
  * defaults to customerName-appName
14
14
  */
15
15
  dbNamePrefix?: string | false;
16
+ /**
17
+ * the base name of the db, defaults to the componentName
18
+ */
19
+ dbBaseName?: string;
16
20
  /**
17
21
  * whether to delete the database if the environment is stopped
18
22
  * defaults to true for review envs, to false for every other environment
@@ -173,6 +173,10 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
173
173
  * configuration for the application ("Deployment" in kubernetes)
174
174
  */
175
175
  application?: false | AllowUnknownProps<{
176
+ /**
177
+ * command to start, defaults to build's startCommand
178
+ */
179
+ command?: string;
176
180
  /**
177
181
  * enable, disable app deployment, defaults to true
178
182
  */
@@ -263,5 +267,10 @@ export declare type DeployConfigKubernetes = {
263
267
  * values to configure the app
264
268
  */
265
269
  values?: DeployConfigKubernetesValues;
270
+ /**
271
+ * Custom Helm chart location.
272
+ * Not recommended to use.
273
+ */
274
+ chartName?: string;
266
275
  } & DeployConfigBase;
267
276
  export {};
@@ -0,0 +1,8 @@
1
+ import type { Config, PipelineTrigger } from "../types";
2
+ import type { CatladderJob } from "../types/jobs";
3
+ export declare type AllCatladderJobs = {
4
+ [componentName: string]: {
5
+ [env: string]: Array<CatladderJob>;
6
+ };
7
+ };
8
+ export declare const createAllJobs: (config: Config, trigger: PipelineTrigger) => Promise<AllCatladderJobs>;
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+
3
+ var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P ? value : new P(function (resolve) {
6
+ resolve(value);
7
+ });
8
+ }
9
+ return new (P || (P = Promise))(function (resolve, reject) {
10
+ function fulfilled(value) {
11
+ try {
12
+ step(generator.next(value));
13
+ } catch (e) {
14
+ reject(e);
15
+ }
16
+ }
17
+ function rejected(value) {
18
+ try {
19
+ step(generator["throw"](value));
20
+ } catch (e) {
21
+ reject(e);
22
+ }
23
+ }
24
+ function step(result) {
25
+ result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
26
+ }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ var __generator = this && this.__generator || function (thisArg, body) {
31
+ var _ = {
32
+ label: 0,
33
+ sent: function () {
34
+ if (t[0] & 1) throw t[1];
35
+ return t[1];
36
+ },
37
+ trys: [],
38
+ ops: []
39
+ },
40
+ f,
41
+ y,
42
+ t,
43
+ g;
44
+ return g = {
45
+ next: verb(0),
46
+ "throw": verb(1),
47
+ "return": verb(2)
48
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function () {
49
+ return this;
50
+ }), g;
51
+ function verb(n) {
52
+ return function (v) {
53
+ return step([n, v]);
54
+ };
55
+ }
56
+ function step(op) {
57
+ if (f) throw new TypeError("Generator is already executing.");
58
+ while (_) try {
59
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
60
+ if (y = 0, t) op = [op[0] & 2, t.value];
61
+ switch (op[0]) {
62
+ case 0:
63
+ case 1:
64
+ t = op;
65
+ break;
66
+ case 4:
67
+ _.label++;
68
+ return {
69
+ value: op[1],
70
+ done: false
71
+ };
72
+ case 5:
73
+ _.label++;
74
+ y = op[1];
75
+ op = [0];
76
+ continue;
77
+ case 7:
78
+ op = _.ops.pop();
79
+ _.trys.pop();
80
+ continue;
81
+ default:
82
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
83
+ _ = 0;
84
+ continue;
85
+ }
86
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
87
+ _.label = op[1];
88
+ break;
89
+ }
90
+ if (op[0] === 6 && _.label < t[1]) {
91
+ _.label = t[1];
92
+ t = op;
93
+ break;
94
+ }
95
+ if (t && _.label < t[2]) {
96
+ _.label = t[2];
97
+ _.ops.push(op);
98
+ break;
99
+ }
100
+ if (t[2]) _.ops.pop();
101
+ _.trys.pop();
102
+ continue;
103
+ }
104
+ op = body.call(thisArg, _);
105
+ } catch (e) {
106
+ op = [6, e];
107
+ y = 0;
108
+ } finally {
109
+ f = t = 0;
110
+ }
111
+ if (op[0] & 5) throw op[1];
112
+ return {
113
+ value: op[0] ? op[1] : void 0,
114
+ done: true
115
+ };
116
+ }
117
+ };
118
+ exports.__esModule = true;
119
+ exports.createAllJobs = void 0;
120
+ var config_1 = require("../config");
121
+ var createJobsForComponent_1 = require("./createJobsForComponent");
122
+ var createAllJobs = function (config, trigger) {
123
+ return __awaiter(void 0, void 0, void 0, function () {
124
+ var _a, _b;
125
+ return __generator(this, function (_c) {
126
+ switch (_c.label) {
127
+ case 0:
128
+ _b = (_a = Object).fromEntries;
129
+ return [4 /*yield*/, Promise.all(Object.keys(config.components).map(function (componentName) {
130
+ return __awaiter(void 0, void 0, void 0, function () {
131
+ var envs, _a, _b, _c;
132
+ return __generator(this, function (_d) {
133
+ switch (_d.label) {
134
+ case 0:
135
+ envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
136
+ _a = [componentName];
137
+ _c = (_b = Object).fromEntries;
138
+ return [4 /*yield*/, Promise.all(envs.map(function (env) {
139
+ return __awaiter(void 0, void 0, void 0, function () {
140
+ var _a;
141
+ return __generator(this, function (_b) {
142
+ switch (_b.label) {
143
+ case 0:
144
+ _a = [env];
145
+ return [4 /*yield*/, (0, createJobsForComponent_1.createJobsForComponent)(config, componentName, env, trigger)];
146
+ case 1:
147
+ return [2 /*return*/, _a.concat([_b.sent()])];
148
+ }
149
+ });
150
+ });
151
+ }))];
152
+ case 1:
153
+ return [2 /*return*/, _a.concat([_c.apply(_b, [_d.sent()])])];
154
+ }
155
+ });
156
+ });
157
+ }))];
158
+ case 1:
159
+ return [2 /*return*/, _b.apply(_a, [_c.sent()])];
160
+ }
161
+ });
162
+ });
163
+ };
164
+ exports.createAllJobs = createAllJobs;
@@ -1,15 +1,5 @@
1
1
  "use strict";
2
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
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
3
  var __awaiter = this && this.__awaiter || function (thisArg, _arguments, P, generator) {
14
4
  function adopt(value) {
15
5
  return value instanceof P ? value : new P(function (resolve) {
@@ -162,54 +152,40 @@ var config_1 = require("../config");
162
152
  var rules_1 = require("../rules");
163
153
  var runner_1 = require("../runner");
164
154
  var jobs_1 = require("../types/jobs");
165
- var createJobs_1 = require("./createJobs");
155
+ var createAllJobs_1 = require("./createAllJobs");
156
+ var createGitlabJobs_1 = require("./gitlab/createGitlabJobs");
166
157
  var createChildPipeline = function (type, trigger, config) {
167
158
  return __awaiter(void 0, void 0, void 0, function () {
168
- var components, jobs, allEnvs, stages, pipeline;
169
- return __generator(this, function (_a) {
170
- switch (_a.label) {
159
+ var jobs, allEnvs, stages, pipeline;
160
+ var _a;
161
+ return __generator(this, function (_b) {
162
+ switch (_b.label) {
171
163
  case 0:
172
- components = Object.keys(config.components);
173
- return [4 /*yield*/, components.reduce(function (acc, componentName) {
174
- return __awaiter(void 0, void 0, void 0, function () {
175
- var envs, _a, _b;
176
- return __generator(this, function (_c) {
177
- switch (_c.label) {
178
- case 0:
179
- envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
180
- _a = [{}];
181
- return [4 /*yield*/, acc];
182
- case 1:
183
- _b = [__assign.apply(void 0, _a.concat([_c.sent()]))];
184
- return [4 /*yield*/, (0, createJobs_1.createJobs)(type, envs, config, componentName, trigger)];
185
- case 2:
186
- return [2 /*return*/, __assign.apply(void 0, _b.concat([_c.sent()]))];
187
- }
188
- });
189
- });
190
- }, Promise.resolve({}))];
164
+ return [4 /*yield*/, (0, createAllJobs_1.createAllJobs)(config, trigger)];
191
165
  case 1:
192
- jobs = _a.sent();
166
+ jobs = _b.sent();
193
167
  allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
194
168
  stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
195
169
  return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
196
170
  return "".concat(baseStage, " ").concat(e);
197
171
  })), false);
198
172
  }, []);
199
- if (type === "gitlab") {
200
- pipeline = {
201
- image: (0, runner_1.getRunnerImage)("jobs-default"),
202
- variables: {
203
- FF_USE_FASTZIP: "true"
204
- },
205
- workflow: {
206
- rules: rules_1.RULES_ALWAYS
207
- },
208
- stages: stages,
209
- jobs: jobs
210
- };
211
- return [2 /*return*/, pipeline];
212
- }
173
+ if (!(type === "gitlab")) return [3 /*break*/, 3];
174
+ _a = {
175
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
176
+ variables: {
177
+ FF_USE_FASTZIP: "true"
178
+ },
179
+ workflow: {
180
+ rules: rules_1.RULES_ALWAYS
181
+ },
182
+ stages: stages
183
+ };
184
+ return [4 /*yield*/, (0, createGitlabJobs_1.createGitlabJobs)(jobs)];
185
+ case 2:
186
+ pipeline = (_a.jobs = _b.sent(), _a);
187
+ return [2 /*return*/, pipeline];
188
+ case 3:
213
189
  throw new Error("".concat(type, " is not supported"));
214
190
  }
215
191
  });
@@ -0,0 +1,3 @@
1
+ import type { Config, PipelineTrigger } from "../types/config";
2
+ import type { CatladderJob } from "../types/jobs";
3
+ export declare const createJobsForComponent: (config: Config, componentName: string, env: string, trigger: PipelineTrigger) => Promise<Array<CatladderJob>>;