@catladder/pipeline 1.1.2 → 1.2.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 (42) hide show
  1. package/dist/build/base/createBuildJob.js +6 -2
  2. package/dist/build/base/getBuildInfo.d.ts +2 -0
  3. package/dist/build/base/getBuildInfo.js +12 -0
  4. package/dist/build/docker.js +2 -1
  5. package/dist/build/node/meteor.js +3 -0
  6. package/dist/build/tests/storybook.test.js +7 -1
  7. package/dist/build/types.d.ts +7 -0
  8. package/dist/constants.js +1 -1
  9. package/dist/context/index.d.ts +1 -0
  10. package/dist/context/index.js +19 -10
  11. package/dist/deploy/index.d.ts +3 -1
  12. package/dist/deploy/index.js +4 -0
  13. package/dist/deploy/kubernetes/cloudsql.js +1 -1
  14. package/dist/deploy/kubernetes/deployJob.js +18 -3
  15. package/dist/deploy/types.d.ts +134 -2
  16. package/dist/deploy/utils.d.ts +4 -0
  17. package/dist/deploy/utils.js +18 -0
  18. package/dist/pipeline/createChildPipeline.d.ts +3 -0
  19. package/dist/pipeline/createChildPipeline.js +4 -1
  20. package/dist/pipeline/createJobs.js +21 -9
  21. package/dist/runner/index.d.ts +1 -1
  22. package/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/types/config.d.ts +57 -0
  24. package/dist/types/context.d.ts +2 -0
  25. package/package.json +1 -1
  26. package/src/build/base/createBuildJob.ts +4 -7
  27. package/src/build/base/getBuildInfo.ts +7 -0
  28. package/src/build/docker.ts +3 -2
  29. package/src/build/node/meteor.ts +2 -0
  30. package/src/build/tests/storybook.test.ts +6 -0
  31. package/src/build/types.ts +6 -0
  32. package/src/context/index.ts +13 -4
  33. package/src/deploy/index.ts +3 -2
  34. package/src/deploy/kubernetes/cloudsql.ts +3 -4
  35. package/src/deploy/kubernetes/deployJob.ts +24 -3
  36. package/src/deploy/types.ts +66 -1
  37. package/src/deploy/utils.ts +17 -0
  38. package/src/pipeline/createChildPipeline.ts +4 -1
  39. package/src/pipeline/createJobs.ts +5 -0
  40. package/src/runner/index.ts +3 -1
  41. package/src/types/config.ts +49 -0
  42. package/src/types/context.ts +2 -0
@@ -65,30 +65,34 @@ exports.createBuildJob = void 0;
65
65
 
66
66
  var lodash_1 = require("lodash");
67
67
 
68
+ var __1 = require("../..");
69
+
68
70
  var defaults_1 = require("../../defaults");
69
71
 
70
72
  var utils_1 = require("../../utils");
71
73
 
72
74
  var constants_1 = require("./constants");
73
75
 
76
+ var getBuildInfo_1 = require("./getBuildInfo");
77
+
74
78
  var createBuildJob = function (context, _a) {
75
79
  var _b, _c;
76
80
 
77
81
  var script = _a.script,
78
82
  def = __rest(_a, ["script"]);
79
83
 
80
- var buildInfo = [". getCommitInfo", "echo '{\"id\":\"'$BUILD_ID'\",\"commit\":\"'$BUILD_COMMIT'\",\"tag\":\"'$BUILD_TAG'\",\"time\":\"'$BUILD_TIME'\"}' > ".concat(context.componentConfig.dir, "/__build_info.json")];
81
84
  return {
82
85
  name: constants_1.APP_BUILD_JOB_NAME,
83
86
  envMode: "jobPerEnv",
84
87
  job: (0, lodash_1.merge)({
88
+ image: (0, __1.getRunnerImage)("jobs-default"),
85
89
  needs: [],
86
90
  cache: [],
87
91
  variables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
88
92
  retry: defaults_1.BASE_RETRY,
89
93
  interruptible: true,
90
94
  stage: "build",
91
- script: __spreadArray(__spreadArray(__spreadArray([], __read(buildInfo), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
95
+ script: __spreadArray(__spreadArray(__spreadArray([], __read((0, getBuildInfo_1.getBuildInfo)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
92
96
  artifacts: {
93
97
  paths: [context.componentConfig.dir + "/__build_info.json"]
94
98
  }
@@ -0,0 +1,2 @@
1
+ import { Context } from "../../types";
2
+ export declare const getBuildInfo: (context: Context) => string[];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getBuildInfo = void 0;
5
+
6
+ var getBuildInfo = function (context) {
7
+ var _a, _b;
8
+
9
+ return ["echo '{\"id\":\"".concat((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.buildId, "\",\"time\":\"").concat((_b = context.commitInfo) === null || _b === void 0 ? void 0 : _b.buildTime, "\"}' > ").concat(context.componentConfig.dir, "/__build_info.json")];
10
+ };
11
+
12
+ exports.getBuildInfo = getBuildInfo;
@@ -75,6 +75,7 @@ var createDockerBuildJob = function (context, _a) {
75
75
  command: ["--tls=false"]
76
76
  }],
77
77
  variables: __assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
78
+ DOCKER_BUILDKIT: "1",
78
79
  DOCKERFILE_ADDITIONS: (_c = (_b = context.componentConfig.build.docker) === null || _b === void 0 ? void 0 : _b.additionsBegin) === null || _c === void 0 ? void 0 : _c.join("\n"),
79
80
  DOCKERFILE_ADDITIONS_END: (_e = (_d = context.componentConfig.build.docker) === null || _d === void 0 ? void 0 : _d.additionsEnd) === null || _e === void 0 ? void 0 : _e.join("\n"),
80
81
  APP_DIR: context.componentConfig.dir,
@@ -88,7 +89,7 @@ var createDockerBuildJob = function (context, _a) {
88
89
  })
89
90
  };
90
91
  return __assign(__assign({}, base), {
91
- script: __spreadArray(__spreadArray([], __read(script), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker pull $CACHE_IMAGE || true", "docker build --network host --cache-from $CACHE_IMAGE --tag $IMAGE_NAME:$IMAGE_TAG -f $APP_DIR/Dockerfile .", "docker push $IMAGE_NAME:$IMAGE_TAG", "docker tag $IMAGE_NAME:$IMAGE_TAG $CACHE_IMAGE", "docker push $CACHE_IMAGE"], false)
92
+ script: __spreadArray(__spreadArray([], __read(script), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker build --network host --cache-from $CACHE_IMAGE --tag $IMAGE_NAME:$IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $IMAGE_NAME:$IMAGE_TAG", "docker tag $IMAGE_NAME:$IMAGE_TAG $CACHE_IMAGE", "docker push $CACHE_IMAGE"], false)
92
93
  });
93
94
  };
94
95
 
@@ -54,6 +54,8 @@ exports.createMeteorBuildJobs = void 0;
54
54
 
55
55
  var path_1 = require("path");
56
56
 
57
+ var runner_1 = require("../../runner");
58
+
57
59
  var constants_1 = require("../base/constants");
58
60
 
59
61
  var createBuildJob_1 = require("../base/createBuildJob");
@@ -84,6 +86,7 @@ var createMeteorBuildJobs = function (context) {
84
86
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
85
87
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
86
88
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
89
+ image: (0, runner_1.getRunnerImage)("jobs-meteor"),
87
90
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['echo "add healthcheck package"', "meteor add panter:healthroute --allow-superuser", "meteor add qualia:prod-shell --allow-superuser", 'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory', "cp ./__build_info.json ./dist/bundle/programs/server"], false),
88
91
  artifacts: {
89
92
  paths: [context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/dist"]
@@ -168,7 +168,13 @@ describe("storybook build", function () {
168
168
  type: "storybook"
169
169
  },
170
170
  deploy: {
171
- type: "kubernetes"
171
+ type: "kubernetes",
172
+ cluster: {
173
+ name: "production",
174
+ projectId: "bla",
175
+ region: "europe",
176
+ type: "gcloud"
177
+ }
172
178
  }
173
179
  }
174
180
  }
@@ -1,5 +1,12 @@
1
1
  export declare type BuildConfigBase = {
2
+ /**
3
+ * command to run on the image to start the app (e.g. yarn start)
4
+ */
2
5
  startCommand?: string;
6
+ /**
7
+ * additional env vars for the buid jobs
8
+ */
9
+
3
10
  extraVars?: Record<string, string>;
4
11
  /**
5
12
  * define the build command
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 = "v1-1-2-5b19d4f7" || "";
5
+ exports.PIPELINE_IMAGE_TAG = "v1-2-0-69da873c" || "";
6
6
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
@@ -1,5 +1,6 @@
1
1
  import { Config } from "../types/config";
2
2
  import { CommitInfo, Context, Environment, YarnInfo } from "../types/context";
3
3
  export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
4
+ export declare const getSecretVarNameForContext: (context: Context, key: string) => string;
4
5
  export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, skipReferences?: boolean) => Environment;
5
6
  export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, yarnInfo?: YarnInfo | undefined) => Context;
@@ -46,7 +46,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
46
46
  };
47
47
 
48
48
  exports.__esModule = true;
49
- exports.createContext = exports.getEnvironment = exports.getSecretVarName = void 0;
49
+ exports.createContext = exports.getEnvironment = exports.getSecretVarNameForContext = exports.getSecretVarName = void 0;
50
50
 
51
51
  var lodash_1 = require("lodash");
52
52
 
@@ -69,9 +69,15 @@ var getSecretVarName = function (env, componentName, key) {
69
69
 
70
70
  exports.getSecretVarName = getSecretVarName;
71
71
 
72
+ var getSecretVarNameForContext = function (context, key) {
73
+ return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
74
+ };
75
+
76
+ exports.getSecretVarNameForContext = getSecretVarNameForContext;
77
+
72
78
  var getEnvironment = function (config, componentName, env, commitInfo, skipReferences // to prevent infinit loop
73
79
  ) {
74
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
80
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
75
81
 
76
82
  if (skipReferences === void 0) {
77
83
  skipReferences = false;
@@ -118,14 +124,17 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
118
124
  PORT: port.toString()
119
125
  };
120
126
  } else {
121
- var KUBE_NAMESPACE = "".concat(config.customerName, "-").concat(config.appName, "-").concat(env);
122
127
  var RELEASE_NAME = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
123
128
  var componentSlug = (0, slugify_1["default"])(componentName);
124
129
  var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.refSlug, ".").concat(env) : env;
125
- var HOST_CANONICAL = "".concat(config.appName, "-").concat(componentSlug, ".").concat(envInUrl, ".").concat(config.customerName, ".panter.cloud");
126
- hostname = (_e = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.hostname) !== null && _e !== void 0 ? _e : HOST_CANONICAL;
127
- var url_1 = "https://".concat(hostname);
128
- var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(componentName, "-").concat(commitInfo.refSlug) : componentName;
130
+ var domainCanonical = (mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.deploy) && ((_e = mergedConfig.deploy.cluster) === null || _e === void 0 ? void 0 : _e.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
131
+ config.domainCanonical || "panter.cloud";
132
+ var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(config.appName, ".").concat(config.customerName, ".").concat(domainCanonical);
133
+ hostname = (_f = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.hostname) !== null && _f !== void 0 ? _f : HOST_CANONICAL;
134
+ var url_1 = "https://".concat(hostname); // FIXME: move to kube specific jobs
135
+
136
+ var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(commitInfo.refSlug, "-").concat(componentName) : componentName;
137
+ var KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
129
138
  predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
130
139
  HOST_CANONICAL: HOST_CANONICAL,
131
140
  ROOT_URL: url_1,
@@ -135,12 +144,12 @@ var getEnvironment = function (config, componentName, env, commitInfo, skipRefer
135
144
  });
136
145
  }
137
146
 
138
- var publicEnvVars = (_g = (_f = mergedConfig.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
139
- var secretEnvVarKeys = (_j = (_h = mergedConfig.vars) === null || _h === void 0 ? void 0 : _h.secret) !== null && _j !== void 0 ? _j : [];
147
+ var publicEnvVars = (_h = (_g = mergedConfig.vars) === null || _g === void 0 ? void 0 : _g.public) !== null && _h !== void 0 ? _h : {};
148
+ var secretEnvVarKeys = (_k = (_j = mergedConfig.vars) === null || _j === void 0 ? void 0 : _j.secret) !== null && _k !== void 0 ? _k : [];
140
149
  var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
141
150
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
142
151
  }));
143
- var referencedRaw = (_l = (_k = mergedConfig.vars) === null || _k === void 0 ? void 0 : _k.fromComponents) !== null && _l !== void 0 ? _l : {};
152
+ var referencedRaw = (_m = (_l = mergedConfig.vars) === null || _l === void 0 ? void 0 : _l.fromComponents) !== null && _m !== void 0 ? _m : {};
144
153
  var referenced = skipReferences ? {} : Object.entries(referencedRaw).reduce(function (acc, _a) {
145
154
  var _b = __read(_a, 2),
146
155
  otherApp = _b[0],
@@ -1,11 +1,13 @@
1
1
  import { GitlabJobs } from "../types/gitlab-types";
2
2
  import { Context } from "../types/context";
3
3
  import { DeployConfig } from "./types";
4
+ export * from "./kubernetes";
5
+ export * from "./types";
6
+ export * from "./utils";
4
7
  export declare type DeployTypes = { [type in DeployConfig["type"]]: {
5
8
  jobs: (context: Context) => GitlabJobs;
6
9
  defaults: () => Partial<Extract<DeployConfig, {
7
10
  type: type;
8
11
  }>>;
9
12
  } };
10
- export * from "./types";
11
13
  export declare const DEPLOY_TYPES: DeployTypes;
@@ -22,8 +22,12 @@ exports.DEPLOY_TYPES = void 0;
22
22
 
23
23
  var kubernetes_1 = require("./kubernetes");
24
24
 
25
+ __exportStar(require("./kubernetes"), exports);
26
+
25
27
  __exportStar(require("./types"), exports);
26
28
 
29
+ __exportStar(require("./utils"), exports);
30
+
27
31
  exports.DEPLOY_TYPES = {
28
32
  kubernetes: {
29
33
  jobs: kubernetes_1.createKubernetesDeployJobs,
@@ -8,7 +8,7 @@ var __1 = require("../..");
8
8
  var createCloudsqlBaseConfig = function (context) {
9
9
  return {
10
10
  cloudsql: {
11
- proxyCredentials: "$".concat((0, __1.getSecretVarName)(context.environment.shortName, context.componentName, "cloudsqlProxyCredentials"))
11
+ proxyCredentials: "$".concat((0, __1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
12
12
  }
13
13
  };
14
14
  };
@@ -39,6 +39,16 @@ var __read = this && this.__read || function (o, n) {
39
39
  return ar;
40
40
  };
41
41
 
42
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
44
+ if (ar || !(i in from)) {
45
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
46
+ ar[i] = from[i];
47
+ }
48
+ }
49
+ return to.concat(ar || Array.prototype.slice.call(from));
50
+ };
51
+
42
52
  exports.__esModule = true;
43
53
  exports.createKubernetesDeployJobs = void 0;
44
54
 
@@ -56,8 +66,10 @@ var mongodb_1 = require("./mongodb");
56
66
 
57
67
  var cloudsql_1 = require("./cloudsql");
58
68
 
69
+ var __1 = require("../..");
70
+
59
71
  var createKubernetesDeployJobs = function (context) {
60
- var _a, _b, _c, _d;
72
+ var _a, _b, _c, _d, _e, _f;
61
73
 
62
74
  var deployConfig = context.componentConfig.deploy;
63
75
 
@@ -119,8 +131,9 @@ var createKubernetesDeployJobs = function (context) {
119
131
  forceQuotes: true
120
132
  }),
121
133
  HELM_GITLAB_CHART_NAME: "the-panter-chart",
122
- HELM_ARGS: deployConfig.additionalHelmArgs,
134
+ HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_e = deployConfig.additionalHelmArgs) !== null && _e !== void 0 ? _e : []), false).join(" "),
123
135
  COMPONENT_NAME: context.componentName,
136
+ BUILD_ID: (_f = context.commitInfo) === null || _f === void 0 ? void 0 : _f.buildId,
124
137
  // TODO: unify with docker build stage
125
138
  IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
126
139
  IMAGE_TAG: "$CI_COMMIT_SHA"
@@ -129,9 +142,11 @@ var createKubernetesDeployJobs = function (context) {
129
142
  };
130
143
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
131
144
  var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
145
+ var clusterName = "kube-".concat(context.environment.fullName);
146
+ var connectContext = ["kubectl config set-cluster \"".concat(clusterName, "\" --server=\"$").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_URL"), "\" --certificate-authority <(echo $").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_CA_PEM"), " | base64 -d) --embed-certs=true"), "kubectl config set-credentials \"".concat(clusterName, "\" --token=\"$").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_TOKEN"), "\""), "kubectl config set-context \"".concat(clusterName, "\" --cluster=\"").concat(clusterName, "\" --user=\"").concat(clusterName, "\" --namespace=\"").concat(context.environment.envVars.KUBE_NAMESPACE, "\""), "kubectl config use-context \"".concat(clusterName, "\"")];
132
147
  return [(0, lodash_1.merge)({}, baseDeploymentJob, shared, {
133
148
  job: {
134
- script: ["kubernetesEnsureNamespace", "kubernetesCreateSecret", "kubernetesDeploy"],
149
+ script: __spreadArray(__spreadArray([], __read(connectContext), false), ["kubernetesCreateSecret", "kubernetesDeploy", "echo deployment successful 😻"], false),
135
150
  environment: {
136
151
  kubernetes: kubernetesEnvironment
137
152
  }
@@ -1,35 +1,113 @@
1
1
  export declare type DeployConfigBase = {};
2
2
  declare type AllowUnknownProps<T extends Record<string, unknown>> = T & Record<string, unknown>;
3
+ export declare type DeployConfigKubernetesClusterGCloud = {
4
+ type: "gcloud";
5
+ /**
6
+ * gcoud name of the cluster
7
+ */
8
+
9
+ name: string;
10
+ /**
11
+ * google cloud project id
12
+ */
13
+
14
+ projectId: string;
15
+ /**
16
+ * region
17
+ */
18
+
19
+ region: string;
20
+ /**
21
+ * domain of the cluster, for canonical domains without custom hostnames (e.g. review and dev apps)
22
+ */
23
+
24
+ domainCanonical?: string;
25
+ };
26
+ export declare type DeployConfigKubernetesCluster = DeployConfigKubernetesClusterGCloud;
3
27
  export declare type DeployConfigKubernetes = {
4
28
  type: "kubernetes";
5
- cluster?: string;
29
+ /**
30
+ * cluster config to use.
31
+ */
32
+
33
+ cluster?: DeployConfigKubernetesCluster;
34
+ /**
35
+ * prints out debug info (helm --debug)
36
+ */
37
+
38
+ debug?: boolean;
6
39
  additionalHelmArgs?: string[];
40
+ /**
41
+ * values to configure the app
42
+ */
43
+
7
44
  values?: AllowUnknownProps<{
45
+ /**
46
+ * enable cloudsql db. Currently you have to manually set it up
47
+ */
8
48
  cloudsql?: {
9
49
  enabled: boolean;
10
50
  instanceId?: string;
11
51
  projectId?: string;
12
52
  region?: string;
13
53
  };
54
+ /**
55
+ * enable mongodb. The mongodb is deployed using a helm chart.
56
+ * Consider using external services instead of this.
57
+ */
58
+
14
59
  mongodb?: AllowUnknownProps<{
15
60
  enabled: boolean;
16
61
  }>;
62
+ /**
63
+ * enable mailhog. Mailhog is a virtual mail server that catches all outgoing mailsl and show them in a mailbox.
64
+ * This is great for development as it prevents to accidentially send out real emails and helps with debugging outgoing mails.
65
+ *
66
+ * It will automaticaly inject a MAIL_URL env var.
67
+ *
68
+ * Turn it of for production.
69
+ */
70
+
17
71
  mailhog?: {
18
72
  enabled: boolean;
19
73
  };
74
+ /**
75
+ * post-install/upgrade jobs. These use the app image and have all env vars available.
76
+ * Typically used for migrations and seeds
77
+ */
78
+
20
79
  jobs?: Record<string, AllowUnknownProps<{
21
80
  command: string;
22
81
  }>>;
82
+ /**
83
+ * cronjobs that run periodically. These use the app image have all env vars available.
84
+ */
85
+
23
86
  cronjobs?: Record<string, AllowUnknownProps<{
24
87
  schedule: string;
25
88
  command: string;
26
89
  concurrencyPolicy?: "Forbid" | "Allow" | "Replace";
27
90
  }>>;
91
+ /**
92
+ * configuration for the application ("Deployment" in kubernetes)
93
+ */
94
+
28
95
  application?: AllowUnknownProps<{
96
+ /**
97
+ * redirects
98
+ */
29
99
  redirects?: AllowUnknownProps<{
30
100
  host: string;
31
101
  }>[];
102
+ /**
103
+ * how many pods will be started
104
+ */
105
+
32
106
  replicas?: number;
107
+ /**
108
+ * kubernetes resources
109
+ */
110
+
33
111
  resources?: {
34
112
  limits?: {
35
113
  cpu?: string;
@@ -46,34 +124,88 @@ export declare type DeployConfigKubernetes = {
46
124
  export declare type DeployConfig = DeployConfigKubernetes;
47
125
  export declare const isOfDeployType: <T extends "kubernetes"[]>(t: DeployConfig | false, ...types: T) => t is Extract<{
48
126
  type: "kubernetes";
49
- cluster?: string | undefined;
127
+ /**
128
+ * cluster config to use.
129
+ */
130
+
131
+ cluster?: DeployConfigKubernetesClusterGCloud | undefined;
132
+ /**
133
+ * prints out debug info (helm --debug)
134
+ */
135
+
136
+ debug?: boolean | undefined;
50
137
  additionalHelmArgs?: string[] | undefined;
138
+ /**
139
+ * values to configure the app
140
+ */
141
+
51
142
  values?: AllowUnknownProps<{
143
+ /**
144
+ * enable cloudsql db. Currently you have to manually set it up
145
+ */
52
146
  cloudsql?: {
53
147
  enabled: boolean;
54
148
  instanceId?: string | undefined;
55
149
  projectId?: string | undefined;
56
150
  region?: string | undefined;
57
151
  } | undefined;
152
+ /**
153
+ * enable mongodb. The mongodb is deployed using a helm chart.
154
+ * Consider using external services instead of this.
155
+ */
156
+
58
157
  mongodb?: AllowUnknownProps<{
59
158
  enabled: boolean;
60
159
  }> | undefined;
160
+ /**
161
+ * enable mailhog. Mailhog is a virtual mail server that catches all outgoing mailsl and show them in a mailbox.
162
+ * This is great for development as it prevents to accidentially send out real emails and helps with debugging outgoing mails.
163
+ *
164
+ * It will automaticaly inject a MAIL_URL env var.
165
+ *
166
+ * Turn it of for production.
167
+ */
168
+
61
169
  mailhog?: {
62
170
  enabled: boolean;
63
171
  } | undefined;
172
+ /**
173
+ * post-install/upgrade jobs. These use the app image and have all env vars available.
174
+ * Typically used for migrations and seeds
175
+ */
176
+
64
177
  jobs?: Record<string, AllowUnknownProps<{
65
178
  command: string;
66
179
  }>> | undefined;
180
+ /**
181
+ * cronjobs that run periodically. These use the app image have all env vars available.
182
+ */
183
+
67
184
  cronjobs?: Record<string, AllowUnknownProps<{
68
185
  schedule: string;
69
186
  command: string;
70
187
  concurrencyPolicy?: "Forbid" | "Allow" | "Replace" | undefined;
71
188
  }>> | undefined;
189
+ /**
190
+ * configuration for the application ("Deployment" in kubernetes)
191
+ */
192
+
72
193
  application?: AllowUnknownProps<{
194
+ /**
195
+ * redirects
196
+ */
73
197
  redirects?: AllowUnknownProps<{
74
198
  host: string;
75
199
  }>[] | undefined;
200
+ /**
201
+ * how many pods will be started
202
+ */
203
+
76
204
  replicas?: number | undefined;
205
+ /**
206
+ * kubernetes resources
207
+ */
208
+
77
209
  resources?: {
78
210
  limits?: {
79
211
  cpu?: string | undefined;
@@ -0,0 +1,4 @@
1
+ import { Config } from "../types";
2
+ import type { DeployConfigKubernetesCluster } from "./types";
3
+ export declare const getFullKubernetesClusterName: (cluster: DeployConfigKubernetesCluster) => string | undefined;
4
+ export declare const getKubernetesNamespace: (config: Pick<Config, "customerName" | "appName">, env: string) => string;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ exports.__esModule = true;
4
+ exports.getKubernetesNamespace = exports.getFullKubernetesClusterName = void 0;
5
+
6
+ var getFullKubernetesClusterName = function (cluster) {
7
+ if (cluster.type === "gcloud") {
8
+ return "gke_".concat(cluster.projectId, "_").concat(cluster.region, "_").concat(cluster.name);
9
+ }
10
+ };
11
+
12
+ exports.getFullKubernetesClusterName = getFullKubernetesClusterName;
13
+
14
+ var getKubernetesNamespace = function (config, env) {
15
+ return "".concat(config.customerName, "-").concat(config.appName, "-").concat(env);
16
+ };
17
+
18
+ exports.getKubernetesNamespace = getKubernetesNamespace;
@@ -2,6 +2,9 @@ import { Config, PipelineTrigger } from "../types/config";
2
2
  import { GitlabJobDef } from "../types/gitlab-types";
3
3
  export declare const createChildPipeline: (trigger: PipelineTrigger, config: Config) => Promise<{
4
4
  image: string;
5
+ variables: {
6
+ FF_USE_FASTZIP: string;
7
+ };
5
8
  workflow: {
6
9
  rules: import("../types/gitlab-types").GitlabRule[];
7
10
  };
@@ -249,7 +249,10 @@ var createChildPipeline = function (trigger, config) {
249
249
  })), false);
250
250
  }, []);
251
251
  childPipeline = __assign({
252
- image: (0, runner_1.getRunnerImage)("jobs"),
252
+ image: (0, runner_1.getRunnerImage)("jobs-default"),
253
+ variables: {
254
+ FF_USE_FASTZIP: "true"
255
+ },
253
256
  workflow: {
254
257
  rules: rules_1.RULES_ALWAYS
255
258
  },
@@ -193,6 +193,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
193
193
  exports.__esModule = true;
194
194
  exports.createJobs = void 0;
195
195
 
196
+ var child_process_promise_1 = require("child-process-promise");
197
+
196
198
  var lodash_1 = require("lodash");
197
199
 
198
200
  var build_1 = require("../build");
@@ -296,22 +298,32 @@ var createJobs = function (envs, config, componentName, trigger) {
296
298
  return __awaiter(void 0, void 0, void 0, function () {
297
299
  var commitInfo, yarnInfo;
298
300
 
299
- var _a, _b;
301
+ var _a;
302
+
303
+ var _b, _c;
300
304
 
301
- return __generator(this, function (_c) {
302
- switch (_c.label) {
305
+ return __generator(this, function (_d) {
306
+ switch (_d.label) {
303
307
  case 0:
304
- commitInfo = {
305
- refName: (_a = process.env.CI_COMMIT_REF_NAME) !== null && _a !== void 0 ? _a : "unknown",
306
- refSlug: (_b = process.env.CI_COMMIT_REF_SLUG) !== null && _b !== void 0 ? _b : "unknown",
307
- trigger: trigger
308
+ _a = {
309
+ refName: (_b = process.env.CI_COMMIT_REF_NAME) !== null && _b !== void 0 ? _b : "unknown",
310
+ refSlug: (_c = process.env.CI_COMMIT_REF_SLUG) !== null && _c !== void 0 ? _c : "unknown",
311
+ buildTime: new Date().toISOString()
308
312
  };
309
313
  return [4
310
314
  /*yield*/
311
- , (0, yarnInfo_1.getYarnInfo)(config, componentName)];
315
+ , (0, child_process_promise_1.exec)("git describe --tags || git rev-parse HEAD").then(function (s) {
316
+ return s.stdout.trim();
317
+ })];
312
318
 
313
319
  case 1:
314
- yarnInfo = _c.sent();
320
+ commitInfo = (_a.buildId = _d.sent(), _a.trigger = trigger, _a);
321
+ return [4
322
+ /*yield*/
323
+ , (0, yarnInfo_1.getYarnInfo)(config, componentName)];
324
+
325
+ case 2:
326
+ yarnInfo = _d.sent();
315
327
  return [2
316
328
  /*return*/
317
329
  , envs.reduce(function (acc, env) {
@@ -1,3 +1,3 @@
1
- declare type RunnerImageName = "jobs" | "kubernetes" | "base-pipeline" | "docker-build" | "semantic-release";
1
+ declare type RunnerImageName = "jobs-default" | "jobs-meteor" | "jobs-testing-chrome" | "kubernetes" | "base-pipeline" | "docker-build" | "semantic-release";
2
2
  export declare const getRunnerImage: (imageName: RunnerImageName) => string;
3
3
  export {};