@catladder/pipeline 0.0.0-refactor-docker-de6b3576 → 0.0.0-refactor-docker-9fda97e9

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 (85) hide show
  1. package/dist/bundles/catladder-gitlab/index.js +8 -4
  2. package/dist/constants.js +1 -1
  3. package/dist/context/getEnvironmentVariables.js +2 -1
  4. package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +2 -1
  5. package/dist/deploy/kubernetes/kubeValues.js +3 -1
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/types/config.d.ts +1 -1
  8. package/dist/types/jobs.d.ts +1 -1
  9. package/examples/__utils__/helpers.ts +2 -2
  10. package/package.json +1 -1
  11. package/scripts/generate-gitlab-ci-types.ts +2 -2
  12. package/src/bash/BashExpression.ts +4 -4
  13. package/src/bash/bashExpressionPerPipelineType.ts +1 -1
  14. package/src/bash/replaceAsync.ts +4 -4
  15. package/src/build/base/__tests__/createArtifactsConfig.test.ts +3 -3
  16. package/src/build/base/createArtifactsConfig.ts +2 -2
  17. package/src/build/base/writeDotEnv.ts +1 -1
  18. package/src/build/custom/__tests__/testJob.test.ts +1 -1
  19. package/src/build/custom/testJob.ts +3 -3
  20. package/src/build/index.ts +1 -1
  21. package/src/build/node/cache.ts +4 -4
  22. package/src/build/node/testJob.ts +3 -3
  23. package/src/build/node/yarn.ts +7 -7
  24. package/src/config/configruedEnvs.ts +6 -6
  25. package/src/config/readConfig.ts +2 -2
  26. package/src/context/__tests__/resolveReferences.test.ts +1 -1
  27. package/src/context/getBuildInfoVariables.ts +5 -5
  28. package/src/context/getEnvConfig.ts +1 -1
  29. package/src/context/getEnvType.ts +1 -1
  30. package/src/context/getEnvironment.ts +1 -1
  31. package/src/context/getEnvironmentContext.ts +2 -2
  32. package/src/context/getEnvironmentVariables.ts +12 -12
  33. package/src/context/getReviewSlug.ts +2 -2
  34. package/src/context/index.ts +3 -3
  35. package/src/context/resolveReferences.ts +9 -12
  36. package/src/context/transformJobOnlyVars.ts +1 -1
  37. package/src/context/utils/envVars.ts +3 -3
  38. package/src/deploy/base/deploy.ts +5 -5
  39. package/src/deploy/base/index.ts +1 -1
  40. package/src/deploy/base/rollback.ts +1 -1
  41. package/src/deploy/base/stop.ts +1 -1
  42. package/src/deploy/cloudRun/artifactsRegistry.ts +5 -5
  43. package/src/deploy/cloudRun/cleanup.ts +3 -3
  44. package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -3
  45. package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +10 -10
  46. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +4 -4
  47. package/src/deploy/cloudRun/createJobs/common.ts +1 -1
  48. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +7 -7
  49. package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +1 -1
  50. package/src/deploy/cloudRun/createJobs/index.ts +1 -1
  51. package/src/deploy/cloudRun/createJobs/volumes.ts +2 -2
  52. package/src/deploy/cloudRun/index.ts +6 -10
  53. package/src/deploy/cloudRun/utils/createArgsString.ts +1 -1
  54. package/src/deploy/cloudRun/utils/database.ts +5 -5
  55. package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +1 -1
  56. package/src/deploy/cloudRun/utils/jobName.ts +1 -1
  57. package/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.ts +1 -1
  58. package/src/deploy/cloudSql/utils.ts +2 -2
  59. package/src/deploy/index.ts +3 -3
  60. package/src/deploy/kubernetes/cloudSql/index.ts +3 -3
  61. package/src/deploy/kubernetes/deployJob.ts +6 -6
  62. package/src/deploy/kubernetes/index.ts +1 -1
  63. package/src/deploy/kubernetes/kubeEnv.ts +1 -1
  64. package/src/deploy/kubernetes/kubeValues.ts +5 -5
  65. package/src/deploy/kubernetes/mongodb.ts +1 -1
  66. package/src/deploy/kubernetes/processSecretsAsFiles.ts +3 -3
  67. package/src/deploy/utils.ts +2 -2
  68. package/src/pipeline/createAllJobs.ts +4 -4
  69. package/src/pipeline/createChildPipeline.ts +2 -2
  70. package/src/pipeline/createJobsForComponent.ts +3 -3
  71. package/src/pipeline/createMainPipeline.ts +17 -20
  72. package/src/pipeline/generatePipelineFiles.ts +3 -3
  73. package/src/pipeline/getPipelineStages.ts +1 -1
  74. package/src/pipeline/gitlab/createGitlabJobs.ts +24 -24
  75. package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +6 -6
  76. package/src/pipeline/packageManager.ts +2 -2
  77. package/src/pipeline/yarn/yarnUtils.ts +7 -7
  78. package/src/types/config.ts +2 -2
  79. package/src/types/context.ts +1 -1
  80. package/src/types/environmentContext.ts +1 -1
  81. package/src/types/jobs.ts +1 -1
  82. package/src/types/utils.ts +4 -4
  83. package/src/utils/gitlab.ts +1 -1
  84. package/src/utils/index.ts +2 -2
  85. package/src/utils/writeFiles.ts +2 -2
@@ -25,7 +25,7 @@ export type DeployJobDefinition = Pick<
25
25
  >;
26
26
  export const createDeployJob = (
27
27
  context: Context,
28
- jobDefinition: DeployJobDefinition,
28
+ jobDefinition: DeployJobDefinition
29
29
  ): CatladderJob => {
30
30
  const hasDocker = requiresDockerBuild(context);
31
31
  const isStoppable = contextIsStoppable(context);
@@ -34,8 +34,8 @@ export const createDeployJob = (
34
34
  context.environment.envType === "review"
35
35
  ? "1 week"
36
36
  : context.environment.envType === "dev"
37
- ? "4 weeks"
38
- : undefined;
37
+ ? "4 weeks"
38
+ : undefined;
39
39
 
40
40
  // if auto or manual is configured explicitly, use that
41
41
  const whenDeployDefined =
@@ -47,8 +47,8 @@ export const createDeployJob = (
47
47
  context.environment.envType !== "prod"
48
48
  ? "auto" // is not stage, auto deploy
49
49
  : context.componentConfig.env?.stage === false
50
- ? "auto" // is prod, but no staging, auto deploy
51
- : "manual"; // manually deploy
50
+ ? "auto" // is prod, but no staging, auto deploy
51
+ : "manual"; // manually deploy
52
52
  const whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
53
53
 
54
54
  return {
@@ -10,7 +10,7 @@ export const createDeployementJobs = (
10
10
  deploy: DeployJobDefinition;
11
11
  stop?: StopJobDefinition;
12
12
  rollback?: RollbackJobDefinition;
13
- },
13
+ }
14
14
  ): CatladderJob[] => {
15
15
  return [
16
16
  createDeployJob(context, definitions.deploy),
@@ -10,7 +10,7 @@ export type RollbackJobDefinition = Pick<
10
10
  >;
11
11
  export const createRollbackJob = (
12
12
  context: Context,
13
- jobDefinition: RollbackJobDefinition,
13
+ jobDefinition: RollbackJobDefinition
14
14
  ): CatladderJob => {
15
15
  return {
16
16
  name: ROLLBACK_JOB_NAME,
@@ -10,7 +10,7 @@ export type StopJobDefinition = Pick<
10
10
  >;
11
11
  export const createStopJob = (
12
12
  context: Context,
13
- jobDefinition: StopJobDefinition,
13
+ jobDefinition: StopJobDefinition
14
14
  ): CatladderJob => {
15
15
  return {
16
16
  name: STOP_JOB_NAME,
@@ -36,7 +36,7 @@ export const getArtifactsRegistryDockerUrl = (context: Context) => {
36
36
  */
37
37
  export const getArtifactsRegistryImageName = (
38
38
  context: Context,
39
- lecacyReviewImageName = false,
39
+ lecacyReviewImageName = false
40
40
  ) => {
41
41
  if (lecacyReviewImageName && context.environment.envType !== "review") {
42
42
  throw new Error("lecacyReviewImageName is only allowed for review app");
@@ -67,7 +67,7 @@ export const getArtifactsRegistryImage = (context: Context) =>
67
67
 
68
68
  const getDeleteImageCommands = (
69
69
  fullImageName: StringOrBashExpression,
70
- keepNewest = 0,
70
+ keepNewest = 0
71
71
  ) => {
72
72
  if (keepNewest === 0) {
73
73
  // no need to list tags, we delete the whole thing
@@ -80,7 +80,7 @@ const getDeleteImageCommands = (
80
80
 
81
81
  const listImagesToDeletecommand = removeFirstLinesFromCommandOutput(
82
82
  listAllImagesCommand,
83
- keepNewest,
83
+ keepNewest
84
84
  );
85
85
  const deleteImageCommand = `gcloud artifacts docker images delete ${fullImageName}@$version --quiet --delete-tags`;
86
86
 
@@ -119,8 +119,8 @@ export const getDeleteUnusedImagesCommands = (context: Context, keep = 0) => {
119
119
  ? allowFailureInScripts(
120
120
  getDeleteImageCommands(
121
121
  getArtifactsRegistryImageName(context, true),
122
- 0,
123
- ),
122
+ 0
123
+ )
124
124
  )
125
125
  : []),
126
126
  ];
@@ -4,7 +4,7 @@ import { getDeleteUnusedRevisionsCommands } from "./cloudRunRevisions";
4
4
 
5
5
  export const getRemoveOldRevisionsAndImagesCommand = (
6
6
  context: Context,
7
- when: "postDeploy" | "onStop",
7
+ when: "postDeploy" | "onStop"
8
8
  ) => {
9
9
  if (when === "onStop") {
10
10
  // service is already deleted, so we don't need to delete old revisions, just delete all images
@@ -19,11 +19,11 @@ export const getRemoveOldRevisionsAndImagesCommand = (
19
19
 
20
20
  const deleteOldRevisionsCommands = getDeleteUnusedRevisionsCommands(
21
21
  context,
22
- revisionsToKeep,
22
+ revisionsToKeep
23
23
  );
24
24
  const deleteOldImagesCommands = getDeleteUnusedImagesCommands(
25
25
  context,
26
- imagesToKeep,
26
+ imagesToKeep
27
27
  );
28
28
 
29
29
  return [...deleteOldRevisionsCommands, ...deleteOldImagesCommands];
@@ -9,7 +9,7 @@ const getListRevisionsCommand = (
9
9
  args: {
10
10
  filter?: string;
11
11
  format: string;
12
- },
12
+ }
13
13
  ) => {
14
14
  const serviceName = getServiceName(context);
15
15
  const deployConfig = context.componentConfig.deploy;
@@ -35,7 +35,7 @@ const getListRevisionsCommand = (
35
35
 
36
36
  export const getDeleteUnusedRevisionsCommands = (
37
37
  context: Context,
38
- keep: number,
38
+ keep: number
39
39
  ) => {
40
40
  const deployConfig = context.componentConfig.deploy;
41
41
  if (deployConfig === false) {
@@ -54,7 +54,7 @@ export const getDeleteUnusedRevisionsCommands = (
54
54
  // this removes the newest `revisionsToKeep` images
55
55
  const listRevisionsToDeleteCmd = removeFirstLinesFromCommandOutput(
56
56
  listAllInactiveRevisionsCmd,
57
- keep,
57
+ keep
58
58
  );
59
59
  const deleteRevisionCmd = `gcloud run revisions delete ${createArgsString({
60
60
  project: deployConfig.projectId,
@@ -26,7 +26,7 @@ import { ENV_VARS_FILENAME } from "./constants";
26
26
  const getJobRunScriptForJob = (
27
27
  context: Context,
28
28
  jobName: StringOrBashExpression,
29
- wait: boolean,
29
+ wait: boolean
30
30
  ) => {
31
31
  const commonArgs = getCommonCloudRunArgs(context);
32
32
 
@@ -66,7 +66,7 @@ export const getDeleteJobsScripts = (context: Context) => {
66
66
 
67
67
  export const getJobRunScripts = (
68
68
  context: Context,
69
- when: DeployConfigCloudRunJob["when"],
69
+ when: DeployConfigCloudRunJob["when"]
70
70
  ) => {
71
71
  const jobsWithNames = getCloudRunJobsWithNames(context);
72
72
  return jobsWithNames
@@ -76,8 +76,8 @@ export const getJobRunScripts = (
76
76
  context,
77
77
  jobName,
78
78
  // wait for completin on stop jobs, since stop will delete the jobs afterwards, so they will fail
79
- ["preStop", "postStop"].includes(when),
80
- ),
79
+ ["preStop", "postStop"].includes(when)
80
+ )
81
81
  );
82
82
  };
83
83
 
@@ -92,7 +92,7 @@ export const getJobCreateScripts = (context: Context) => {
92
92
  const getJobCreateScriptsForJob = (
93
93
  context: Context,
94
94
  jobName: StringOrBashExpression,
95
- job: DeployConfigCloudRunJob,
95
+ job: DeployConfigCloudRunJob
96
96
  ) => {
97
97
  const commonDeployArgs = getCommonDeployArgs(context);
98
98
 
@@ -125,9 +125,9 @@ const getJobCreateScriptsForJob = (
125
125
  return [
126
126
  ...allowFailureInScripts([`${gcloudRunCmd()} jobs create ${argsString}`]),
127
127
  `${gcloudRunCmd(
128
- requiresBeta ? "beta" : undefined,
128
+ requiresBeta ? "beta" : undefined
129
129
  )} jobs update ${argsString} ${createArgsString(
130
- ...createVolumeConfig(job?.volumes, "job"),
130
+ ...createVolumeConfig(job?.volumes, "job")
131
131
  )}`,
132
132
  ];
133
133
  };
@@ -166,11 +166,11 @@ const getCloudRunJobsWithSchedule = (context: Context) => {
166
166
  return jobsWithNames
167
167
  .filter(
168
168
  (
169
- entry,
169
+ entry
170
170
  ): entry is {
171
171
  jobName: BashExpression;
172
172
  job: DeployConfigCloudRunJobWithSchedule;
173
- } => entry.job.when === "schedule",
173
+ } => entry.job.when === "schedule"
174
174
  )
175
175
  .map(({ job, jobName }) => ({
176
176
  job,
@@ -188,7 +188,7 @@ const getCloudRunJobsWithNames = (context: Context) => {
188
188
  const jobsWithNames = Object.entries(deployConfig.jobs ?? {})
189
189
  // filter out disabled jobs
190
190
  .filter((entry): entry is [string, DeployConfigCloudRunJob] =>
191
- Boolean(entry[1]),
191
+ Boolean(entry[1])
192
192
  )
193
193
  .map(([name, job]) => ({
194
194
  jobName: getFullJobName(name),
@@ -16,7 +16,7 @@ import { createVolumeConfig } from "./volumes";
16
16
  export const getServiceDeployScript = (
17
17
  context: Context,
18
18
  service: DeployConfigCloudRunService | true | undefined,
19
- nameSuffix?: string,
19
+ nameSuffix?: string
20
20
  ) => {
21
21
  const commonDeployArgs = getCommonDeployArgs(context);
22
22
 
@@ -54,20 +54,20 @@ export const getServiceDeployScript = (
54
54
  "cpu-boost": true,
55
55
  "execution-environment": customConfig?.executionEnvironment,
56
56
  },
57
- ...createVolumeConfig(customConfig?.volumes, "service"),
57
+ ...createVolumeConfig(customConfig?.volumes, "service")
58
58
  );
59
59
  // volumes require beta
60
60
  const requiresBeta =
61
61
  customConfig?.volumes && Object.keys(customConfig?.volumes).length > 0;
62
62
 
63
63
  return `${gcloudRunCmd(
64
- requiresBeta ? "beta" : undefined,
64
+ requiresBeta ? "beta" : undefined
65
65
  )} deploy ${fullServiceName} ${argsString}`;
66
66
  };
67
67
 
68
68
  export const getServiceDeleteScript = (
69
69
  context: Context,
70
- serviceSuffix?: string,
70
+ serviceSuffix?: string
71
71
  ) => {
72
72
  const commonArgs = getCommonCloudRunArgs(context);
73
73
 
@@ -16,7 +16,7 @@ export const gcloudSchedulerCmd = (version?: "beta") => {
16
16
  };
17
17
 
18
18
  export const setGoogleProjectNumberScript = (
19
- deployConfig: DeployConfigCloudRun,
19
+ deployConfig: DeployConfigCloudRun
20
20
  ) => [
21
21
  `export GCLOUD_PROJECT_NUMBER=$(${gcloudCmd()} projects describe ${
22
22
  deployConfig.projectId
@@ -29,25 +29,25 @@ export function getCloudRunDeployScripts(context: Context) {
29
29
  const deployConfig = getCloudRunDeployConfig(context);
30
30
  const allEnvVars = omit(
31
31
  context.environment.envVars,
32
- GCLOUD_DEPLOY_CREDENTIALS_KEY,
32
+ GCLOUD_DEPLOY_CREDENTIALS_KEY
33
33
  );
34
34
 
35
35
  return [
36
36
  ...collapseableSection(
37
37
  "prepare",
38
- "Prepare...",
38
+ "Prepare..."
39
39
  )([
40
40
  ...gcloudServiceAccountLoginCommands(context),
41
41
  ...setGoogleProjectNumberScript(deployConfig),
42
42
  ]),
43
43
  ...collapseableSection(
44
44
  "writeenvvars",
45
- "Write env vars to file",
45
+ "Write env vars to file"
46
46
  )(writeBashYamlToFileScript(allEnvVars, ENV_VARS_FILENAME)),
47
47
 
48
48
  ...collapseableSection(
49
49
  "deploy",
50
- "Deploy to cloud run",
50
+ "Deploy to cloud run"
51
51
  )([
52
52
  ...(deployConfig.cloudSql
53
53
  ? getDatabaseCreateScript(context, deployConfig) // we create the db, so that we can also delete it afterwards
@@ -61,15 +61,15 @@ export function getCloudRunDeployScripts(context: Context) {
61
61
  : []),
62
62
  ...Object.entries(deployConfig.additionalServices ?? {}).map(
63
63
  ([name, service]) =>
64
- getServiceDeployScript(context, service, "-" + name),
64
+ getServiceDeployScript(context, service, "-" + name)
65
65
  ),
66
66
  ...getJobRunScripts(context, "postDeploy"),
67
67
  ]),
68
68
  ...collapseableSection(
69
69
  "cleanup",
70
- "Cleanup",
70
+ "Cleanup"
71
71
  )(
72
- getRemoveOldRevisionsAndImagesCommand(context, "postDeploy"), // we cleanup inactive images both on deploy and stop
72
+ getRemoveOldRevisionsAndImagesCommand(context, "postDeploy") // we cleanup inactive images both on deploy and stop
73
73
  ),
74
74
  ...getDependencyTrackUploadScript(context),
75
75
  ];
@@ -19,7 +19,7 @@ export function getCloudRunStopScripts(context: Context) {
19
19
  ...getJobRunScripts(context, "preStop"),
20
20
  ...(deployConfig.service !== false ? getServiceDeleteScript(context) : []),
21
21
  ...Object.entries(deployConfig.additionalServices ?? {}).flatMap(([name]) =>
22
- getServiceDeleteScript(context, name),
22
+ getServiceDeleteScript(context, name)
23
23
  ),
24
24
  ...getJobRunScripts(context, "postStop"),
25
25
  ...getDeleteSchedulesScripts(context),
@@ -10,7 +10,7 @@ import { getCloudRunDeployScripts } from "./getCloudRunDeployScripts";
10
10
  import { getCloudRunStopScripts } from "./getCloudRunStopScripts";
11
11
 
12
12
  export const createGoogleCloudRunDeployJobs = (
13
- context: Context,
13
+ context: Context
14
14
  ): CatladderJob[] => {
15
15
  const deployConfig = context.componentConfig.deploy;
16
16
  if (deployConfig === false) {
@@ -3,7 +3,7 @@ import type { keyValuesArg } from "../utils/createArgsString";
3
3
 
4
4
  export const createVolumeConfig = (
5
5
  volumes: DeployConfigCloudRunVolumes | undefined,
6
- type: "service" | "job",
6
+ type: "service" | "job"
7
7
  ): keyValuesArg[] => {
8
8
  if (!volumes) {
9
9
  return [];
@@ -16,7 +16,7 @@ export const createVolumeConfig = (
16
16
  readonly ? ",readonly=true" : ""
17
17
  }`,
18
18
  "add-volume-mount": `volume=${volumeName},mount-path=${mountPath}`,
19
- }),
19
+ })
20
20
  ),
21
21
  type === "service" ? { "execution-environment": "gen2" } : {},
22
22
  ];
@@ -33,11 +33,11 @@ const getCloudSqlVariables = ({
33
33
  deployConfigRaw.cloudSql,
34
34
  fullConfig,
35
35
  environmentSlugPrefix,
36
- componentName,
36
+ componentName
37
37
  );
38
38
 
39
39
  const additionalQueryParamsString = Object.entries(
40
- deployConfigRaw.cloudSql.dbAdditionalQueryParams ?? {},
40
+ deployConfigRaw.cloudSql.dbAdditionalQueryParams ?? {}
41
41
  )
42
42
  .map(([key, value]) => `&${key}=${value}`)
43
43
  .join("");
@@ -49,7 +49,7 @@ const getCloudSqlVariables = ({
49
49
  DB_USER: deployConfigRaw.cloudSql.dbUser ?? "postgres",
50
50
  DB_PASSWORD: "$" + getSecretVarName(env, componentName, "DB_PASSWORD"),
51
51
  DATABASE_URL: `${getDatabaseConnectionString(
52
- deployConfigRaw.cloudSql,
52
+ deployConfigRaw.cloudSql
53
53
  )}${additionalQueryParamsString}`,
54
54
  DATABASE_JDBC_URL: DATABASE_JDBC_URL,
55
55
  };
@@ -88,14 +88,10 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<"google-cloudrun"> = {
88
88
  [
89
89
  fullName,
90
90
  getBashVariable(
91
- getSecretVarName(
92
- env,
93
- componentName,
94
- GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
95
- ),
91
+ getSecretVarName(env, componentName, GCLOUD_RUN_CANONICAL_HOST_SUFFIX)
96
92
  ),
97
93
  ],
98
- "-",
94
+ "-"
99
95
  ).toLowerCase();
100
96
  const jobTriggers =
101
97
  deployConfigRaw && deployConfigRaw.jobs
@@ -107,7 +103,7 @@ export const GCLOUD_RUN_DEPLOY_TYPE: DeployTypeDefinition<"google-cloudrun"> = {
107
103
  }-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/${
108
104
  deployConfigRaw.projectId
109
105
  }/jobs/${getCloudRunJobName(fullName, name)}:run`,
110
- ]),
106
+ ])
111
107
  )
112
108
  : {};
113
109
 
@@ -23,7 +23,7 @@ export const createArgsString = (...args: keyValuesArg[]) =>
23
23
  return `--no-${key}`;
24
24
  }
25
25
  return `--${key}=${value}`;
26
- }),
26
+ })
27
27
  )
28
28
  .flat()
29
29
  .join(" ");
@@ -7,7 +7,7 @@ import type {
7
7
 
8
8
  export const getDatabaseDeleteScript = (
9
9
  context: Context,
10
- deployConfig: DeployConfigCloudRun,
10
+ deployConfig: DeployConfigCloudRun
11
11
  ): string[] => {
12
12
  if (!deployConfig.cloudSql || !deployConfig.cloudSql.deleteDatabaseOnStop) {
13
13
  throw new Error("not possible");
@@ -29,14 +29,14 @@ export const getDatabaseDeleteScript = (
29
29
  `gcloud sql databases delete ${DB_NAME} --instance=${instanceId} --project ${projectId}`,
30
30
  {
31
31
  pauseInSeconds: 10,
32
- },
32
+ }
33
33
  ),
34
34
  ];
35
35
  };
36
36
 
37
37
  export const getDatabaseCreateScript = (
38
38
  context: Context,
39
- deployConfig: DeployConfigCloudRun,
39
+ deployConfig: DeployConfigCloudRun
40
40
  ): string[] => {
41
41
  if (!deployConfig.cloudSql) {
42
42
  throw new Error("not possible");
@@ -61,14 +61,14 @@ export const DATABASE_JDBC_URL =
61
61
  "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD";
62
62
 
63
63
  export const getDatabaseConnectionString = (
64
- config: DeployConfigCloudRunCloudSql,
64
+ config: DeployConfigCloudRunCloudSql
65
65
  ): string => {
66
66
  switch (config.dbConnectionStringFormat) {
67
67
  case "jdbc":
68
68
  return DATABASE_JDBC_URL;
69
69
  case "rails":
70
70
  return `postgresql://$DB_USER:$DB_PASSWORD@${encodeURIComponent(
71
- `/cloudsql/${config.instanceConnectionName}`,
71
+ `/cloudsql/${config.instanceConnectionName}`
72
72
  )}/$DB_NAME?`;
73
73
  default:
74
74
  // prisma
@@ -5,6 +5,6 @@ import type { Context } from "../../../types";
5
5
  export const gcloudServiceAccountLoginCommands = (context: Context) => [
6
6
  `gcloud auth activate-service-account --key-file=<(echo "$${getSecretVarNameForContext(
7
7
  context,
8
- GCLOUD_DEPLOY_CREDENTIALS_KEY,
8
+ GCLOUD_DEPLOY_CREDENTIALS_KEY
9
9
  )}")`,
10
10
  ];
@@ -2,6 +2,6 @@ import type { StringOrBashExpression } from "../../../bash/BashExpression";
2
2
 
3
3
  export const getCloudRunJobName = (
4
4
  fullAppName: StringOrBashExpression,
5
- jobName: string,
5
+ jobName: string
6
6
  ): StringOrBashExpression =>
7
7
  fullAppName.toLowerCase().concat("-" + jobName.toLowerCase());
@@ -8,5 +8,5 @@
8
8
  */
9
9
  export const removeFirstLinesFromCommandOutput = (
10
10
  cmd: string,
11
- removeFirstN: number,
11
+ removeFirstN: number
12
12
  ) => (removeFirstN === 0 ? cmd : `${cmd} | tail -n +${removeFirstN + 1}`);
@@ -12,7 +12,7 @@ export const getFullDbName = (
12
12
  | DeployConfigKubernetesValuesCloudSQLUnmanaged,
13
13
  fullConfig: Config<never>,
14
14
  environmentSlugPrefix: StringOrBashExpression,
15
- componentName: string,
15
+ componentName: string
16
16
  ) => {
17
17
  return joinBashExpressions(
18
18
  [
@@ -21,6 +21,6 @@ export const getFullDbName = (
21
21
  environmentSlugPrefix,
22
22
  cloudSqlConfig.dbBaseName ?? componentName,
23
23
  ].flatMap((part) => (part ? [part] : [])),
24
- "-",
24
+ "-"
25
25
  );
26
26
  };
@@ -17,13 +17,13 @@ export * from "./utils";
17
17
  export type DeployTypeDefinition<T extends DeployConfigType> = {
18
18
  jobs: (context: Context) => CatladderJob[];
19
19
  defaults: (
20
- envContext: EnvironmentContext<any, T>,
20
+ envContext: EnvironmentContext<any, T>
21
21
  ) => PartialDeep<DeployConfigGeneric<T>>;
22
22
  additionalSecretKeys: (
23
- envContext: EnvironmentContext<any, T>,
23
+ envContext: EnvironmentContext<any, T>
24
24
  ) => SecretEnvVar[];
25
25
  getAdditionalEnvVars: (
26
- envContext: EnvironmentContext<any, T>,
26
+ envContext: EnvironmentContext<any, T>
27
27
  ) => Record<string, string | BashExpression | undefined | null>;
28
28
  };
29
29
  export type DeployTypes = {
@@ -20,7 +20,7 @@ type CloudSqlValues = {
20
20
  dbUser: string;
21
21
  };
22
22
  export const createKubernetesCloudsqlBaseValues = (
23
- context: Context,
23
+ context: Context
24
24
  ): {
25
25
  cloudsql: CloudSqlValues;
26
26
  } => {
@@ -36,7 +36,7 @@ export const createKubernetesCloudsqlBaseValues = (
36
36
 
37
37
  const proxyCredentials = `$${getSecretVarNameForContext(
38
38
  context,
39
- "cloudsqlProxyCredentials",
39
+ "cloudsqlProxyCredentials"
40
40
  )}`;
41
41
  if (config?.type !== "unmanaged") {
42
42
  const instanceConnectionName = `${config.projectId ?? "skynet-164509"}:${
@@ -63,7 +63,7 @@ export const createKubernetesCloudsqlBaseValues = (
63
63
  config,
64
64
  context.fullConfig,
65
65
  context.environment.slugPrefix,
66
- context.componentName,
66
+ context.componentName
67
67
  ),
68
68
  },
69
69
  };
@@ -15,7 +15,7 @@ import { collapseableSection } from "../../utils/gitlab";
15
15
 
16
16
  const ALL_VALUES_FILE = "__all_values.yml";
17
17
  export const createKubernetesDeployJobs = (
18
- context: Context,
18
+ context: Context
19
19
  ): CatladderJob[] => {
20
20
  const deployConfig = context.componentConfig.deploy;
21
21
  if (deployConfig === false) {
@@ -59,14 +59,14 @@ export const createKubernetesDeployJobs = (
59
59
  const connectContext = [
60
60
  `kubectl config set-cluster "${clusterName}" --server="$${getSecretVarNameForContext(
61
61
  context,
62
- "KUBE_URL",
62
+ "KUBE_URL"
63
63
  )}" --certificate-authority <(echo $${getSecretVarNameForContext(
64
64
  context,
65
- "KUBE_CA_PEM",
65
+ "KUBE_CA_PEM"
66
66
  )} | base64 -d) --embed-certs=true`,
67
67
  `kubectl config set-credentials "${clusterName}" --token="$${getSecretVarNameForContext(
68
68
  context,
69
- "KUBE_TOKEN",
69
+ "KUBE_TOKEN"
70
70
  )}"`,
71
71
  `kubectl config set-context "${clusterName}" --cluster="${clusterName}" --user="${clusterName}" --namespace="${context.environment.envVars.KUBE_NAMESPACE}"`,
72
72
  `kubectl config use-context "${clusterName}"`,
@@ -79,9 +79,9 @@ export const createKubernetesDeployJobs = (
79
79
  ...connectContext,
80
80
  ...collapseableSection(
81
81
  "writeallvalues",
82
- "Write " + ALL_VALUES_FILE + " for helm deployment",
82
+ "Write " + ALL_VALUES_FILE + " for helm deployment"
83
83
  )(
84
- writeBashYamlToFileScript(createKubeValues(context), ALL_VALUES_FILE),
84
+ writeBashYamlToFileScript(createKubeValues(context), ALL_VALUES_FILE)
85
85
  ),
86
86
  "kubernetesCreateSecret",
87
87
  "kubernetesDeploy",
@@ -37,7 +37,7 @@ export const KUBERNETES_DEPLOY_TYPE: DeployTypeDefinition<"kubernetes"> = {
37
37
  fullConfig.customerName,
38
38
  domainCanonical,
39
39
  ],
40
- ".",
40
+ "."
41
41
  ); // default for kubernetes and rest
42
42
  return {
43
43
  KUBE_NAMESPACE,
@@ -43,7 +43,7 @@ export const createKubeEnv = (context: Context) => {
43
43
  {
44
44
  secret: {},
45
45
  public: {},
46
- },
46
+ }
47
47
  );
48
48
 
49
49
  return env;
@@ -15,7 +15,7 @@ import { processSecretsAsFiles } from "./processSecretsAsFiles";
15
15
 
16
16
  const createAppConfig = (
17
17
  context: Context,
18
- application: DeployConfigKubernetesValues["application"],
18
+ application: DeployConfigKubernetesValues["application"]
19
19
  ): DeployConfigKubernetesValues["application"] => {
20
20
  if (application === false) {
21
21
  return {
@@ -45,14 +45,14 @@ const createAppConfig = (
45
45
  },
46
46
  },
47
47
  }, // default
48
- rest, // merge rest in
48
+ rest // merge rest in
49
49
  );
50
50
  };
51
51
 
52
52
  const removeFalsy = <T>(record?: Record<string, false | T>) => {
53
53
  if (!record) return undefined;
54
54
  return Object.fromEntries(
55
- Object.entries(record).filter(([, value]) => value !== false),
55
+ Object.entries(record).filter(([, value]) => value !== false)
56
56
  );
57
57
  };
58
58
 
@@ -84,7 +84,7 @@ export const createKubeValues = (context: Context) => {
84
84
  : {},
85
85
  deployConfig.values?.mongodb?.enabled
86
86
  ? createMongodbBaseConfig(context)
87
- : {},
87
+ : {}
88
88
  );
89
89
 
90
90
  const kubeValues = processSecretsAsFiles(
@@ -93,7 +93,7 @@ export const createKubeValues = (context: Context) => {
93
93
  cronjobs: removeFalsy(cronjobs),
94
94
 
95
95
  ...rest,
96
- }),
96
+ })
97
97
  );
98
98
 
99
99
  return kubeValues;
@@ -19,7 +19,7 @@ const getMongodbReplicasetHost = (context: Context, index: number) => {
19
19
  const fullAppname = context.environment.envVars.KUBE_APP_NAME;
20
20
  return getMongodbHost(
21
21
  context,
22
- `${fullAppname}-mongodb-${index}.${fullAppname}-mongodb-headless`,
22
+ `${fullAppname}-mongodb-${index}.${fullAppname}-mongodb-headless`
23
23
  );
24
24
  };
25
25
  const createMongodbUrl = (context: Context, dbName: string) => {