@catladder/pipeline 0.0.0-refactor-untangle-gitlab-api-requests-from-vorpal-57cf3cf2 → 0.0.0-reference-database-url-1befbbee

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 (181) hide show
  1. package/dist/build/artifacts/createBuildJobArtifact.js +1 -1
  2. package/dist/build/base/index.d.ts +2 -3
  3. package/dist/build/cache/getAllCacheConfigsFromConfig.js +2 -2
  4. package/dist/build/custom/buildJob.d.ts +2 -2
  5. package/dist/build/custom/index.d.ts +2 -2
  6. package/dist/build/custom/testJob.d.ts +2 -2
  7. package/dist/build/docker.d.ts +4 -4
  8. package/dist/build/docker.js +1 -1
  9. package/dist/build/index.d.ts +2 -2
  10. package/dist/build/index.js +2 -3
  11. package/dist/build/node/buildJob.d.ts +5 -3
  12. package/dist/build/node/index.d.ts +4 -4
  13. package/dist/build/node/meteor.d.ts +2 -2
  14. package/dist/build/node/yarn.d.ts +1 -1
  15. package/dist/build/node/yarn.js +1 -1
  16. package/dist/build/rails/build.d.ts +2 -2
  17. package/dist/build/rails/build.js +1 -1
  18. package/dist/build/rails/index.d.ts +2 -2
  19. package/dist/build/rails/test.js +13 -2
  20. package/dist/build/sbom.d.ts +2 -2
  21. package/dist/build/sbom.js +4 -1
  22. package/dist/build/types.d.ts +8 -0
  23. package/dist/constants.js +1 -1
  24. package/dist/context/createComponentContext.js +11 -4
  25. package/dist/context/getLabels.js +1 -1
  26. package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +2 -2
  27. package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +34 -12
  28. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.d.ts +2 -3
  29. package/dist/deploy/cloudRun/createJobs/execute/onDeploy.js +4 -9
  30. package/dist/deploy/cloudRun/createJobs/healthCheck.d.ts +5 -0
  31. package/dist/deploy/cloudRun/createJobs/healthCheck.js +82 -0
  32. package/dist/deploy/cloudRun/index.js +7 -5
  33. package/dist/deploy/cloudRun/utils/database.d.ts +21 -2
  34. package/dist/deploy/cloudRun/utils/database.js +27 -6
  35. package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.d.ts +2 -0
  36. package/dist/deploy/cloudRun/utils/getJobOrServiceArgs.js +12 -0
  37. package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
  38. package/dist/deploy/kubernetes/kubeValues.js +1 -1
  39. package/dist/deploy/sbom.js +1 -1
  40. package/dist/deploy/types/googleCloudRun.d.ts +100 -0
  41. package/dist/deploy/types/googleCloudRun.js +25 -0
  42. package/dist/pipeline/createJobsForComponent.js +1 -1
  43. package/dist/tsconfig.tsbuildinfo +1 -1
  44. package/dist/types/config.d.ts +1 -1
  45. package/dist/types/context.d.ts +6 -1
  46. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +1394 -0
  47. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +1394 -0
  48. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +1394 -0
  49. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +20 -8
  50. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +624 -0
  51. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +20 -8
  52. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +24 -12
  53. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +20 -8
  54. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +20 -8
  55. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +20 -8
  56. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +20 -8
  57. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +20 -8
  58. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +20 -8
  59. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +20 -8
  60. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +20 -8
  61. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +20 -8
  62. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +20 -8
  63. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +20 -8
  64. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +1394 -0
  65. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +20 -8
  66. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +20 -8
  67. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +4515 -0
  68. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +40 -16
  69. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +20 -8
  70. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +20 -8
  71. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +20 -8
  72. package/examples/__snapshots__/custom-build-job.test.ts.snap +20 -8
  73. package/examples/__snapshots__/custom-deploy.test.ts.snap +20 -8
  74. package/examples/__snapshots__/custom-envs.test.ts.snap +24 -6
  75. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +4 -4
  76. package/examples/__snapshots__/custom-verify-job.test.ts.snap +20 -8
  77. package/examples/__snapshots__/git-submodule.test.ts.snap +20 -8
  78. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +20 -8
  79. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +20 -8
  80. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +40 -16
  81. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +20 -8
  82. package/examples/__snapshots__/local-dot-env.test.ts.snap +20 -8
  83. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +20 -8
  84. package/examples/__snapshots__/multiline-var.test.ts.snap +60 -24
  85. package/examples/__snapshots__/native-app.test.ts.snap +36 -12
  86. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +20 -8
  87. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +20 -8
  88. package/examples/__snapshots__/override-secrets.test.ts.snap +20 -8
  89. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +30 -17
  90. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +38 -29
  91. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +60 -24
  92. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +32 -8
  93. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +40 -16
  94. package/examples/__snapshots__/workspace-api-www.test.ts.snap +40 -16
  95. package/examples/cloud-run-health-check-defaults.test.ts +11 -0
  96. package/examples/cloud-run-health-check-defaults.ts +28 -0
  97. package/examples/cloud-run-health-check-only-startup.test.ts +11 -0
  98. package/examples/cloud-run-health-check-only-startup.ts +38 -0
  99. package/examples/cloud-run-health-check.test.ts +11 -0
  100. package/examples/cloud-run-health-check.ts +45 -0
  101. package/examples/cloud-run-http2.ts +2 -2
  102. package/examples/cloud-run-llama.test.ts +11 -0
  103. package/examples/cloud-run-llama.ts +40 -0
  104. package/examples/cloud-run-memory-limit.ts +2 -2
  105. package/examples/cloud-run-meteor-with-worker.ts +7 -3
  106. package/examples/cloud-run-nextjs.ts +2 -2
  107. package/examples/cloud-run-no-cpu-throttling.ts +2 -2
  108. package/examples/cloud-run-no-service.ts +2 -2
  109. package/examples/cloud-run-non-public.ts +2 -2
  110. package/examples/cloud-run-post-stop-job.ts +2 -2
  111. package/examples/cloud-run-service-custom-vpc-connector.ts +2 -2
  112. package/examples/cloud-run-service-custom-vpc.ts +2 -2
  113. package/examples/cloud-run-service-gen2.ts +2 -2
  114. package/examples/cloud-run-service-increase-timout.ts +2 -2
  115. package/examples/cloud-run-service-with-volumes.ts +2 -2
  116. package/examples/cloud-run-storybook.ts +2 -2
  117. package/examples/cloud-run-with-gpu.test.ts +11 -0
  118. package/examples/cloud-run-with-gpu.ts +30 -0
  119. package/examples/cloud-run-with-ngnix.ts +2 -2
  120. package/examples/cloud-run-with-sql-legacy-jobs.ts +2 -2
  121. package/examples/cloud-run-with-sql-multiple-dbs.test.ts +11 -0
  122. package/examples/cloud-run-with-sql-multiple-dbs.ts +87 -0
  123. package/examples/cloud-run-with-sql-reuse-db.ts +2 -2
  124. package/examples/cloud-run-with-sql.ts +2 -2
  125. package/examples/cloud-run-with-worker.ts +2 -2
  126. package/examples/custom-build-job-with-tests.ts +2 -2
  127. package/examples/custom-build-job.ts +2 -2
  128. package/examples/custom-deploy.ts +2 -2
  129. package/examples/custom-envs.ts +2 -2
  130. package/examples/custom-sbom-java.ts +2 -2
  131. package/examples/custom-verify-job.ts +2 -2
  132. package/examples/git-submodule.ts +2 -2
  133. package/examples/kubernetes-application-customization.ts +2 -2
  134. package/examples/kubernetes-with-cloud-sql.ts +2 -2
  135. package/examples/kubernetes-with-jobs.ts +2 -2
  136. package/examples/kubernetes-with-mongodb.ts +2 -2
  137. package/examples/local-dot-env.ts +2 -2
  138. package/examples/meteor-kubernetes.ts +2 -2
  139. package/examples/multiline-var.ts +2 -2
  140. package/examples/native-app.ts +2 -2
  141. package/examples/node-build-with-custom-image.ts +2 -2
  142. package/examples/node-build-with-docker-additions.ts +2 -2
  143. package/examples/override-secrets.ts +2 -2
  144. package/examples/rails-k8s-with-worker.ts +2 -2
  145. package/examples/referencing-other-vars.ts +2 -2
  146. package/examples/wait-for-other-deploy.ts +1 -1
  147. package/examples/workspace-api-www-turbo-cache.ts +2 -2
  148. package/examples/workspace-api-www.ts +2 -2
  149. package/package.json +1 -1
  150. package/src/build/artifacts/createBuildJobArtifact.ts +3 -1
  151. package/src/build/base/index.ts +5 -2
  152. package/src/build/cache/getAllCacheConfigsFromConfig.ts +7 -6
  153. package/src/build/custom/buildJob.ts +2 -2
  154. package/src/build/custom/index.ts +4 -2
  155. package/src/build/custom/testJob.ts +2 -2
  156. package/src/build/docker.ts +9 -5
  157. package/src/build/index.ts +7 -5
  158. package/src/build/node/buildJob.ts +5 -2
  159. package/src/build/node/index.ts +9 -4
  160. package/src/build/node/meteor.ts +5 -2
  161. package/src/build/node/yarn.ts +4 -2
  162. package/src/build/rails/build.ts +3 -8
  163. package/src/build/rails/index.ts +4 -2
  164. package/src/build/rails/test.ts +19 -0
  165. package/src/build/sbom.ts +8 -3
  166. package/src/build/types.ts +8 -0
  167. package/src/context/createComponentContext.ts +22 -9
  168. package/src/context/getLabels.ts +4 -1
  169. package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +2 -2
  170. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +30 -3
  171. package/src/deploy/cloudRun/createJobs/execute/onDeploy.ts +3 -13
  172. package/src/deploy/cloudRun/createJobs/healthCheck.ts +64 -0
  173. package/src/deploy/cloudRun/index.ts +14 -5
  174. package/src/deploy/cloudRun/utils/database.ts +93 -8
  175. package/src/deploy/cloudRun/utils/getJobOrServiceArgs.ts +18 -0
  176. package/src/deploy/kubernetes/kubeValues.ts +13 -4
  177. package/src/deploy/sbom.ts +4 -3
  178. package/src/deploy/types/googleCloudRun.ts +135 -0
  179. package/src/pipeline/createJobsForComponent.ts +10 -2
  180. package/src/types/config.ts +1 -1
  181. package/src/types/context.ts +10 -1
@@ -79,7 +79,7 @@ var createBuildJobArtifacts = function (context) {
79
79
  exports.createBuildJobArtifacts = createBuildJobArtifacts;
80
80
  var getArtifactsPathForComponent = function (c, additionalPaths) {
81
81
  var _a, _b;
82
- return (_b = __spreadArray(__spreadArray([], __read((_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : []), false), __read(additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : []), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
82
+ return (_b = __spreadArray(__spreadArray([], __read(c.build.type !== "disabled" ? (_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : [] : []), false), __read(additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : []), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
83
83
  return c.build
84
84
  // in theory, we only need "direct",
85
85
  // but in some cases project may have packages in the workspace that create build artifacts, which aren't components
@@ -1,8 +1,7 @@
1
- import type { WorkspaceContext } from "../../types/context";
2
- import { type ComponentContext } from "../../types/context";
1
+ import type { ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
3
2
  import type { AppBuildJobDefinition, DockerBuildJobDefinition } from "../../types/jobDefinition";
4
3
  import type { CatladderJob } from "../../types/jobs";
5
- export declare const createComponentBuildJobs: (context: ComponentContext, definitions: {
4
+ export declare const createComponentBuildJobs: (context: ComponentContextWithBuild, definitions: {
6
5
  appBuild?: AppBuildJobDefinition;
7
6
  dockerBuild: DockerBuildJobDefinition;
8
7
  }) => CatladderJob[];
@@ -54,11 +54,11 @@ var getAllCacheConfigsFromConfig = function (context, configWithCache) {
54
54
  // we would probably need to introduce a path to the right config property (build-->test or so)
55
55
  context.components.flatMap(function (componentContext) {
56
56
  var _a;
57
- return (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map(function (c) {
57
+ return componentContext.build.type !== "disabled" ? (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map(function (c) {
58
58
  return __assign(__assign({}, c), {
59
59
  baseDir: componentContext.build.dir
60
60
  });
61
- })) !== null && _a !== void 0 ? _a : [];
61
+ })) !== null && _a !== void 0 ? _a : [] : [];
62
62
  }) : []), false);
63
63
  };
64
64
  exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;
@@ -1,3 +1,3 @@
1
- import type { ComponentContext } from "../../types/context";
1
+ import type { ComponentContextWithBuild } from "../../types/context";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createCustomBuildJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createCustomBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -1,3 +1,3 @@
1
- import type { ComponentContext } from "../../types/context";
1
+ import type { ComponentContextWithBuild } from "../../types";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createCustomJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createCustomJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -1,7 +1,7 @@
1
1
  import type { Artifacts } from "../../types";
2
- import type { ComponentContext } from "../../types/context";
2
+ import type { ComponentContextWithBuild } from "../../types/context";
3
3
  import type { CatladderJob } from "../../types/jobs";
4
- export declare const createCustomTestJobs: (context: ComponentContext) => CatladderJob[];
4
+ export declare const createCustomTestJobs: (context: ComponentContextWithBuild) => CatladderJob[];
5
5
  export type OptionalArtifacts = {
6
6
  artifacts: Artifacts;
7
7
  } | undefined;
@@ -1,5 +1,5 @@
1
1
  import type { BuildConfigDocker } from ".";
2
- import type { ComponentContext, DockerBuildJobDefinition } from "../types";
2
+ import type { ComponentContext, ComponentContextWithBuild, DockerBuildJobDefinition } from "../types";
3
3
  import type { CatladderJob } from "../types/jobs";
4
4
  export declare const getDockerImageVariables: (context: ComponentContext) => {
5
5
  DOCKER_IMAGE_TAG: string;
@@ -17,7 +17,7 @@ export declare const getDockerImageVariables: (context: ComponentContext) => {
17
17
  * Weather the context requires a docker build
18
18
  */
19
19
  export declare const requiresDockerBuild: (context: ComponentContext) => boolean;
20
- export declare const getDockerBuildVariables: (context: ComponentContext) => {
20
+ export declare const getDockerBuildVariables: (context: ComponentContextWithBuild) => {
21
21
  DOCKER_IMAGE_TAG: string;
22
22
  DOCKER_REGISTRY: string;
23
23
  DOCKER_IMAGE: import("..").StringOrBashExpression;
@@ -58,12 +58,12 @@ export declare const getDockerBuildVariables: (context: ComponentContext) => {
58
58
  };
59
59
  export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
60
60
  export declare const getDockerJobBaseProps: () => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
61
- export declare const createDockerBuildJobBase: (context: ComponentContext, {
61
+ export declare const createDockerBuildJobBase: (context: ComponentContextWithBuild, {
62
62
  script,
63
63
  cache,
64
64
  ...def
65
65
  }: DockerBuildJobDefinition) => CatladderJob;
66
66
  export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
67
- export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContext, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
67
+ export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContextWithBuild, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
68
68
  export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
69
69
  export declare const hasDockerfile: (context: ComponentContext) => boolean;
@@ -104,7 +104,7 @@ exports.requiresDockerBuild = requiresDockerBuild;
104
104
  // those need to be runner variables
105
105
  var getDockerBuildRunnerVariables = function () {
106
106
  return {
107
- DOCKER_HOST: "tcp://0.0.0.0:2375",
107
+ DOCKER_HOST: "tcp://docker:2375",
108
108
  DOCKER_TLS_CERTDIR: "",
109
109
  DOCKER_DRIVER: "overlay2",
110
110
  DOCKER_BUILDKIT: "1" // see https://docs.docker.com/develop/develop-images/build_enhancements/
@@ -1,11 +1,11 @@
1
- import type { ComponentContext, WorkspaceContext } from "../types/context";
1
+ import type { ComponentContextWithBuild, WorkspaceContext } from "../types/context";
2
2
  import type { EnvironmentContext } from "../types/environmentContext";
3
3
  import type { CatladderJob } from "../types/jobs";
4
4
  import type { BuildConfig, BuildConfigStandaloneType, WorkspaceBuildConfig } from "./types";
5
5
  export * from "./node";
6
6
  export * from "./types";
7
7
  export type BuildTypes = { [type in BuildConfigStandaloneType]: {
8
- jobs: (context: ComponentContext) => CatladderJob[];
8
+ jobs: (context: ComponentContextWithBuild) => CatladderJob[];
9
9
  defaults: (envContext: EnvironmentContext) => Partial<Extract<BuildConfig, {
10
10
  type: type;
11
11
  }>>;
@@ -78,10 +78,9 @@ exports.BUILD_TYPES = {
78
78
  jobs: rails_1.createRailsJobs,
79
79
  defaults: function () {
80
80
  return {
81
- startCommand: "/cnb/process/web",
82
81
  cnbBuilder: {
83
- image: "heroku/builder:22",
84
- packVersion: "0.32.1"
82
+ image: "heroku/builder:24",
83
+ packVersion: "0.36.4"
85
84
  }
86
85
  };
87
86
  }
@@ -1,7 +1,9 @@
1
- import type { BuildContextStandalone, WorkspaceContext } from "../../types/context";
1
+ import type { BuildContextStandalone, ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
2
2
  import { type ComponentContext } from "../../types/context";
3
3
  import type { AppBuildJobDefinition, DockerBuildJobDefinition } from "../../types/jobDefinition";
4
4
  import type { CatladderJob } from "../../types/jobs";
5
- export declare const createNodeBuildJobs: (context: ComponentContext | WorkspaceContext) => CatladderJob[];
5
+ export declare const createNodeBuildJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[];
6
6
  export declare const createNodeBuildJobDefinition: (context: ComponentContext<BuildContextStandalone> | WorkspaceContext) => AppBuildJobDefinition | undefined;
7
- export declare const createNodeDockerJobDefinition: (context: ComponentContext) => DockerBuildJobDefinition;
7
+ type NewType = ComponentContextWithBuild;
8
+ export declare const createNodeDockerJobDefinition: (context: NewType) => DockerBuildJobDefinition;
9
+ export {};
@@ -1,5 +1,5 @@
1
- import type { ComponentContext, WorkspaceContext } from "../../types/context";
1
+ import type { ComponentContextWithBuild, WorkspaceContext } from "../../types/context";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createNodeJobs: (context: ComponentContext | WorkspaceContext) => CatladderJob[];
4
- export declare const createStorybookJobs: (context: ComponentContext) => CatladderJob[];
5
- export declare const createMeteorJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createNodeJobs: (context: ComponentContextWithBuild | WorkspaceContext) => CatladderJob[];
4
+ export declare const createStorybookJobs: (context: ComponentContextWithBuild) => CatladderJob[];
5
+ export declare const createMeteorJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -1,3 +1,3 @@
1
- import type { ComponentContext } from "../../types/context";
1
+ import type { ComponentContextWithBuild } from "../../types/context";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createMeteorBuildJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createMeteorBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -1,5 +1,5 @@
1
1
  import { BashExpression } from "../../bash/BashExpression";
2
- import type { Context } from "../../types";
2
+ import { type Context } from "../../types";
3
3
  export declare const ensureNodeVersion: (context: Context) => string[];
4
4
  export declare const getYarnInstall: (context: Context, options?: {
5
5
  noCustomPostInstall: boolean;
@@ -52,7 +52,7 @@ var ensureNodeVersion = function (context) {
52
52
  };
53
53
  exports.ensureNodeVersion = ensureNodeVersion;
54
54
  var getYarnInstall = function (context, options) {
55
- var postInstall = context.type !== "workspace" && "postInstall" in context.build.config ? context.build.config.postInstall : null;
55
+ var postInstall = context.type !== "workspace" && context.build.type !== "disabled" && "postInstall" in context.build.config ? context.build.config.postInstall : null;
56
56
  return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((0, utils_1.ensureArray)(postInstall)) : []), false);
57
57
  };
58
58
  exports.getYarnInstall = getYarnInstall;
@@ -1,3 +1,3 @@
1
- import { type ComponentContext } from "../..";
1
+ import type { ComponentContextWithBuild } from "../..";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createRailsBuildJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createRailsBuildJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -81,7 +81,7 @@ var createRailsBuildJobs = function (context) {
81
81
  dockerBuild: {
82
82
  variables: __assign({}, context.environment.jobOnlyVars.build.envVars),
83
83
  // custom script
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",
84
+ script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["cd ".concat(context.build.dir), "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
86
86
  "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
87
87
  }
@@ -1,3 +1,3 @@
1
- import type { ComponentContext } from "../../types";
1
+ import type { ComponentContextWithBuild } from "../../types";
2
2
  import type { CatladderJob } from "../../types/jobs";
3
- export declare const createRailsJobs: (context: ComponentContext) => CatladderJob[];
3
+ export declare const createRailsJobs: (context: ComponentContextWithBuild) => CatladderJob[];
@@ -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;
51
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
52
52
  // don't run tests after release
53
53
  // TODO: this will be replaced by using rules
54
54
  if (context.trigger === "taggedRelease") {
@@ -95,7 +95,18 @@ var createRailsTestJobs = function (context) {
95
95
  }, base), {
96
96
  cache: bundlerCache,
97
97
  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,
98
- 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)
98
+ 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 rake db:test:prepare", "bundle exec rake assets:precompile assets:clean", "bundle exec rspec"]), false),
99
+ runnerVariables: {
100
+ RAILS_ENV: "test",
101
+ DATABASE_URL: "postgresql://postgres@database"
102
+ },
103
+ services: [{
104
+ name: buildConfig.test && "databaseImage" in buildConfig.test ? (_s = (_r = buildConfig === null || buildConfig === void 0 ? void 0 : buildConfig.test) === null || _r === void 0 ? void 0 : _r.databaseImage) !== null && _s !== void 0 ? _s : "docker.io/postgres:latest" : "docker.io/postgres:latest",
105
+ alias: "database",
106
+ variables: {
107
+ POSTGRES_HOST_AUTH_METHOD: "trust"
108
+ }
109
+ }]
99
110
  }) : null;
100
111
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
101
112
  };
@@ -1,5 +1,5 @@
1
- import type { ComponentContext } from "../types/context";
1
+ import type { ComponentContextWithBuild } from "../types/context";
2
2
  import type { CatladderJob } from "../types/jobs";
3
3
  export declare const SBOM_BUILD_JOB_NAME = "\uD83E\uDDFE sbom";
4
4
  export declare const SBOM_FILE = "__sbom.json";
5
- export declare const createSbomBuildJob: (context: ComponentContext) => CatladderJob;
5
+ export declare const createSbomBuildJob: (context: ComponentContextWithBuild) => CatladderJob;
@@ -11,7 +11,10 @@ exports.SBOM_FILE = "__sbom.json";
11
11
  var createSbomBuildJob = function (context) {
12
12
  var _a, _b, _c, _d;
13
13
  var buildConfig = context.build.config;
14
- var defaultImage = "aquasec/trivy:0.38.3";
14
+ var defaultImage = {
15
+ name: "aquasec/trivy:0.58.2",
16
+ entrypoint: [""]
17
+ };
15
18
  var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(context.packageManagerInfo.componentIsInWorkspace ? "." : context.build.dir)];
16
19
  var image = (0, _1.isStandaloneBuildConfig)(buildConfig) && buildConfig.type === "custom" && buildConfig.sbom !== false ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage : defaultImage;
17
20
  var script = (0, _1.isStandaloneBuildConfig)(buildConfig) && buildConfig.type === "custom" && buildConfig.sbom !== false ? (_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript : defaultScript;
@@ -220,6 +220,14 @@ export type BuildConfigCustom = Omit<BuildConfigBase, "lint" | "test" | "audit">
220
220
  };
221
221
  export type BuildConfigRails = BuildConfigBase & {
222
222
  type: "rails";
223
+ test?: Pick<BuildConfigBase, "test"> & {
224
+ /**
225
+ * The container image to use as the database.
226
+ * Currently only supports PostgreSQL.
227
+ * Defaults to `docker.io/postgres:latest`
228
+ */
229
+ databaseImage?: string;
230
+ };
223
231
  /**
224
232
  * The [Cloud Native Buildpacks](https://buildpacks.io/) builder configuration.
225
233
  *
package/dist/constants.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
7
- exports.PIPELINE_IMAGE_TAG = "refactor-untangle-gitlab-api-requests-from-vorpal-57cf3cf2" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "reference-database-url-1befbbee" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -182,15 +182,15 @@ var createComponentContext = function (ctx) {
182
182
  packageManagerInfo = _b.sent();
183
183
  envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
184
184
  componentConfigWithoutDefaults = envContext.envConfigRaw;
185
- resolvedBuildType = (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build) ? componentConfigWithoutDefaults.build.type : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
186
- if (!resolvedBuildType) {
185
+ resolvedBuildType = componentConfigWithoutDefaults.build === false ? false : (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build) ? componentConfigWithoutDefaults.build.type : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
186
+ if (resolvedBuildType === undefined) {
187
187
  throw new Error("build type not found, is the build config correct?");
188
188
  }
189
189
  defaults = componentConfigWithoutDefaults.deploy ? {
190
- build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
190
+ build: resolvedBuildType && build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
191
191
  deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext)
192
192
  } : {
193
- build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
193
+ build: resolvedBuildType && build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
194
194
  deploy: {}
195
195
  };
196
196
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
@@ -204,6 +204,13 @@ var createComponentContext = function (ctx) {
204
204
  };
205
205
  _getBuildContext = function () {
206
206
  var _a;
207
+ if (build === false) {
208
+ return {
209
+ type: "disabled",
210
+ getComponentDirs: getComponentDirs,
211
+ dir: dir
212
+ };
213
+ }
207
214
  if ((0, build_1.isStandaloneBuildConfig)(build)) {
208
215
  return {
209
216
  dir: dir,
@@ -34,7 +34,7 @@ var getLabels = function (context) {
34
34
  "app-name": sanitize(context.fullConfig.appName),
35
35
  "env-type": sanitize(context.environment.envType),
36
36
  "env-name": sanitize(context.env),
37
- "build-type": sanitize(context.build.buildType)
37
+ "build-type": context.build.type === "disabled" ? "disabled" : sanitize(context.build.buildType)
38
38
  }, (_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {});
39
39
  return labels;
40
40
  };
@@ -60,7 +60,7 @@ var jobName_1 = require("../utils/jobName");
60
60
  var common_1 = require("./common");
61
61
  var constants_1 = require("./constants");
62
62
  var volumes_1 = require("./volumes");
63
- var onDeploy_1 = require("./execute/onDeploy");
63
+ var getJobOrServiceArgs_1 = require("../utils/getJobOrServiceArgs");
64
64
  var getDeleteJobsScripts = function (context) {
65
65
  var commonArgs = (0, common_1.getCommonCloudRunArgs)(context);
66
66
  var commonArgsString = (0, createArgsString_1.createArgsString)(commonArgs);
@@ -86,7 +86,7 @@ var getJobCreateScripts = function (context) {
86
86
  deployArgs = __rest(_g, ["image", "project", "region"]);
87
87
  var commonDeployArgsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
88
88
  command: "\"".concat(commandArray.join(","), "\""),
89
- args: (0, onDeploy_1.getCloudRunJobArgsArg)(job.args),
89
+ args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(job.args),
90
90
  labels: "\"".concat((0, common_1.makeLabelString)((0, getLabels_1.getLabels)(context)), ",cloud-run-job-name=$current_job_name\""),
91
91
  image: "\"".concat((_b = job.image) !== null && _b !== void 0 ? _b : commonImage, "\""),
92
92
  project: project,
@@ -47,28 +47,32 @@ Object.defineProperty(exports, "__esModule", {
47
47
  exports.getServiceDeleteScript = exports.getServiceDeployScript = void 0;
48
48
  var getLabels_1 = require("../../../context/getLabels");
49
49
  var createArgsString_1 = require("../utils/createArgsString");
50
+ var getJobOrServiceArgs_1 = require("../utils/getJobOrServiceArgs");
50
51
  var getServiceName_1 = require("../utils/getServiceName");
51
52
  var common_1 = require("./common");
52
53
  var constants_1 = require("./constants");
54
+ var healthCheck_1 = require("./healthCheck");
53
55
  var volumes_1 = require("./volumes");
54
56
  var getServiceDeployScript = function (context, service, nameSuffix) {
55
- var _a, _b, _c, _d, _e;
57
+ var _a, _b, _c, _d, _e, _f;
56
58
  var commonDeployArgs = (0, common_1.getCommonDeployArgs)(context);
57
59
  var serviceName = (0, getServiceName_1.getServiceName)(context);
58
60
  var customConfig = service !== true ? service : undefined;
59
- var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand : undefined;
61
+ var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.type !== "disabled" ? context.build.config.startCommand : undefined : undefined;
60
62
  var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
61
63
  var fullServiceName = serviceName.concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
62
- var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign({
64
+ var argsString = createArgsString_1.createArgsString.apply(void 0, __spreadArray([__assign(__assign(__assign({
63
65
  // command as empty string resets it to default (uses the image's entrypoint)
64
- command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
66
+ command: commandArray ? '"' + commandArray.join(",") + '"' : '""',
67
+ args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.args)
65
68
  }, commonDeployArgs), {
69
+ image: (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.image) !== null && _b !== void 0 ? _b : commonDeployArgs.image,
66
70
  labels: (0, common_1.makeLabelString)(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
67
71
  "cloud-run-service-name": fullServiceName
68
72
  })),
69
73
  "env-vars-file": constants_1.ENV_VARS_FILENAME,
70
- "min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
71
- "max-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _c !== void 0 ? _c : 100,
74
+ "min-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _c !== void 0 ? _c : 0,
75
+ "max-instances": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _d !== void 0 ? _d : 100,
72
76
  "cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
73
77
  cpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.cpu,
74
78
  memory: customConfig === null || customConfig === void 0 ? void 0 : customConfig.memory,
@@ -78,12 +82,15 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
78
82
  network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
79
83
  subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
80
84
  "use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
81
- "allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
82
- ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
85
+ "allow-unauthenticated": (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _e !== void 0 ? _e : true,
86
+ ingress: (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _f !== void 0 ? _f : "all",
83
87
  "cpu-boost": true,
84
- "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment
85
- })], __read((0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service")), false));
86
- return "".concat((0, common_1.gcloudRunCmd)(), " deploy ").concat(fullServiceName, " ").concat(argsString);
88
+ "execution-environment": customConfig === null || customConfig === void 0 ? void 0 : customConfig.executionEnvironment,
89
+ gpu: customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpu,
90
+ "gpu-type": customConfig === null || customConfig === void 0 ? void 0 : customConfig.gpuType
91
+ }), (0, healthCheck_1.healthCheckCliArgs)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.healthCheck))], __read((0, volumes_1.createVolumeConfig)(customConfig === null || customConfig === void 0 ? void 0 : customConfig.volumes, "service")), false));
92
+ var version = requiresBeta(customConfig) ? "beta" : undefined;
93
+ return "".concat((0, common_1.gcloudRunCmd)(version), " deploy ").concat(fullServiceName, " ").concat(argsString);
87
94
  };
88
95
  exports.getServiceDeployScript = getServiceDeployScript;
89
96
  var getServiceDeleteScript = function (context, serviceSuffix) {
@@ -93,4 +100,19 @@ var getServiceDeleteScript = function (context, serviceSuffix) {
93
100
  var fullServiceName = serviceSuffix ? "".concat(serviceName, "-").concat(serviceSuffix) : serviceName;
94
101
  return ["".concat((0, common_1.gcloudRunCmd)(), " services delete ").concat(fullServiceName, " ").concat(commonArgsString)];
95
102
  };
96
- exports.getServiceDeleteScript = getServiceDeleteScript;
103
+ exports.getServiceDeleteScript = getServiceDeleteScript;
104
+ var requiresBeta = function (config) {
105
+ if (!config) {
106
+ return false;
107
+ }
108
+ if (config.gpuType) {
109
+ return true;
110
+ }
111
+ if (config.gpu && config.gpu > 0) {
112
+ return true;
113
+ }
114
+ if (config.healthCheck !== undefined) {
115
+ return true;
116
+ }
117
+ return false;
118
+ };
@@ -1,4 +1,3 @@
1
1
  import type { ComponentContext } from "../../../../types/context";
2
- import type { DeployConfigCloudRunExecuteOnDeploy, DeployConfigCloudRunJob } from "../../../types/googleCloudRun";
3
- export declare const getOnDeployExecuteScript: (context: ComponentContext, when: DeployConfigCloudRunExecuteOnDeploy["when"]) => string[];
4
- export declare const getCloudRunJobArgsArg: (args: DeployConfigCloudRunExecuteOnDeploy["args"] | DeployConfigCloudRunJob["args"]) => string | undefined;
2
+ import type { DeployConfigCloudRunExecuteOnDeploy } from "../../../types/googleCloudRun";
3
+ export declare const getOnDeployExecuteScript: (context: ComponentContext, when: DeployConfigCloudRunExecuteOnDeploy["when"]) => string[];
@@ -44,8 +44,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
44
44
  Object.defineProperty(exports, "__esModule", {
45
45
  value: true
46
46
  });
47
- exports.getCloudRunJobArgsArg = exports.getOnDeployExecuteScript = void 0;
47
+ exports.getOnDeployExecuteScript = void 0;
48
48
  var createArgsString_1 = require("../../utils/createArgsString");
49
+ var getJobOrServiceArgs_1 = require("../../utils/getJobOrServiceArgs");
49
50
  var jobName_1 = require("../../utils/jobName");
50
51
  var cloudRunJobs_1 = require("../cloudRunJobs");
51
52
  var common_1 = require("../common");
@@ -107,14 +108,8 @@ var getJobRunScriptForExecute = function (context, _a) {
107
108
  : false;
108
109
  var argString = (0, createArgsString_1.createArgsString)(__assign(__assign({}, commonArgs), {
109
110
  wait: waitForCompletion === true ? true : undefined,
110
- args: (0, exports.getCloudRunJobArgsArg)(config.args)
111
+ args: (0, getJobOrServiceArgs_1.getCloudRunServiceOrJobArgsArg)(config.args)
111
112
  }));
112
113
  var fullJobName = (0, jobName_1.getFullJobName)(context, jobName);
113
114
  return "".concat((0, common_1.gcloudRunCmd)(), " jobs execute ").concat(fullJobName.toString(), " ").concat(argString);
114
- };
115
- var getCloudRunJobArgsArg = function (args) {
116
- return args !== undefined ? args.length > 0 ? args === null || args === void 0 ? void 0 : args.map(function (arg) {
117
- return "\"".concat(arg, "\"");
118
- }).join(",") : "" : undefined;
119
- };
120
- exports.getCloudRunJobArgsArg = getCloudRunJobArgsArg;
115
+ };
@@ -0,0 +1,5 @@
1
+ import { type DeployConfigCloudRunService } from "../../types";
2
+ export declare function healthCheckCliArgs(healthCheck: DeployConfigCloudRunService["healthCheck"]): {
3
+ "startup-probe": string;
4
+ "liveness-probe": string;
5
+ } | undefined;
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ var __read = this && this.__read || function (o, n) {
4
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
5
+ if (!m) return o;
6
+ var i = m.call(o),
7
+ r,
8
+ ar = [],
9
+ e;
10
+ try {
11
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
12
+ } catch (error) {
13
+ e = {
14
+ error: error
15
+ };
16
+ } finally {
17
+ try {
18
+ if (r && !r.done && (m = i["return"])) m.call(i);
19
+ } finally {
20
+ if (e) throw e.error;
21
+ }
22
+ }
23
+ return ar;
24
+ };
25
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
26
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
27
+ if (ar || !(i in from)) {
28
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
29
+ ar[i] = from[i];
30
+ }
31
+ }
32
+ return to.concat(ar || Array.prototype.slice.call(from));
33
+ };
34
+ Object.defineProperty(exports, "__esModule", {
35
+ value: true
36
+ });
37
+ exports.healthCheckCliArgs = void 0;
38
+ var types_1 = require("../../types");
39
+ var PORT = 8080;
40
+ function healthCheckCliArgs(healthCheck) {
41
+ var shouldNotSetHealthCheck = healthCheck === undefined;
42
+ if (shouldNotSetHealthCheck) {
43
+ return undefined;
44
+ }
45
+ var shouldUseDefaultProbe = healthCheck === true;
46
+ if (shouldUseDefaultProbe) {
47
+ return {
48
+ "startup-probe": toArgValue(probeToKeyValuePairs(types_1.defaultStartupProbe)),
49
+ "liveness-probe": toArgValue(probeToKeyValuePairs(types_1.defaultLivenessProbe))
50
+ };
51
+ }
52
+ return {
53
+ "startup-probe": toArgValue(probeToKeyValuePairs(healthCheck.startupProbe)),
54
+ "liveness-probe": healthCheck.livenessProbe ? toArgValue(probeToKeyValuePairs(healthCheck.livenessProbe)) : "" // NOTE: empty string ("") removes liveness probe
55
+ };
56
+ }
57
+ exports.healthCheckCliArgs = healthCheckCliArgs;
58
+ function probeToKeyValuePairs(probe) {
59
+ var sharedArgs = Object.entries({
60
+ initialDelaySeconds: probe.initialDelaySeconds,
61
+ timeoutSeconds: probe.timeoutSeconds,
62
+ periodSeconds: probe.periodSeconds,
63
+ failureThreshold: probe.failureThreshold
64
+ });
65
+ switch (probe.type) {
66
+ case "tcp":
67
+ return __spreadArray(__spreadArray([], __read(sharedArgs), false), [["tcpSocket.port", PORT]], false);
68
+ case "http1":
69
+ return __spreadArray(__spreadArray([], __read(sharedArgs), false), [["httpGet.port", PORT], ["httpGet.path", probe.path]], false);
70
+ default:
71
+ probe;
72
+ return [];
73
+ }
74
+ }
75
+ function toArgValue(keyValues) {
76
+ return keyValues.map(function (_a) {
77
+ var _b = __read(_a, 2),
78
+ key = _b[0],
79
+ value = _b[1];
80
+ return "".concat(key, "=").concat(value);
81
+ }).join(",");
82
+ }
@@ -56,7 +56,7 @@ exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
56
56
  // FIXME: rename to internalHostSuffix, but this means that project-setup needs to be rerun, so its kindof a breaking change
57
57
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
58
58
  var getCloudSqlVariables = function (_a) {
59
- var _b, _c;
59
+ var _b, _c, _d;
60
60
  var deployConfigRaw = _a.deployConfigRaw,
61
61
  environmentSlugPrefix = _a.environmentSlugPrefix,
62
62
  env = _a.env,
@@ -70,14 +70,16 @@ var getCloudSqlVariables = function (_a) {
70
70
  value = _b[1];
71
71
  return "&".concat(key, "=").concat(value);
72
72
  }).join("");
73
- return {
73
+ var dbVars = {
74
74
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
75
75
  DB_NAME: DB_NAME,
76
76
  DB_USER: (_c = deployConfigRaw.cloudSql.dbUser) !== null && _c !== void 0 ? _c : "postgres",
77
- DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
78
- DATABASE_URL: "".concat((0, database_1.getDatabaseConnectionString)(deployConfigRaw.cloudSql)).concat(additionalQueryParamsString),
79
- DATABASE_JDBC_URL: database_1.DATABASE_JDBC_URL
77
+ DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD")
80
78
  };
79
+ return __assign(__assign({}, dbVars), {
80
+ DATABASE_URL: (0, database_1.getDatabaseConnectionString)(deployConfigRaw.cloudSql, dbVars).concat(additionalQueryParamsString),
81
+ DATABASE_JDBC_URL: (0, database_1.getDatabaseJdbcUrl)(dbVars, (_d = deployConfigRaw.cloudSql.dbConnectionStringVariablesMode) !== null && _d !== void 0 ? _d : database_1.DEFAULT_DB_VARIABLES_MODE)
82
+ });
81
83
  }
82
84
  return {};
83
85
  };