@catladder/pipeline 1.170.1 โ†’ 2.0.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 (192) hide show
  1. package/dist/bash/BashExpression.d.ts +1 -6
  2. package/dist/bash/BashExpression.js +2 -15
  3. package/dist/bash/bashEscape.d.ts +34 -0
  4. package/dist/bash/bashEscape.js +114 -0
  5. package/dist/bash/bashYaml.js +25 -2
  6. package/dist/bash/getInjectVarsScript.js +4 -2
  7. package/dist/bash/index.d.ts +2 -0
  8. package/dist/bash/index.js +26 -0
  9. package/dist/build/base/createAppBuildJob.js +3 -3
  10. package/dist/build/base/writeDotEnv.js +6 -4
  11. package/dist/build/custom/testJob.js +12 -12
  12. package/dist/build/docker.d.ts +3 -3
  13. package/dist/build/node/buildJob.js +1 -1
  14. package/dist/build/node/cache.d.ts +2 -4
  15. package/dist/build/node/cache.js +3 -24
  16. package/dist/build/node/testJob.js +11 -11
  17. package/dist/build/rails/build.js +1 -1
  18. package/dist/build/rails/test.js +8 -8
  19. package/dist/build/types.d.ts +0 -10
  20. package/dist/constants.js +1 -1
  21. package/dist/context/createComponentContext.js +0 -1
  22. package/dist/context/getEnvConfig.js +2 -1
  23. package/dist/context/getEnvironment.js +1 -2
  24. package/dist/context/getEnvironmentVariables.d.ts +5 -6
  25. package/dist/context/getEnvironmentVariables.js +50 -38
  26. package/dist/deploy/base/deploy.js +3 -3
  27. package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -2
  28. package/dist/deploy/cloudRun/index.js +2 -2
  29. package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
  30. package/dist/deploy/kubernetes/cloudSql/index.d.ts +2 -2
  31. package/dist/deploy/kubernetes/cloudSql/index.js +3 -14
  32. package/dist/deploy/kubernetes/deployJob.js +1 -3
  33. package/dist/deploy/kubernetes/index.js +2 -2
  34. package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -3
  35. package/dist/deploy/kubernetes/kubeValues.d.ts +3 -4
  36. package/dist/deploy/kubernetes/kubeValues.js +2 -3
  37. package/dist/deploy/types/base.d.ts +0 -6
  38. package/dist/deploy/types/kubernetes.d.ts +1 -34
  39. package/dist/globalScriptFunctions/index.d.ts +14 -0
  40. package/dist/globalScriptFunctions/index.js +37 -0
  41. package/dist/index.d.ts +3 -1
  42. package/dist/index.js +3 -1
  43. package/dist/pipeline/gitlab/createGitlabJobs.js +3 -5
  44. package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +1 -0
  45. package/dist/pipeline/gitlab/createGitlabPipeline.js +38 -2
  46. package/dist/pipeline/packageManager.js +1 -1
  47. package/dist/runner/index.d.ts +1 -1
  48. package/dist/tsconfig.tsbuildinfo +1 -1
  49. package/dist/types/config.d.ts +6 -9
  50. package/dist/types/context.d.ts +2 -9
  51. package/dist/types/gitlab-types.d.ts +1 -0
  52. package/dist/types/jobs.d.ts +0 -8
  53. package/dist/utils/gitlab.js +4 -1
  54. package/dist/utils/writeFiles.js +1 -7
  55. package/dist/variables/VariableValue.d.ts +3 -0
  56. package/dist/variables/VariableValue.js +5 -0
  57. package/dist/variables/VariableValueContainingReferences.d.ts +24 -0
  58. package/dist/variables/VariableValueContainingReferences.js +97 -0
  59. package/dist/variables/__tests__/resolveAllReferences.test.js +219 -0
  60. package/dist/variables/__tests__/resolveAllReferencesOnce.test.d.ts +1 -0
  61. package/dist/variables/__tests__/resolveAllReferencesOnce.test.js +171 -0
  62. package/dist/variables/__tests__/resolveReferencesOnce.test.d.ts +1 -0
  63. package/dist/variables/__tests__/resolveReferencesOnce.test.js +202 -0
  64. package/dist/variables/__tests__/variableValue.test.d.ts +1 -0
  65. package/dist/variables/__tests__/variableValue.test.js +36 -0
  66. package/dist/variables/resolveAllReferences.d.ts +3 -0
  67. package/dist/{bash/replaceAsync.js โ†’ variables/resolveAllReferences.js} +60 -40
  68. package/dist/variables/resolveAllReferencesOnce.d.ts +5 -0
  69. package/dist/variables/resolveAllReferencesOnce.js +191 -0
  70. package/dist/variables/resolveReferencesOnce.d.ts +8 -0
  71. package/dist/variables/resolveReferencesOnce.js +22 -0
  72. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +312 -238
  73. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +312 -238
  74. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +312 -222
  75. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1436 -0
  76. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +312 -238
  77. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +316 -238
  78. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +312 -238
  79. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +313 -238
  80. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +312 -238
  81. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +312 -238
  82. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +312 -238
  83. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +312 -238
  84. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +316 -238
  85. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +294 -220
  86. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +312 -238
  87. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +652 -486
  88. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +282 -288
  89. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +312 -238
  90. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +284 -194
  91. package/examples/__snapshots__/custom-build-job.test.ts.snap +278 -188
  92. package/examples/__snapshots__/custom-deploy.test.ts.snap +220 -154
  93. package/examples/__snapshots__/custom-envs.test.ts.snap +216 -126
  94. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +278 -188
  95. package/examples/__snapshots__/git-submodule.test.ts.snap +312 -238
  96. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +231 -253
  97. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +240 -262
  98. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +504 -506
  99. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +239 -261
  100. package/examples/__snapshots__/local-dot-env.test.ts.snap +236 -238
  101. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +236 -242
  102. package/examples/__snapshots__/multiline-var.test.ts.snap +1355 -973
  103. package/examples/__snapshots__/native-app.test.ts.snap +438 -392
  104. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +312 -238
  105. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +312 -238
  106. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +186 -188
  107. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +162 -164
  108. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +971 -765
  109. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +330 -228
  110. package/examples/__snapshots__/{workspace-api-www-custom-cache.test.ts.snap โ†’ workspace-api-www-turbo-cache.test.ts.snap} +457 -499
  111. package/examples/__snapshots__/workspace-api-www.test.ts.snap +452 -482
  112. package/examples/{workspace-api-www-custom-cache.test.ts โ†’ cloud-run-nextjs.test.ts} +2 -2
  113. package/examples/cloud-run-nextjs.ts +28 -0
  114. package/examples/cloud-run-with-sql.ts +0 -1
  115. package/examples/kubernetes-application-customization.ts +1 -0
  116. package/examples/kubernetes-with-cloud-sql.ts +1 -0
  117. package/examples/kubernetes-with-jobs.ts +1 -0
  118. package/examples/kubernetes-with-mongodb.ts +1 -0
  119. package/examples/meteor-kubernetes.ts +1 -1
  120. package/examples/native-app.ts +10 -7
  121. package/examples/rails-k8s-with-worker.ts +7 -1
  122. package/examples/{kubernetes-with-cloud-sql-legacy.test.ts โ†’ workspace-api-www-turbo-cache.test.ts} +2 -2
  123. package/examples/{workspace-api-www-custom-cache.ts โ†’ workspace-api-www-turbo-cache.ts} +4 -3
  124. package/examples/workspace-api-www.ts +3 -2
  125. package/package.json +2 -6
  126. package/src/bash/BashExpression.ts +0 -13
  127. package/src/bash/bashEscape.ts +158 -0
  128. package/src/bash/bashYaml.ts +36 -2
  129. package/src/bash/getInjectVarsScript.ts +11 -2
  130. package/src/bash/index.ts +2 -0
  131. package/src/build/base/createAppBuildJob.ts +0 -1
  132. package/src/build/base/writeDotEnv.ts +6 -6
  133. package/src/build/custom/testJob.ts +0 -1
  134. package/src/build/node/buildJob.ts +2 -2
  135. package/src/build/node/cache.ts +0 -29
  136. package/src/build/node/testJob.ts +0 -1
  137. package/src/build/rails/build.ts +0 -1
  138. package/src/build/rails/test.ts +0 -1
  139. package/src/build/types.ts +0 -13
  140. package/src/context/createComponentContext.ts +0 -1
  141. package/src/context/getEnvConfig.ts +2 -2
  142. package/src/context/getEnvironment.ts +1 -1
  143. package/src/context/getEnvironmentContext.ts +1 -1
  144. package/src/context/getEnvironmentVariables.ts +44 -51
  145. package/src/deploy/base/deploy.ts +1 -1
  146. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +4 -12
  147. package/src/deploy/cloudRun/index.ts +2 -2
  148. package/src/deploy/kubernetes/cloudSql/index.ts +3 -16
  149. package/src/deploy/kubernetes/deployJob.ts +0 -2
  150. package/src/deploy/kubernetes/index.ts +2 -2
  151. package/src/deploy/kubernetes/kubeEnv.ts +3 -3
  152. package/src/deploy/kubernetes/kubeValues.ts +5 -8
  153. package/src/deploy/types/base.ts +0 -6
  154. package/src/deploy/types/kubernetes.ts +1 -36
  155. package/src/globalScriptFunctions/index.ts +30 -0
  156. package/src/index.ts +2 -0
  157. package/src/pipeline/gitlab/createGitlabJobs.ts +1 -4
  158. package/src/pipeline/gitlab/createGitlabPipeline.ts +8 -1
  159. package/src/pipeline/packageManager.ts +7 -5
  160. package/src/runner/index.ts +0 -1
  161. package/src/types/config.ts +6 -9
  162. package/src/types/context.ts +3 -9
  163. package/src/types/gitlab-types.ts +1 -0
  164. package/src/types/jobs.ts +0 -8
  165. package/src/utils/gitlab.ts +19 -2
  166. package/src/utils/writeFiles.ts +1 -2
  167. package/src/variables/VariableValue.ts +6 -0
  168. package/src/variables/VariableValueContainingReferences.ts +89 -0
  169. package/src/variables/__tests__/resolveAllReferences.test.ts +110 -0
  170. package/src/variables/__tests__/resolveAllReferencesOnce.test.ts +64 -0
  171. package/src/variables/__tests__/resolveReferencesOnce.test.ts +117 -0
  172. package/src/variables/__tests__/variableValue.test.ts +73 -0
  173. package/src/variables/resolveAllReferences.ts +46 -0
  174. package/src/variables/resolveAllReferencesOnce.ts +44 -0
  175. package/src/variables/resolveReferencesOnce.ts +29 -0
  176. package/bin/catladder-gitlab-dev.js +0 -3
  177. package/bin/catladder-gitlab.js +0 -3
  178. package/dist/bash/replaceAsync.d.ts +0 -2
  179. package/dist/bundles/catladder-gitlab/index.js +0 -15
  180. package/dist/context/__tests__/resolveReferences.test.js +0 -368
  181. package/dist/context/resolveReferences.d.ts +0 -6
  182. package/dist/context/resolveReferences.js +0 -286
  183. package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +0 -85
  184. package/dist/deploy/kubernetes/processSecretsAsFiles.js +0 -33
  185. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +0 -1795
  186. package/examples/kubernetes-with-cloud-sql-legacy.ts +0 -35
  187. package/scripts/bundle +0 -2
  188. package/src/bash/replaceAsync.ts +0 -49
  189. package/src/context/__tests__/resolveReferences.test.ts +0 -148
  190. package/src/context/resolveReferences.ts +0 -93
  191. package/src/deploy/kubernetes/processSecretsAsFiles.ts +0 -35
  192. /package/dist/{context/__tests__/resolveReferences.test.d.ts โ†’ variables/__tests__/resolveAllReferences.test.d.ts} +0 -0
@@ -33,9 +33,4 @@ export declare const getBashVariable: (name: string) => BashExpression;
33
33
  * @param joiner
34
34
  * @returns
35
35
  */
36
- export declare const joinBashExpressions: (parts: Array<StringOrBashExpression>, joiner?: string) => StringOrBashExpression;
37
- /**
38
- * escapes a string or bash expression for bash
39
- * it mainly escapes double quotes
40
- */
41
- export declare const bashEscape: (value: StringOrBashExpression | any) => any;
36
+ export declare const joinBashExpressions: (parts: Array<StringOrBashExpression>, joiner?: string) => StringOrBashExpression;
@@ -34,7 +34,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
34
34
  Object.defineProperty(exports, "__esModule", {
35
35
  value: true
36
36
  });
37
- exports.bashEscape = exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
37
+ exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
38
38
  /**
39
39
  * this class represents a string that can be evaluated in bash scripts.
40
40
  *
@@ -111,17 +111,4 @@ var joinBashExpressions = function (parts, joiner) {
111
111
  return parts.join(joiner);
112
112
  }
113
113
  };
114
- exports.joinBashExpressions = joinBashExpressions;
115
- /**
116
- * escapes a string or bash expression for bash
117
- * it mainly escapes double quotes
118
- */
119
- var bashEscape = function (value) {
120
- if (value instanceof BashExpression) {
121
- return value.toString(); // no need to escape bash expressions, as we want them to evaluate
122
- }
123
- // we wrap it in double quotes, so we need to escape them
124
- if (typeof value === "string") return value.replace(/"/g, '\\"');
125
- return value;
126
- };
127
- exports.bashEscape = bashEscape;
114
+ exports.joinBashExpressions = joinBashExpressions;
@@ -0,0 +1,34 @@
1
+ import type { VariableValue } from "../variables/VariableValue";
2
+ import { BashExpression } from "./BashExpression";
3
+ export type QuotesEscapeMode = "single" | "double";
4
+ export type EscapeOptions = {
5
+ quotes?: QuotesEscapeMode | false;
6
+ };
7
+ /**
8
+ * escapes a string or bash expression for bash
9
+ * it either can escape single or double quotes (double is default)
10
+ */
11
+ export declare const bashEscape: (value: VariableValue | any, options?: EscapeOptions) => string | BashExpression | null | undefined;
12
+ export declare const escapeString: (value: string | null | undefined, {
13
+ quotes
14
+ }?: EscapeOptions) => string | null | undefined;
15
+ export declare const escapeBashExpression: (value: BashExpression, options: EscapeOptions) => BashExpression;
16
+ export declare const escapeDoubleQuotes: (value: string | null | undefined) => string | undefined;
17
+ export declare const escapeSingleQuotes: (value: string | null | undefined) => string | undefined;
18
+ /**
19
+ *
20
+ * escape env vars for .env files.
21
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
22
+ *
23
+ * - when the value contains no newlines, we are fine
24
+ * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
25
+ * - you can't escape quotes. this is a limitation of dotenv and node
26
+ * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
27
+ * - so we need to quote cleverly
28
+ * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
29
+ *
30
+ * what an absolute nightmare.
31
+ *
32
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
33
+ */
34
+ export declare const escapeForDotEnv: (value: VariableValue | undefined | null) => string;
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.escapeForDotEnv = exports.escapeSingleQuotes = exports.escapeDoubleQuotes = exports.escapeBashExpression = exports.escapeString = exports.bashEscape = void 0;
7
+ var globalScriptFunctions_1 = require("../globalScriptFunctions");
8
+ var VariableValueContainingReferences_1 = require("../variables/VariableValueContainingReferences");
9
+ var BashExpression_1 = require("./BashExpression");
10
+ /**
11
+ * escapes a string or bash expression for bash
12
+ * it either can escape single or double quotes (double is default)
13
+ */
14
+ var bashEscape = function (value, options) {
15
+ if (options === void 0) {
16
+ options = {
17
+ quotes: "double"
18
+ };
19
+ }
20
+ if (value instanceof BashExpression_1.BashExpression) {
21
+ // no need to escape
22
+ return (0, exports.escapeBashExpression)(value, options);
23
+ }
24
+ if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
25
+ return value.toString(options);
26
+ }
27
+ return (0, exports.escapeString)(value, options);
28
+ };
29
+ exports.bashEscape = bashEscape;
30
+ var escapeString = function (value, _a) {
31
+ var _b = _a === void 0 ? {
32
+ quotes: "double"
33
+ } : _a,
34
+ quotes = _b.quotes;
35
+ var quoteEscaped = quotes ? quotes === "single" ? (0, exports.escapeSingleQuotes)(value) : (0, exports.escapeDoubleQuotes)(value) : value;
36
+ return quoteEscaped;
37
+ };
38
+ exports.escapeString = escapeString;
39
+ var escapeBashExpression = function (value, options) {
40
+ // no need to escape, we just return the string
41
+ return value;
42
+ };
43
+ exports.escapeBashExpression = escapeBashExpression;
44
+ var escapeDoubleQuotes = function (value) {
45
+ return value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
46
+ };
47
+ exports.escapeDoubleQuotes = escapeDoubleQuotes;
48
+ var escapeSingleQuotes = function (value) {
49
+ return value === null || value === void 0 ? void 0 : value.toString().replace(/'/g, "\\'");
50
+ };
51
+ exports.escapeSingleQuotes = escapeSingleQuotes;
52
+ /**
53
+ *
54
+ * escape env vars for .env files.
55
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
56
+ *
57
+ * - when the value contains no newlines, we are fine
58
+ * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
59
+ * - you can't escape quotes. this is a limitation of dotenv and node
60
+ * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
61
+ * - so we need to quote cleverly
62
+ * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
63
+ *
64
+ * what an absolute nightmare.
65
+ *
66
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
67
+ */
68
+ var escapeForDotEnv = function (value) {
69
+ if (value === undefined || value === null) {
70
+ return "";
71
+ }
72
+ if (typeof value === "string") {
73
+ // if string contains newlines, we need to wrap it in quotes
74
+ // we additionaly escape newlines, that give best compatibility
75
+ if (value.includes("\n")) {
76
+ var newlinesReplaces = value.replace(/\n/g, "\\n");
77
+ // default to ", but if this is not possible, we try to use ' or `
78
+ var quote = value.includes("\"") ? value.includes("'") ? value.includes("`") ?
79
+ // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
80
+ '"' : "`" : "'" : '"';
81
+ // if we found a quote, we can wrap the string in it
82
+ return "".concat(quote).concat(newlinesReplaces).concat(quote);
83
+ } else {
84
+ // otherwise we can return as is
85
+ return value;
86
+ }
87
+ } else if (value instanceof BashExpression_1.BashExpression) {
88
+ return escapeBashExpressionForDotEnv(value);
89
+ } else if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
90
+ // instead of doing it part-wise, we just do it all at once
91
+ var containsAnyBashExpression = value.parts.some(function (part) {
92
+ return part instanceof BashExpression_1.BashExpression;
93
+ });
94
+ if (!containsAnyBashExpression) {
95
+ return (0, exports.escapeForDotEnv)(value.toString({
96
+ quotes: "double"
97
+ }));
98
+ } else {
99
+ var result = escapeBashExpressionForDotEnv(new BashExpression_1.BashExpression(value.toString({
100
+ quotes: "double"
101
+ })));
102
+ return result;
103
+ }
104
+ } else {
105
+ return value;
106
+ }
107
+ };
108
+ exports.escapeForDotEnv = escapeForDotEnv;
109
+ // basically the same thing as above for bash
110
+ // thx chatgpt for this
111
+ var escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFunction)("escapeForDotEnv", "\n input=\"${1:-$(cat)}\"\n input=\"${input//$'\\n'/\\\\n}\"\n if [[ \"$input\" == *\\\\n* ]]; then\n if [[ \"$input\" == *\\\"* && \"$input\" == *\\'* && \"$input\" == *\\`* ]]; then\n printf \"\\\"%s\\\"\\n\" \"$input\" ".concat( /* fallback to double quotes */"", "\n elif [[ \"$input\" == *\\\"* && \"$input\" == *\\'* ]]; then\n printf \"`%s`\\n\" \"$input\"\n elif [[ \"$input\" == *\\\"* ]]; then\n printf \"'%s'\\n\" \"$input\"\n else\n printf \"\\\"%s\\\"\\n\" \"$input\"\n fi\n else\n printf \"%s\\n\" \"$input\"\n fi\n "));
112
+ var escapeBashExpressionForDotEnv = function (value) {
113
+ return value.transformWithCommand(escapeForDotEnvScript.name).toString();
114
+ };
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.writeBashYamlToFileScript = exports.yamlBashString = void 0;
7
7
  var yaml_1 = require("yaml");
8
8
  var BashExpression_1 = require("./BashExpression");
9
+ var VariableValueContainingReferences_1 = require("../variables/VariableValueContainingReferences");
9
10
  var bashExpressionType = {
10
11
  tag: "",
11
12
  resolve: function (str) {
@@ -16,12 +17,34 @@ var bashExpressionType = {
16
17
  // we create a BLOCK_LITERAL
17
18
  // but because bash will interpret the value, it may resolve to a multiline string
18
19
  // so we need to indent every line using sed
19
- return "|-\n" + node.value.transformWithCommand("sed 's/^/".concat(ctx.indent, "/'"));
20
+ return "|-\n" + ctx.indent + indentNewlinesInBashExpression(node.value, ctx.indent);
20
21
  },
21
22
  identify: function (v) {
22
23
  return v instanceof BashExpression_1.BashExpression;
23
24
  }
24
25
  };
26
+ var indentNewlinesInBashExpression = function (expression, indent) {
27
+ return expression.transformWithCommand("sed '1!s/^/".concat(indent, "/'"));
28
+ };
29
+ var variableContainingReferences = {
30
+ tag: "",
31
+ resolve: function (str) {
32
+ // not really needed,but let's make typescript happy
33
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
34
+ },
35
+ stringify: function (node, ctx) {
36
+ var value = node.value;
37
+ var stringified = value.parts.map(function (part) {
38
+ return part instanceof BashExpression_1.BashExpression ? indentNewlinesInBashExpression(part, ctx.indent) :
39
+ // indent every new line
40
+ part.toString().replace(/\n/g, "\n".concat(ctx.indent));
41
+ }).join("");
42
+ return "|-\n" + ctx.indent + stringified;
43
+ },
44
+ identify: function (v) {
45
+ return v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences;
46
+ }
47
+ };
25
48
  /***
26
49
  * creates a yaml string that can be used in bash scripts
27
50
  * it handles BashExpressions correctly so that they can be evaluated in bash
@@ -30,7 +53,7 @@ var yamlBashString = function (value) {
30
53
  return (0, yaml_1.stringify)(value, {
31
54
  defaultStringType: "BLOCK_LITERAL",
32
55
  defaultKeyType: "PLAIN",
33
- customTags: [bashExpressionType],
56
+ customTags: [bashExpressionType, variableContainingReferences],
34
57
  aliasDuplicateObjects: false,
35
58
  lineWidth: 0
36
59
  });
@@ -27,7 +27,7 @@ Object.defineProperty(exports, "__esModule", {
27
27
  });
28
28
  exports.getInjectVarsScript = void 0;
29
29
  var lodash_1 = require("lodash");
30
- var BashExpression_1 = require("./BashExpression");
30
+ var bashEscape_1 = require("./bashEscape");
31
31
  var getInjectVarsScript = function (vars) {
32
32
  if (!vars) return [];
33
33
  // filter out null and undefined values
@@ -39,7 +39,9 @@ var getInjectVarsScript = function (vars) {
39
39
  var _b = __read(_a, 2),
40
40
  key = _b[0],
41
41
  value = _b[1];
42
- return "export ".concat(key, "=\"").concat(value ? (0, BashExpression_1.bashEscape)(value) : "", "\"");
42
+ return "export ".concat(key, "=\"").concat(value ? (0, bashEscape_1.bashEscape)(value, {
43
+ quotes: "double"
44
+ }) : "", "\"");
43
45
  });
44
46
  };
45
47
  exports.getInjectVarsScript = getInjectVarsScript;
@@ -0,0 +1,2 @@
1
+ export * from "./bashEscape";
2
+ export * from "./BashExpression";
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+
3
+ var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = {
8
+ enumerable: true,
9
+ get: function () {
10
+ return m[k];
11
+ }
12
+ };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ } : function (o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ });
19
+ var __exportStar = this && this.__exportStar || function (m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", {
23
+ value: true
24
+ });
25
+ __exportStar(require("./bashEscape"), exports);
26
+ __exportStar(require("./BashExpression"), exports);
@@ -63,7 +63,7 @@ var constants_1 = require("./constants");
63
63
  var writeBuildInfo_1 = require("./writeBuildInfo");
64
64
  var writeDotEnv_1 = require("./writeDotEnv");
65
65
  var createAppBuildJob = function (context, _a) {
66
- var _b, _c;
66
+ var _b;
67
67
  var script = _a.script,
68
68
  variables = _a.variables,
69
69
  runnerVariables = _a.runnerVariables,
@@ -76,8 +76,8 @@ var createAppBuildJob = function (context, _a) {
76
76
  image: (0, __1.getRunnerImage)("jobs-default"),
77
77
  needs: [],
78
78
  cache: cache ? (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, cache) : undefined,
79
- variables: __assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.type === "component" ? __assign(__assign(__assign({}, context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {}) : {}),
80
- runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {}),
79
+ variables: __assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.type === "component" ? __assign(__assign({}, context.environment.envVars), context.environment.jobOnlyVars.build.envVars) : {}),
80
+ runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_b = context.build.config.runnerVariables) !== null && _b !== void 0 ? _b : {}),
81
81
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(context.type === "component" ? (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context) ? (0, writeDotEnv_1.writeDotEnv)(context) : [] : context.type === "workspace" ? context.components.filter(function (c) {
82
82
  return (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c);
83
83
  }).flatMap(function (c) {
@@ -27,8 +27,9 @@ Object.defineProperty(exports, "__esModule", {
27
27
  });
28
28
  exports.componentContextNeedsBuildTimeDotEnv = exports.writeDotEnv = void 0;
29
29
  var lodash_1 = require("lodash");
30
- var gitlab_1 = require("../../utils/gitlab");
30
+ var bashEscape_1 = require("../../bash/bashEscape");
31
31
  var getBuildInfoVariables_1 = require("../../context/getBuildInfoVariables");
32
+ var gitlab_1 = require("../../utils/gitlab");
32
33
  /**
33
34
  * writes a .env file in the components folder
34
35
  * @param context
@@ -54,13 +55,14 @@ var writeDotEnv = function (context) {
54
55
  var _b = __read(_a, 2),
55
56
  key = _b[0],
56
57
  value = _b[1];
57
- return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
58
+ return "".concat(key, "=").concat((0, bashEscape_1.escapeForDotEnv)(value));
58
59
  }).join("\n");
59
- return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")(["cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF")]);
60
+ return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env for " + context.name)(["cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF")]);
60
61
  };
61
62
  exports.writeDotEnv = writeDotEnv;
62
63
  var componentContextNeedsBuildTimeDotEnv = function (context) {
63
- return context.componentConfig.dotEnv === true; // don't build when set to `local`
64
+ var _a;
65
+ return ((_a = context.componentConfig.dotEnv) !== null && _a !== void 0 ? _a : true) === true; // don't build when set to `local`
64
66
  };
65
67
 
66
68
  exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDotEnv;
@@ -55,7 +55,7 @@ var RUNNER_CUSTOM_TEST_VARIABLES = {
55
55
  KUBERNETES_MEMORY_LIMIT: "4Gi"
56
56
  };
57
57
  var createCustomTestJobs = function (context) {
58
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
58
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
59
59
  // don't run tests after release
60
60
  // TODO: this will be replaced by using rules
61
61
  if (context.trigger === "taggedRelease") {
@@ -66,9 +66,9 @@ var createCustomTestJobs = function (context) {
66
66
  throw new Error("deploy config is not custom");
67
67
  }
68
68
  var base = {
69
- variables: __assign(__assign({
69
+ variables: __assign({
70
70
  APP_PATH: context.build.dir
71
- }, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
71
+ }, context.environment.jobOnlyVars.build.envVars),
72
72
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
73
73
  services: buildConfig.jobServices,
74
74
  cache: (0, createJobCache_1.createJobCacheFromConfig)(context, buildConfig),
@@ -79,23 +79,23 @@ var createCustomTestJobs = function (context) {
79
79
  var auditJob = buildConfig.audit ? __assign(__assign(__assign({
80
80
  name: "๐Ÿ›ก audit"
81
81
  }, base), {
82
- image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage,
82
+ image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage,
83
83
  cache: undefined,
84
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)), false),
84
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)), false),
85
85
  allow_failure: true
86
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifactsReports, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifacts)) : null;
86
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.artifactsReports, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifacts)) : null;
87
87
  var lintJob = buildConfig.lint ? __assign(__assign(__assign({
88
88
  name: "๐Ÿ‘ฎ lint"
89
89
  }, base), {
90
- image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage,
91
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)), false)
92
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifactsReports, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifacts)) : null;
90
+ image: (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage,
91
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.command)), false)
92
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifacts)) : null;
93
93
  var testJob = buildConfig.test ? __assign(__assign(__assign({
94
94
  name: "๐Ÿงช test"
95
95
  }, base), {
96
- image: (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage,
97
- script: __spreadArray([], __read((0, utils_1.ensureArray)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)), false)
98
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifactsReports, (_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.artifacts)) : null;
96
+ image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage,
97
+ script: __spreadArray([], __read((0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)), false)
98
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.artifactsReports, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifacts)) : null;
99
99
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
100
100
  };
101
101
  exports.createCustomTestJobs = createCustomTestJobs;
@@ -4,7 +4,7 @@ import type { CatladderJob } from "../types/jobs";
4
4
  export declare const getDockerImageVariables: (context: ComponentContext) => {
5
5
  DOCKER_IMAGE_TAG: string;
6
6
  DOCKER_REGISTRY: string;
7
- DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
7
+ DOCKER_IMAGE: import("..").StringOrBashExpression;
8
8
  DOCKER_CACHE_IMAGE: string;
9
9
  } | {
10
10
  DOCKER_IMAGE_TAG: string;
@@ -20,7 +20,7 @@ export declare const requiresDockerBuild: (context: ComponentContext) => boolean
20
20
  export declare const getDockerBuildVariables: (context: ComponentContext) => {
21
21
  DOCKER_IMAGE_TAG: string;
22
22
  DOCKER_REGISTRY: string;
23
- DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
23
+ DOCKER_IMAGE: import("..").StringOrBashExpression;
24
24
  DOCKER_CACHE_IMAGE: string;
25
25
  APP_DIR: string;
26
26
  DOCKER_BUILD_CONTEXT: string;
@@ -39,7 +39,7 @@ export declare const getDockerBuildVariables: (context: ComponentContext) => {
39
39
  } | {
40
40
  DOCKER_IMAGE_TAG: string;
41
41
  DOCKER_REGISTRY: string;
42
- DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
42
+ DOCKER_IMAGE: import("..").StringOrBashExpression;
43
43
  DOCKER_CACHE_IMAGE: string;
44
44
  APP_DIR: string;
45
45
  DOCKER_BUILD_CONTEXT: string;
@@ -58,7 +58,7 @@ var createNodeBuildJobDefinition = function (context) {
58
58
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
59
59
  return (0, createBuildJobDefinition_1.createBuildJobDefinition)(context, buildConfig, {
60
60
  prescript: yarnInstall,
61
- cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false)
61
+ cache: (0, cache_1.getNodeCache)(context)
62
62
  });
63
63
  };
64
64
  exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
@@ -1,7 +1,5 @@
1
- import type { Context, WorkspaceContext } from "../../types/context";
1
+ import type { Context } from "../../types/context";
2
2
  import type { CacheConfig } from "../types";
3
3
  export declare const getYarnCache: (context: Context, policy?: string) => CacheConfig[];
4
4
  export declare const getNodeModulesCache: (context: Context, policy?: string) => CacheConfig[];
5
- export declare const getNodeCache: (context: Context, policy?: string) => CacheConfig[];
6
- export declare const getNextCache: (context: Context) => CacheConfig[];
7
- export declare const getWorkspaceDefaultCaches: (context: WorkspaceContext) => CacheConfig[];
5
+ export declare const getNodeCache: (context: Context, policy?: string) => CacheConfig[];
@@ -39,7 +39,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
39
39
  Object.defineProperty(exports, "__esModule", {
40
40
  value: true
41
41
  });
42
- exports.getWorkspaceDefaultCaches = exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
42
+ exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
43
43
  var lodash_1 = require("lodash");
44
44
  var path_1 = require("path");
45
45
  var slugify_1 = __importDefault(require("slugify"));
@@ -82,27 +82,6 @@ var getNodeCache = function (context, policy) {
82
82
  if (policy === void 0) {
83
83
  policy = "pull-push";
84
84
  }
85
- return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false), __read(context.type === "workspace" ? (0, exports.getWorkspaceDefaultCaches)(context) : []), false);
85
+ return __spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false);
86
86
  };
87
- exports.getNodeCache = getNodeCache;
88
- var getNextCache = function (context) {
89
- var paths = context.build.getComponentDirs("direct").map(function (c) {
90
- return (0, path_1.join)(c, ".next/cache");
91
- });
92
- return [{
93
- pathMode: "absolute",
94
- key: "next-cache",
95
- policy: "pull-push",
96
- paths: paths
97
- }];
98
- };
99
- exports.getNextCache = getNextCache;
100
- var getWorkspaceDefaultCaches = function (context) {
101
- return [{
102
- // turbo repo
103
- key: "turbo",
104
- policy: "pull-push",
105
- paths: [".turbo"]
106
- }];
107
- };
108
- exports.getWorkspaceDefaultCaches = getWorkspaceDefaultCaches;
87
+ exports.getNodeCache = getNodeCache;
@@ -54,7 +54,7 @@ var constants_1 = require("./constants");
54
54
  var yarn_1 = require("./yarn");
55
55
  var createJobCache_1 = require("../cache/createJobCache");
56
56
  var createNodeTestJobs = function (context) {
57
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
57
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
58
58
  // don't run tests after release
59
59
  // TODO: this will be replaced by using rules
60
60
  if (context.trigger === "taggedRelease") {
@@ -68,7 +68,7 @@ var createNodeTestJobs = function (context) {
68
68
  var base = {
69
69
  variables: __assign({
70
70
  APP_PATH: context.build.dir
71
- }, context.type === "component" ? __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {}) : {}),
71
+ }, context.type === "component" ? __assign({}, context.environment.jobOnlyVars.build.envVars) : {}),
72
72
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
73
73
  stage: "test",
74
74
  needs: [],
@@ -79,26 +79,26 @@ var createNodeTestJobs = function (context) {
79
79
  var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
80
80
  name: "๐Ÿ›ก audit"
81
81
  }, base), {
82
- image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
82
+ image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage,
83
83
  cache: undefined,
84
- script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
84
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [context.packageManagerInfo.isClassic ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
85
85
  ]), false),
86
86
  allow_failure: true
87
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
87
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifactsReports, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifacts)) : null;
88
88
  var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
89
89
  name: "๐Ÿ‘ฎ lint"
90
90
  }, base), {
91
- image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
91
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
92
92
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
93
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]), false)
94
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
93
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["yarn lint"]), false)
94
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifactsReports, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifacts)) : null;
95
95
  var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
96
96
  name: "๐Ÿงช test"
97
97
  }, base), {
98
- image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
98
+ image: (_p = (_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
99
99
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
100
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]), false)
101
- }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
100
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn test"]), false)
101
+ }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.artifactsReports, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifacts)) : null;
102
102
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
103
103
  };
104
104
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -79,7 +79,7 @@ var createRailsBuildJobs = function (context) {
79
79
  return (0, base_1.createComponentBuildJobs)(context, {
80
80
  appBuild: undefined,
81
81
  dockerBuild: {
82
- variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
82
+ variables: __assign({}, context.environment.jobOnlyVars.build.envVars),
83
83
  // custom script
84
84
  script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["cd ".concat(context.build.dir), "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
85
85
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
@@ -48,7 +48,7 @@ exports.createRailsTestJobs = void 0;
48
48
  var __1 = require("../..");
49
49
  var utils_1 = require("../../utils");
50
50
  var createRailsTestJobs = function (context) {
51
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
52
52
  // don't run tests after release
53
53
  // TODO: this will be replaced by using rules
54
54
  if (context.trigger === "taggedRelease") {
@@ -60,7 +60,7 @@ var createRailsTestJobs = function (context) {
60
60
  }
61
61
  var buildConfig = context.build.config;
62
62
  var base = {
63
- variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
63
+ variables: __assign({}, context.environment.jobOnlyVars.build.envVars),
64
64
  stage: "test",
65
65
  needs: [],
66
66
  envMode: "none"
@@ -80,23 +80,23 @@ var createRailsTestJobs = function (context) {
80
80
  name: "๐Ÿ›ก audit"
81
81
  }, base), {
82
82
  cache: undefined,
83
- image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
84
- script: __spreadArray(["cd ".concat(context.build.dir)], __read((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
83
+ image: (_c = (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
84
+ script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : ["gem install bundler-audit", "bundle audit check"]), false),
85
85
  allow_failure: true
86
86
  }) : null;
87
87
  var lintJob = buildConfig.lint !== false ? __assign(__assign({
88
88
  name: "๐Ÿ‘ฎ lint"
89
89
  }, base), {
90
90
  cache: bundlerCache,
91
- image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
92
- script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["bundle exec rubocop"]), false)
91
+ image: (_h = (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
92
+ script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["bundle exec rubocop"]), false)
93
93
  }) : null;
94
94
  var testJob = buildConfig.test !== false ? __assign(__assign({
95
95
  name: "๐Ÿงช test"
96
96
  }, base), {
97
97
  cache: bundlerCache,
98
- image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
99
- script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["bundle exec rspec"]), false)
98
+ image: (_o = (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage) !== null && _o !== void 0 ? _o : defaultImage,
99
+ script: __spreadArray(__spreadArray(["cd ".concat(context.build.dir)], __read(bundlerInstall), false), __read((_q = (0, utils_1.ensureArrayOrNull)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)) !== null && _q !== void 0 ? _q : ["bundle exec rspec"]), false)
100
100
  }) : null;
101
101
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
102
102
  };