@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-refactor-env-context-9e652b63

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 (175) hide show
  1. package/bin/catladder-gitlab.js +1 -1
  2. package/dist/build/base/createBuildJob.d.ts +2 -2
  3. package/dist/build/base/getBuildInfo.d.ts +1 -1
  4. package/dist/build/docker.d.ts +44 -6
  5. package/dist/build/docker.js +45 -19
  6. package/dist/build/index.d.ts +6 -5
  7. package/dist/build/node/buildJob.d.ts +2 -2
  8. package/dist/build/node/cache.d.ts +2 -2
  9. package/dist/build/node/index.d.ts +1 -1
  10. package/dist/build/node/meteor.d.ts +1 -1
  11. package/dist/build/node/meteor.js +6 -0
  12. package/dist/build/node/testJob.d.ts +2 -2
  13. package/dist/build/node/testJob.js +3 -0
  14. package/dist/build/node/yarn.d.ts +1 -1
  15. package/dist/build/node/yarn.js +13 -1
  16. package/dist/build/types.d.ts +10 -0
  17. package/dist/bundles/catladder-gitlab/index.js +32457 -0
  18. package/dist/catladder-gitlab.js +1 -2
  19. package/dist/config/configruedEnvs.d.ts +1 -1
  20. package/dist/config/readConfig.d.ts +1 -1
  21. package/dist/constants.js +1 -1
  22. package/dist/context/getEnvConfig.d.ts +9 -0
  23. package/dist/context/getEnvConfig.js +26 -0
  24. package/dist/context/getEnvType.d.ts +4 -0
  25. package/dist/context/getEnvType.js +18 -0
  26. package/dist/context/getEnvironment.d.ts +3 -0
  27. package/dist/context/getEnvironment.js +187 -0
  28. package/dist/context/getEnvironmentContext.d.ts +4 -0
  29. package/dist/context/getEnvironmentContext.js +36 -0
  30. package/dist/context/getEnvironmentVariables.d.ts +10 -0
  31. package/dist/context/getEnvironmentVariables.js +322 -0
  32. package/dist/context/getLabels.d.ts +8 -0
  33. package/dist/context/getLabels.js +49 -0
  34. package/dist/context/index.d.ts +5 -6
  35. package/dist/context/index.js +176 -181
  36. package/dist/context/resolveReferences.d.ts +1 -3
  37. package/dist/context/resolveReferences.js +275 -26
  38. package/dist/context/resolveReferences.test.js +332 -81
  39. package/dist/defaults/index.d.ts +1 -1
  40. package/dist/deploy/base.d.ts +4 -2
  41. package/dist/deploy/base.js +37 -17
  42. package/dist/deploy/cloudRun/deployJob.d.ts +3 -0
  43. package/dist/deploy/cloudRun/deployJob.js +139 -0
  44. package/dist/deploy/cloudRun/index.d.ts +9 -0
  45. package/dist/deploy/cloudRun/index.js +56 -0
  46. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -0
  47. package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +14 -0
  48. package/dist/deploy/cloudSql/index.d.ts +8 -0
  49. package/dist/deploy/cloudSql/index.js +30 -0
  50. package/dist/deploy/custom/deployJob.d.ts +2 -2
  51. package/dist/deploy/custom/deployJob.js +4 -1
  52. package/dist/deploy/custom/index.d.ts +2 -1
  53. package/dist/deploy/custom/index.js +15 -18
  54. package/dist/deploy/dockerTag/deployJob.d.ts +3 -0
  55. package/dist/deploy/dockerTag/deployJob.js +33 -0
  56. package/dist/deploy/dockerTag/index.d.ts +2 -0
  57. package/dist/deploy/dockerTag/index.js +19 -0
  58. package/dist/deploy/index.d.ts +12 -8
  59. package/dist/deploy/index.js +27 -14
  60. package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -0
  61. package/dist/deploy/kubernetes/additionalSecretKeys.js +33 -0
  62. package/dist/deploy/kubernetes/cloudsql.d.ts +1 -1
  63. package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
  64. package/dist/deploy/kubernetes/deployJob.js +13 -66
  65. package/dist/deploy/kubernetes/index.d.ts +2 -1
  66. package/dist/deploy/kubernetes/index.js +45 -16
  67. package/dist/deploy/kubernetes/kubeEnv.d.ts +10 -0
  68. package/dist/deploy/kubernetes/kubeEnv.js +90 -0
  69. package/dist/deploy/kubernetes/kubeValues.d.ts +90 -0
  70. package/dist/deploy/kubernetes/kubeValues.js +96 -0
  71. package/dist/deploy/kubernetes/mongodb.d.ts +18 -5
  72. package/dist/deploy/kubernetes/mongodb.js +118 -8
  73. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +21 -21
  74. package/dist/deploy/types/base.d.ts +15 -0
  75. package/dist/deploy/types/base.js +3 -0
  76. package/dist/deploy/types/custom.d.ts +27 -0
  77. package/dist/deploy/types/custom.js +3 -0
  78. package/dist/deploy/types/dockerTag.d.ts +10 -0
  79. package/dist/deploy/types/dockerTag.js +3 -0
  80. package/dist/deploy/types/googleCloudRun.d.ts +39 -0
  81. package/dist/deploy/types/googleCloudRun.js +3 -0
  82. package/dist/deploy/types/index.d.ts +24 -0
  83. package/dist/deploy/types/index.js +41 -0
  84. package/dist/deploy/{types.d.ts → types/kubernetes.d.ts} +128 -36
  85. package/dist/deploy/types/kubernetes.js +3 -0
  86. package/dist/deploy/utils.d.ts +2 -2
  87. package/dist/deploy/utils.js +4 -0
  88. package/dist/pipeline/createChildPipeline.d.ts +2 -2
  89. package/dist/pipeline/createChildPipeline.js +3 -3
  90. package/dist/pipeline/createJobs.d.ts +2 -2
  91. package/dist/pipeline/createJobs.js +63 -25
  92. package/dist/pipeline/gitlab/makeGitlabJob.d.ts +3 -2
  93. package/dist/pipeline/gitlab/makeGitlabJob.js +2 -1
  94. package/dist/pipeline/packageManager.d.ts +1 -1
  95. package/dist/rules/index.d.ts +1 -1
  96. package/dist/runner/index.d.ts +2 -3
  97. package/dist/tsconfig.tsbuildinfo +1 -1
  98. package/dist/types/config.d.ts +7 -6
  99. package/dist/types/config.js +1 -1
  100. package/dist/types/context.d.ts +10 -2
  101. package/dist/types/environmentContext.d.ts +22 -0
  102. package/dist/types/environmentContext.js +3 -0
  103. package/dist/types/gitlab-types.d.ts +1 -1
  104. package/dist/types/jobs.d.ts +8 -3
  105. package/dist/types/jobs.js +1 -1
  106. package/dist/types/pipeline.d.ts +1 -1
  107. package/package.json +15 -11
  108. package/scripts/bundle +2 -0
  109. package/src/build/base/createBuildJob.ts +3 -2
  110. package/src/build/base/getBuildInfo.ts +1 -1
  111. package/src/build/docker.ts +47 -29
  112. package/src/build/index.ts +8 -5
  113. package/src/build/node/buildJob.ts +2 -2
  114. package/src/build/node/cache.ts +2 -2
  115. package/src/build/node/index.ts +1 -1
  116. package/src/build/node/meteor.ts +8 -2
  117. package/src/build/node/testJob.ts +4 -2
  118. package/src/build/node/yarn.ts +21 -10
  119. package/src/build/tests/storybook.test.ts +1 -1
  120. package/src/build/types.ts +13 -1
  121. package/src/catladder-gitlab.ts +4 -2
  122. package/src/config/configruedEnvs.test.ts +2 -2
  123. package/src/config/configruedEnvs.ts +5 -4
  124. package/src/config/readConfig.ts +1 -1
  125. package/src/context/getEnvConfig.ts +21 -0
  126. package/src/context/getEnvType.ts +17 -0
  127. package/src/context/getEnvironment.ts +40 -0
  128. package/src/context/getEnvironmentContext.ts +57 -0
  129. package/src/context/getEnvironmentVariables.ts +152 -0
  130. package/src/context/getLabels.ts +20 -0
  131. package/src/context/index.ts +25 -191
  132. package/src/context/resolveReferences.test.ts +15 -15
  133. package/src/context/resolveReferences.ts +37 -30
  134. package/src/defaults/index.ts +1 -1
  135. package/src/deploy/base.ts +43 -19
  136. package/src/deploy/cloudRun/deployJob.ts +104 -0
  137. package/src/deploy/cloudRun/index.ts +48 -0
  138. package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +14 -0
  139. package/src/deploy/cloudSql/index.ts +16 -0
  140. package/src/deploy/custom/deployJob.ts +10 -3
  141. package/src/deploy/custom/index.ts +9 -1
  142. package/src/deploy/dockerTag/deployJob.ts +31 -0
  143. package/src/deploy/dockerTag/index.ts +9 -0
  144. package/src/deploy/index.ts +26 -17
  145. package/src/deploy/kubernetes/additionalSecretKeys.ts +23 -0
  146. package/src/deploy/kubernetes/cloudsql.ts +2 -1
  147. package/src/deploy/kubernetes/deployJob.ts +19 -77
  148. package/src/deploy/kubernetes/index.ts +42 -1
  149. package/src/deploy/kubernetes/kubeEnv.ts +48 -0
  150. package/src/deploy/kubernetes/kubeValues.ts +82 -0
  151. package/src/deploy/kubernetes/mongodb.ts +104 -7
  152. package/src/deploy/kubernetes/processSecretsAsFiles.ts +1 -1
  153. package/src/deploy/types/base.ts +17 -0
  154. package/src/deploy/types/custom.ts +24 -0
  155. package/src/deploy/types/dockerTag.ts +12 -0
  156. package/src/deploy/types/googleCloudRun.ts +79 -0
  157. package/src/deploy/types/index.ts +28 -0
  158. package/src/deploy/types/kubernetes.ts +281 -0
  159. package/src/deploy/utils.ts +6 -2
  160. package/src/pipeline/createChildPipeline.test.ts +1 -1
  161. package/src/pipeline/createChildPipeline.ts +4 -4
  162. package/src/pipeline/createJobs.ts +32 -21
  163. package/src/pipeline/gitlab/makeGitlabJob.ts +3 -2
  164. package/src/pipeline/packageManager.ts +1 -1
  165. package/src/rules/index.ts +1 -1
  166. package/src/runner/index.ts +2 -1
  167. package/src/types/config.ts +8 -6
  168. package/src/types/context.ts +14 -2
  169. package/src/types/environmentContext.ts +26 -0
  170. package/src/types/gitlab-types.ts +1 -1
  171. package/src/types/jobs.ts +9 -2
  172. package/src/types/pipeline.ts +1 -1
  173. package/tsconfig.json +2 -0
  174. package/dist/deploy/types.js +0 -16
  175. package/src/deploy/types.ts +0 -189
@@ -1,3 +1,3 @@
1
1
  #! /usr/bin/env node
2
2
 
3
- require("../dist/catladder-gitlab.js");
3
+ require("../dist/bundles/catladder-gitlab/index.js");
@@ -1,5 +1,5 @@
1
- import { Context } from "../..";
2
- import { CatladderJob } from "../../types/jobs";
1
+ import type { Context } from "../..";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createBuildJob: (context: Context, {
4
4
  script,
5
5
  variables,
@@ -1,2 +1,2 @@
1
- import { Context } from "../../types";
1
+ import type { Context } from "../../types";
2
2
  export declare const getBuildInfo: (context: Context) => string[];
@@ -1,7 +1,21 @@
1
- import { Context } from "../types";
2
- import { CatladderJob } from "../types/jobs";
1
+ import type { Context } from "../types";
2
+ import type { CatladderJob } from "../types/jobs";
3
+ export declare const getDockerImageVariables: (context: Context) => {
4
+ DOCKER_REGISTRY: string;
5
+ DOCKER_REGISTRY_IMAGE_PATH: string;
6
+ DOCKER_CACHE_IMAGE: string;
7
+ DOCKER_IMAGE_NAME: string;
8
+ DOCKER_IMAGE: string;
9
+ DOCKER_IMAGE_TAG: string;
10
+ };
3
11
  export declare const requiresDockerBuild: (context: Context) => boolean;
4
12
  export declare const getDockerBuildVariables: (context: Context) => {
13
+ DOCKER_REGISTRY: string;
14
+ DOCKER_REGISTRY_IMAGE_PATH: string;
15
+ DOCKER_CACHE_IMAGE: string;
16
+ DOCKER_IMAGE_NAME: string;
17
+ DOCKER_IMAGE: string;
18
+ DOCKER_IMAGE_TAG: string;
5
19
  DOCKER_BUILDKIT: string;
6
20
  DOCKERFILE_ADDITIONS: string | undefined;
7
21
  DOCKERFILE_ADDITIONS_END: string | undefined;
@@ -9,21 +23,45 @@ export declare const getDockerBuildVariables: (context: Context) => {
9
23
  DOCKER_HOST: string;
10
24
  DOCKER_TLS_CERTDIR: string;
11
25
  DOCKER_DIR: string;
12
- IMAGE_TAG: string;
13
26
  DOCKER_DRIVER: string;
14
- IMAGE_NAME: string;
15
- CACHE_IMAGE: string;
16
27
  KUBERNETES_CPU_REQUEST: string;
17
28
  KUBERNETES_CPU_LIMIT: string;
18
29
  KUBERNETES_MEMORY_REQUEST: string;
19
30
  KUBERNETES_MEMORY_LIMIT: string;
20
31
  };
21
32
  export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
33
+ export declare const getDockerJobBaseProps: (context: Context) => {
34
+ image: string;
35
+ services: {
36
+ name: string;
37
+ command: string[];
38
+ }[];
39
+ variables: {
40
+ DOCKER_REGISTRY: string;
41
+ DOCKER_REGISTRY_IMAGE_PATH: string;
42
+ DOCKER_CACHE_IMAGE: string;
43
+ DOCKER_IMAGE_NAME: string;
44
+ DOCKER_IMAGE: string;
45
+ DOCKER_IMAGE_TAG: string;
46
+ DOCKER_BUILDKIT: string;
47
+ DOCKERFILE_ADDITIONS: string | undefined;
48
+ DOCKERFILE_ADDITIONS_END: string | undefined;
49
+ APP_DIR: string;
50
+ DOCKER_HOST: string;
51
+ DOCKER_TLS_CERTDIR: string;
52
+ DOCKER_DIR: string;
53
+ DOCKER_DRIVER: string;
54
+ KUBERNETES_CPU_REQUEST: string;
55
+ KUBERNETES_CPU_LIMIT: string;
56
+ KUBERNETES_MEMORY_REQUEST: string;
57
+ KUBERNETES_MEMORY_LIMIT: string;
58
+ };
59
+ };
22
60
  export declare const createDockerBuildJobBase: (context: Context, {
23
61
  script,
24
- variables,
25
62
  ...def
26
63
  }: Partial<CatladderJob>) => CatladderJob;
64
+ export declare const gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
27
65
  export declare const createDockerBuildJobDefault: (context: Context, {
28
66
  script,
29
67
  ...def
@@ -61,7 +61,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
61
61
  };
62
62
 
63
63
  exports.__esModule = true;
64
- exports.createDockerBuildJobDefault = exports.createDockerBuildJobBase = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = void 0;
64
+ exports.createDockerBuildJobDefault = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
65
65
 
66
66
  var lodash_1 = require("lodash");
67
67
 
@@ -76,6 +76,19 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
76
76
  KUBERNETES_MEMORY_LIMIT: "2Gi"
77
77
  };
78
78
 
79
+ var getDockerImageVariables = function (context) {
80
+ return {
81
+ DOCKER_REGISTRY: "$CI_REGISTRY",
82
+ DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE",
83
+ DOCKER_CACHE_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/caches/" + context.componentName,
84
+ DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
85
+ DOCKER_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/$DOCKER_IMAGE_NAME",
86
+ DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
87
+ };
88
+ };
89
+
90
+ exports.getDockerImageVariables = getDockerImageVariables;
91
+
79
92
  var requiresDockerBuild = function (context) {
80
93
  var deployConfig = context.componentConfig.deploy;
81
94
 
@@ -83,10 +96,18 @@ var requiresDockerBuild = function (context) {
83
96
  return true;
84
97
  }
85
98
 
99
+ if ((0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
100
+ return true;
101
+ }
102
+
86
103
  if ((0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker) {
87
104
  return true;
88
105
  }
89
106
 
107
+ if ((0, deploy_1.isOfDeployType)(deployConfig, "dockerTag")) {
108
+ return true;
109
+ }
110
+
90
111
  return false;
91
112
  };
92
113
 
@@ -95,7 +116,7 @@ exports.requiresDockerBuild = requiresDockerBuild;
95
116
  var getDockerBuildVariables = function (context) {
96
117
  var _a, _b, _c, _d;
97
118
 
98
- return __assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
119
+ return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
99
120
  DOCKER_BUILDKIT: "1",
100
121
  DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
101
122
  DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
@@ -103,43 +124,48 @@ var getDockerBuildVariables = function (context) {
103
124
  DOCKER_HOST: "tcp://0.0.0.0:2375",
104
125
  DOCKER_TLS_CERTDIR: "",
105
126
  DOCKER_DIR: ".",
106
- IMAGE_TAG: "$CI_COMMIT_SHA",
107
- DOCKER_DRIVER: "overlay2",
108
- IMAGE_NAME: "$CI_REGISTRY_IMAGE/" + context.environment.shortName + "/" + context.componentName,
109
- CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName
110
- });
127
+ DOCKER_DRIVER: "overlay2"
128
+ }), (0, exports.getDockerImageVariables)(context));
111
129
  };
112
130
 
113
131
  exports.getDockerBuildVariables = getDockerBuildVariables;
114
132
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
115
133
 
116
- var createDockerBuildJobBase = function (context, _a) {
117
- var script = _a.script,
118
- variables = _a.variables,
119
- def = __rest(_a, ["script", "variables"]);
120
-
121
- return (0, lodash_1.merge)({
122
- name: exports.DOCKER_BUILD_JOB_NAME,
123
- envMode: "jobPerEnv",
124
- stage: "build",
134
+ var getDockerJobBaseProps = function (context) {
135
+ return {
125
136
  image: (0, runner_1.getRunnerImage)("docker-build"),
126
137
  services: [{
127
138
  name: "docker:20-dind",
128
139
  command: ["--tls=false"]
129
140
  }],
130
- variables: __assign(__assign({}, (0, exports.getDockerBuildVariables)(context)), variables !== null && variables !== void 0 ? variables : {}),
141
+ variables: (0, exports.getDockerBuildVariables)(context)
142
+ };
143
+ };
144
+
145
+ exports.getDockerJobBaseProps = getDockerJobBaseProps;
146
+
147
+ var createDockerBuildJobBase = function (context, _a) {
148
+ var script = _a.script,
149
+ def = __rest(_a, ["script"]);
150
+
151
+ return (0, lodash_1.merge)(__assign(__assign({
152
+ name: exports.DOCKER_BUILD_JOB_NAME,
153
+ envMode: "jobPerEnv",
154
+ stage: "build"
155
+ }, (0, exports.getDockerJobBaseProps)(context)), {
131
156
  script: script || []
132
- }, def);
157
+ }), def);
133
158
  };
134
159
 
135
160
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
161
+ exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
136
162
 
137
163
  var createDockerBuildJobDefault = function (context, _a) {
138
164
  var script = _a.script,
139
165
  def = __rest(_a, ["script"]);
140
166
 
141
167
  return (0, exports.createDockerBuildJobBase)(context, __assign({
142
- 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)
168
+ script: __spreadArray(__spreadArray([], __read(script || []), false), [exports.gitlabDockerLogin, "docker version", "docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"], false)
143
169
  }, def));
144
170
  };
145
171
 
@@ -1,11 +1,12 @@
1
- import { Context } from "../types/context";
2
- import { CatladderJob } from "../types/jobs";
3
- import { BuildConfig } from "./types";
1
+ import type { Context } from "../types/context";
2
+ import type { EnvironmentContext } from "../types/environmentContext";
3
+ import type { CatladderJob } from "../types/jobs";
4
+ import type { BuildConfig, BuildConfigType } from "./types";
4
5
  export * from "./types";
5
6
  export * from "./node";
6
- export declare type BuildTypes = { [type in BuildConfig["type"]]: {
7
+ export declare type BuildTypes = { [type in BuildConfigType]: {
7
8
  jobs: (context: Context) => CatladderJob[];
8
- defaults: () => Partial<Extract<BuildConfig, {
9
+ defaults: (envVarContext: EnvironmentContext<BuildConfigType, any>) => Partial<Extract<BuildConfig, {
9
10
  type: type;
10
11
  }>>;
11
12
  } };
@@ -1,3 +1,3 @@
1
- import { Context } from "../../types/context";
2
- import { CatladderJob } from "../../types/jobs";
1
+ import type { Context } from "../../types/context";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createNodeBuildJobs: (context: Context) => CatladderJob[];
@@ -1,5 +1,5 @@
1
- import { Context } from "../../types/context";
2
- import { GitlabJobCache } from "../../types/gitlab-types";
1
+ import type { Context } from "../../types/context";
2
+ import type { GitlabJobCache } from "../../types/gitlab-types";
3
3
  export declare const getYarnCache: (context: Context, policy?: string) => GitlabJobCache[];
4
4
  export declare const getNodeModulesCache: (context: Context, policy?: string) => GitlabJobCache[];
5
5
  export declare const getNodeCache: (context: Context, policy?: string) => GitlabJobCache[];
@@ -1,5 +1,5 @@
1
1
  import type { Context } from "../../types/context";
2
- import { CatladderJob } from "../../types/jobs";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createNodeJobs: (context: Context) => CatladderJob[];
4
4
  export declare const createStorybookJobs: (context: Context) => CatladderJob[];
5
5
  export declare const createMeteorJobs: (context: Context) => CatladderJob[];
@@ -1,3 +1,3 @@
1
1
  import type { Context } from "../../types/context";
2
- import { CatladderJob } from "../../types/jobs";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createMeteorBuildJobs: (context: Context) => CatladderJob[];
@@ -73,6 +73,9 @@ var createMeteorBuildJobs = function (context) {
73
73
  var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
74
74
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
75
75
  image: (0, runner_1.getRunnerImage)("jobs-meteor"),
76
+ variables: {
77
+ METEOR_DISABLE_OPTIMISTIC_CACHING: "1"
78
+ },
76
79
  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),
77
80
  artifacts: {
78
81
  paths: [context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/dist"]
@@ -80,6 +83,9 @@ var createMeteorBuildJobs = function (context) {
80
83
  }) : null;
81
84
  return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), [(0, docker_1.createDockerBuildJobDefault)(context, {
82
85
  script: ["ensureMeteorDockerfile"],
86
+ variables: {
87
+ METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
88
+ },
83
89
  needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
84
90
  })], false);
85
91
  };
@@ -1,3 +1,3 @@
1
- import { Context } from "../../types/context";
2
- import { CatladderJob } from "../../types/jobs";
1
+ import type { Context } from "../../types/context";
2
+ import type { CatladderJob } from "../../types/jobs";
3
3
  export declare const createNodeTestJobs: (context: Context) => CatladderJob[];
@@ -52,6 +52,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
52
52
  exports.__esModule = true;
53
53
  exports.createNodeTestJobs = void 0;
54
54
 
55
+ var runner_1 = require("../../runner");
56
+
55
57
  var utils_1 = require("../../utils");
56
58
 
57
59
  var cache_1 = require("./cache");
@@ -95,6 +97,7 @@ var createNodeTestJobs = function (context) {
95
97
  var testJob = buildConfig.test !== false ? __assign(__assign({
96
98
  name: "🧪 test"
97
99
  }, base), {
100
+ image: (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
98
101
  cache: (0, cache_1.getNodeCache)(context),
99
102
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_j = (0, utils_1.ensureArray)((_h = buildConfig.test) === null || _h === void 0 ? void 0 : _h.command)) !== null && _j !== void 0 ? _j : ["yarn test"]), false)
100
103
  }) : null;
@@ -1,4 +1,4 @@
1
- import { Context } from "../../types";
1
+ import type { Context } from "../../types";
2
2
  export declare const getYarnInstallCommand: (context: Context, options?: {
3
3
  prodOnly?: boolean | undefined;
4
4
  noScripts?: boolean | undefined;
@@ -41,7 +41,19 @@ exports.getYarnInstall = exports.ensureNodeVersion = exports.getYarnInstallComma
41
41
  var getYarnInstallCommand = function (context, options) {
42
42
  var _a;
43
43
 
44
- return ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) ? "yarn install --frozen-lockfile ".concat((options === null || options === void 0 ? void 0 : options.prodOnly) ? "--production" : "", " ").concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "--ignore-scripts" : "") : (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn plugin import workspace-tools && yarn workspaces focus --production") // needs yarn plugin import workspace-tools
44
+ if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
45
+ return "yarn install --frozen-lockfile ".concat((options === null || options === void 0 ? void 0 : options.prodOnly) ? "--production" : "", " ").concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "--ignore-scripts" : "");
46
+ } // is modern
47
+ // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
48
+ // trying to import those fail on this version
49
+
50
+
51
+ var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
52
+ var _a;
53
+
54
+ return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
55
+ });
56
+ return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production") // needs yarn plugin import workspace-tools
45
57
  : "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
46
58
  };
47
59
 
@@ -59,12 +59,22 @@ export declare type BuildConfigNodeStatic = BuildConfigNodeBase & {
59
59
  };
60
60
  export declare type BuildConfigMeteor = BuildConfigNodeBase & {
61
61
  type: "meteor";
62
+ /**
63
+ * whether to run yarn install inside the source folder in the docker image.
64
+ * This is only required if you have custom scripts in your image
65
+ */
66
+
67
+ installScripts?: boolean;
62
68
  };
63
69
  export declare type BuildConfigStorybook = BuildConfigNodeBase & {
64
70
  type: "storybook";
65
71
  startCommand?: never;
66
72
  };
67
73
  export declare type BuildConfig = BuildConfigNode | BuildConfigNodeStatic | BuildConfigStorybook | BuildConfigMeteor;
74
+ export declare type BuildConfigType = BuildConfig["type"];
75
+ export declare type BuildConfigGeneric<T extends BuildConfigType> = Extract<BuildConfig, {
76
+ type: T;
77
+ }>;
68
78
  export declare const isOfBuildType: <T extends ("node" | "node-static" | "meteor" | "storybook")[]>(t: BuildConfig, ...types: T) => t is Extract<BuildConfigNode, {
69
79
  type: T[number];
70
80
  }> | Extract<BuildConfigNodeStatic, {