@catladder/pipeline 1.145.0 → 1.146.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 (91) hide show
  1. package/dist/bundles/catladder-gitlab/index.js +1 -1
  2. package/dist/constants.js +1 -1
  3. package/dist/context/getEnvironmentVariables.js +1 -2
  4. package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +1 -2
  5. package/dist/deploy/kubernetes/kubeValues.js +1 -3
  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/createAppBuildJob.ts +3 -3
  17. package/src/build/base/createArtifactsConfig.ts +2 -2
  18. package/src/build/base/index.ts +1 -1
  19. package/src/build/base/writeDotEnv.ts +1 -1
  20. package/src/build/custom/__tests__/testJob.test.ts +1 -1
  21. package/src/build/custom/buildJob.ts +2 -2
  22. package/src/build/custom/testJob.ts +3 -3
  23. package/src/build/docker.ts +7 -7
  24. package/src/build/index.ts +1 -1
  25. package/src/build/node/buildJob.ts +2 -2
  26. package/src/build/node/cache.ts +4 -4
  27. package/src/build/node/meteor.ts +1 -1
  28. package/src/build/node/testJob.ts +3 -3
  29. package/src/build/node/yarn.ts +7 -7
  30. package/src/config/configruedEnvs.ts +6 -6
  31. package/src/config/readConfig.ts +2 -2
  32. package/src/context/__tests__/resolveReferences.test.ts +1 -1
  33. package/src/context/getBuildInfoVariables.ts +5 -5
  34. package/src/context/getEnvConfig.ts +1 -1
  35. package/src/context/getEnvType.ts +1 -1
  36. package/src/context/getEnvironment.ts +1 -1
  37. package/src/context/getEnvironmentContext.ts +2 -2
  38. package/src/context/getEnvironmentVariables.ts +12 -12
  39. package/src/context/getReviewSlug.ts +2 -2
  40. package/src/context/index.ts +3 -3
  41. package/src/context/resolveReferences.ts +12 -9
  42. package/src/context/transformJobOnlyVars.ts +1 -1
  43. package/src/context/utils/envVars.ts +3 -3
  44. package/src/deploy/base/deploy.ts +5 -5
  45. package/src/deploy/base/index.ts +1 -1
  46. package/src/deploy/base/rollback.ts +1 -1
  47. package/src/deploy/base/stop.ts +1 -1
  48. package/src/deploy/cloudRun/artifactsRegistry.ts +5 -5
  49. package/src/deploy/cloudRun/cleanup.ts +3 -3
  50. package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -3
  51. package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +10 -10
  52. package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +4 -4
  53. package/src/deploy/cloudRun/createJobs/common.ts +1 -1
  54. package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +7 -7
  55. package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +1 -1
  56. package/src/deploy/cloudRun/createJobs/index.ts +1 -1
  57. package/src/deploy/cloudRun/createJobs/volumes.ts +2 -2
  58. package/src/deploy/cloudRun/index.ts +10 -6
  59. package/src/deploy/cloudRun/utils/createArgsString.ts +1 -1
  60. package/src/deploy/cloudRun/utils/database.ts +5 -5
  61. package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +1 -1
  62. package/src/deploy/cloudRun/utils/jobName.ts +1 -1
  63. package/src/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.ts +1 -1
  64. package/src/deploy/cloudSql/utils.ts +2 -2
  65. package/src/deploy/index.ts +3 -3
  66. package/src/deploy/kubernetes/cloudSql/index.ts +3 -3
  67. package/src/deploy/kubernetes/deployJob.ts +6 -6
  68. package/src/deploy/kubernetes/index.ts +1 -1
  69. package/src/deploy/kubernetes/kubeEnv.ts +1 -1
  70. package/src/deploy/kubernetes/kubeValues.ts +5 -5
  71. package/src/deploy/kubernetes/mongodb.ts +1 -1
  72. package/src/deploy/kubernetes/processSecretsAsFiles.ts +3 -3
  73. package/src/deploy/utils.ts +2 -2
  74. package/src/pipeline/createAllJobs.ts +4 -4
  75. package/src/pipeline/createChildPipeline.ts +2 -2
  76. package/src/pipeline/createJobsForComponent.ts +3 -3
  77. package/src/pipeline/createMainPipeline.ts +20 -17
  78. package/src/pipeline/generatePipelineFiles.ts +3 -3
  79. package/src/pipeline/getPipelineStages.ts +1 -1
  80. package/src/pipeline/gitlab/createGitlabJobs.ts +24 -24
  81. package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +6 -6
  82. package/src/pipeline/packageManager.ts +2 -2
  83. package/src/pipeline/yarn/yarnUtils.ts +7 -7
  84. package/src/types/config.ts +2 -2
  85. package/src/types/context.ts +1 -1
  86. package/src/types/environmentContext.ts +1 -1
  87. package/src/types/jobs.ts +1 -1
  88. package/src/types/utils.ts +4 -4
  89. package/src/utils/gitlab.ts +1 -1
  90. package/src/utils/index.ts +2 -2
  91. package/src/utils/writeFiles.ts +2 -2
@@ -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) => {
@@ -7,9 +7,9 @@ export const processSecretsAsFiles = <
7
7
  env: {
8
8
  secret: Record<string, StringOrBashExpression>;
9
9
  };
10
- } & DeployConfigKubernetesValues
10
+ } & DeployConfigKubernetesValues,
11
11
  >(
12
- values: T
12
+ values: T,
13
13
  ): T => {
14
14
  if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
15
15
  return values;
@@ -27,7 +27,7 @@ export const processSecretsAsFiles = <
27
27
  values.secretsAsFile.map((key) => [
28
28
  key + "_content",
29
29
  values.env.secret[key],
30
- ])
30
+ ]),
31
31
  ),
32
32
  },
33
33
  },
@@ -3,7 +3,7 @@ import type { DeployConfigKubernetesCluster } from "./types";
3
3
  import { isOfDeployType } from "./types";
4
4
 
5
5
  export const getFullKubernetesClusterName = (
6
- cluster: DeployConfigKubernetesCluster
6
+ cluster: DeployConfigKubernetesCluster,
7
7
  ) => {
8
8
  if (cluster.type === "gcloud") {
9
9
  return `gke_${cluster.projectId}_${cluster.region}_${cluster.name}`;
@@ -12,7 +12,7 @@ export const getFullKubernetesClusterName = (
12
12
 
13
13
  export const getKubernetesNamespace = (
14
14
  config: Pick<Config, "customerName" | "appName">,
15
- env: string
15
+ env: string,
16
16
  ) => {
17
17
  return `${config.customerName}-${config.appName}-${env}`;
18
18
  };
@@ -42,11 +42,11 @@ export const createAllJobs = async ({
42
42
  trigger,
43
43
  pipelineType,
44
44
  }),
45
- ])
46
- )
45
+ ]),
46
+ ),
47
47
  ),
48
48
  ];
49
- })
50
- )
49
+ }),
50
+ ),
51
51
  );
52
52
  };
@@ -10,7 +10,7 @@ import { createGitlabPipelineWithDefaults } from "./gitlab/createGitlabPipeline"
10
10
  export const createChildPipeline = async <T extends PipelineType>(
11
11
  pipelineType: T,
12
12
  trigger: PipelineTrigger,
13
- config: Config
13
+ config: Config,
14
14
  ): Promise<Pipeline<T>> => {
15
15
  const jobs = await createAllJobs({
16
16
  config,
@@ -27,7 +27,7 @@ export const createChildPipeline = async <T extends PipelineType>(
27
27
  },
28
28
  stages,
29
29
  jobs: Object.fromEntries(
30
- gitlabJobs.map(({ gitlabJob, name }) => [name, gitlabJob])
30
+ gitlabJobs.map(({ gitlabJob, name }) => [name, gitlabJob]),
31
31
  ),
32
32
  }) as Pipeline<T>;
33
33
  }
@@ -9,7 +9,7 @@ import { getPackageManagerInfo } from "./packageManager";
9
9
 
10
10
  const injectDefaultVarsInCustomJobs = (
11
11
  context: Context,
12
- jobs: CatladderJob[]
12
+ jobs: CatladderJob[],
13
13
  ) =>
14
14
  jobs.map(({ variables, ...job }) => ({
15
15
  variables: {
@@ -40,11 +40,11 @@ const createRawJobs = (context: Context): CatladderJob[] => {
40
40
  };
41
41
 
42
42
  export const createJobsForComponent = async (
43
- contextContext: Omit<CreateContextContext, "packageManagerInfo">
43
+ contextContext: Omit<CreateContextContext, "packageManagerInfo">,
44
44
  ): Promise<Array<CatladderJobWithContext>> => {
45
45
  const packageManagerInfo = await getPackageManagerInfo(
46
46
  contextContext.config,
47
- contextContext.componentName
47
+ contextContext.componentName,
48
48
  );
49
49
 
50
50
  const context = await createContext({
@@ -20,7 +20,7 @@ import { getGitlabReleaseJobs } from "./gitlab/gitlabReleaseJobs";
20
20
 
21
21
  export const createMainPipeline = async <T extends PipelineType>(
22
22
  pipelineType: T,
23
- config: Config
23
+ config: Config,
24
24
  ): Promise<Pipeline<T>> => {
25
25
  const stages = getPipelineStages(config);
26
26
 
@@ -32,9 +32,9 @@ export const createMainPipeline = async <T extends PipelineType>(
32
32
  async (trigger) =>
33
33
  await createGitlabJobs(
34
34
  await createAllJobs({ config, trigger, pipelineType }),
35
- getGitlabRulesForTrigger(trigger)
36
- )
37
- )
35
+ getGitlabRulesForTrigger(trigger),
36
+ ),
37
+ ),
38
38
  );
39
39
 
40
40
  const allJobs = allJobsPerTrigger
@@ -48,20 +48,23 @@ export const createMainPipeline = async <T extends PipelineType>(
48
48
  return aIndex - bIndex;
49
49
  })
50
50
 
51
- .reduce((acc, { gitlabJob, name }) => {
52
- // merge jobs, if a job is already there, merge the rules
53
- // this is currently needed because of envMode: "none", which creates the same job for all triggers, so it can appear multiple times
54
- if (acc[name]) {
55
- acc[name].rules = [
56
- ...(acc[name].rules ?? []),
57
- ...(gitlabJob.rules ?? []),
58
- ];
59
- } else {
60
- acc[name] = gitlabJob;
61
- }
51
+ .reduce(
52
+ (acc, { gitlabJob, name }) => {
53
+ // merge jobs, if a job is already there, merge the rules
54
+ // this is currently needed because of envMode: "none", which creates the same job for all triggers, so it can appear multiple times
55
+ if (acc[name]) {
56
+ acc[name].rules = [
57
+ ...(acc[name].rules ?? []),
58
+ ...(gitlabJob.rules ?? []),
59
+ ];
60
+ } else {
61
+ acc[name] = gitlabJob;
62
+ }
62
63
 
63
- return acc;
64
- }, {} as { [key: string]: GitlabJobDef });
64
+ return acc;
65
+ },
66
+ {} as { [key: string]: GitlabJobDef },
67
+ );
65
68
 
66
69
  return createGitlabPipelineWithDefaults({
67
70
  stages: [...stages, "release"],
@@ -6,7 +6,7 @@ import { getPipelineTriggerForGitlabChildPipeline } from "./gitlab/getPipelineTr
6
6
  export async function generatePipelineFiles<T extends PipelineType>(
7
7
  config: Config,
8
8
  pipelineType: T,
9
- mode: PipelineMode<T>
9
+ mode: PipelineMode<T>,
10
10
  ) {
11
11
  if (mode === "childpipeline") {
12
12
  const trigger = getPipelineTriggerForGitlabChildPipeline();
@@ -14,14 +14,14 @@ export async function generatePipelineFiles<T extends PipelineType>(
14
14
  const { jobs, ...mainPipeline } = await createChildPipeline(
15
15
  pipelineType,
16
16
  trigger,
17
- config
17
+ config,
18
18
  );
19
19
  // need to spread out the jobs, forgot why
20
20
  await writeYamlfile(`__pipeline.yml`, { ...jobs, ...mainPipeline });
21
21
  } else {
22
22
  const { jobs, ...mainPipeline } = await createMainPipeline(
23
23
  pipelineType,
24
- config
24
+ config,
25
25
  );
26
26
  // need to spread out the jobs, forgot why
27
27
  await writeYamlfile(`.gitlab-ci.yml`, { ...jobs, ...mainPipeline });
@@ -16,7 +16,7 @@ export function getPipelineStages(config: Config) {
16
16
  baseStage,
17
17
  ...allEnvs.map((e) => `${baseStage} ${e}`),
18
18
  ],
19
- []
19
+ [],
20
20
  );
21
21
  return stages;
22
22
  }
@@ -22,12 +22,12 @@ export type AllGitlabJobs = {
22
22
  export const GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
23
23
  const removeUndefined = (obj: GitlabJobDef): GitlabJobDef =>
24
24
  Object.fromEntries(
25
- Object.entries(obj).filter(([, value]) => value !== undefined)
25
+ Object.entries(obj).filter(([, value]) => value !== undefined),
26
26
  ) as GitlabJobDef;
27
27
  const getFullJobName = (
28
28
  name: string,
29
29
  componentName: string,
30
- env?: string | null
30
+ env?: string | null,
31
31
  ) => {
32
32
  if (env) {
33
33
  return `${componentName} ${name} | ${env} `;
@@ -39,14 +39,14 @@ const getFullReferencedJobName = (
39
39
  referencedJobName: string,
40
40
  componentName: string,
41
41
  env: string,
42
- allJobs: AllCatladderJobs
42
+ allJobs: AllCatladderJobs,
43
43
  ) => {
44
44
  const referencedJob = allJobs[componentName]?.[env]?.find(
45
- (j) => j.name === referencedJobName
45
+ (j) => j.name === referencedJobName,
46
46
  );
47
47
  if (!referencedJob) {
48
48
  throw new Error(
49
- `unknown job referenced: '${referencedJobName}' from '${env}:${componentName}'`
49
+ `unknown job referenced: '${referencedJobName}' from '${env}:${componentName}'`,
50
50
  );
51
51
  }
52
52
  const envToSet = referencedJob.envMode !== "none" ? env : null;
@@ -75,7 +75,7 @@ export const makeGitlabJob = (
75
75
  ...job
76
76
  }: CatladderJobWithContext<string>,
77
77
  allJobs: AllCatladderJobs,
78
- baseRules?: GitlabRule[]
78
+ baseRules?: GitlabRule[],
79
79
  ): [fullName: string, job: GitlabJobDef] => {
80
80
  const stage = envMode === "stagePerEnv" ? `${job.stage} ${env}` : job.stage;
81
81
 
@@ -107,11 +107,11 @@ export const makeGitlabJob = (
107
107
  n.job,
108
108
  n.componentName ?? componentName,
109
109
  env,
110
- allJobs
110
+ allJobs,
111
111
  ),
112
112
  artifacts: n.artifacts,
113
113
  }
114
- : getFullReferencedJobName(n, componentName, env, allJobs)
114
+ : getFullReferencedJobName(n, componentName, env, allJobs),
115
115
  ) // sort in a predictable manner for snapshot tests
116
116
  .sort((a, b) => getJobName(a).localeCompare(getJobName(b)));
117
117
 
@@ -122,7 +122,7 @@ export const makeGitlabJob = (
122
122
  const fullJobName = getFullJobName(
123
123
  name,
124
124
  componentName,
125
- envMode !== "none" ? env : undefined
125
+ envMode !== "none" ? env : undefined,
126
126
  );
127
127
 
128
128
  // backwards compatibility, some may still use KUBERNETES_CPU_REQUEST, KUBERNETES_MEMORY_REQUEST, etc. in variables.
@@ -137,29 +137,29 @@ export const makeGitlabJob = (
137
137
 
138
138
  const varsInjectScripts = collapseableSection(
139
139
  "injectvars",
140
- "Injecting variables"
140
+ "Injecting variables",
141
141
  )([
142
142
  ...getInjectVarsScript(
143
143
  // remove legacy variables
144
144
  Object.fromEntries(
145
145
  Object.entries(variables ?? {}).filter(
146
- ([key]) => !PIPELINE_RUNNER_VARIABLES.includes(key)
147
- )
148
- )
146
+ ([key]) => !PIPELINE_RUNNER_VARIABLES.includes(key),
147
+ ),
148
+ ),
149
149
  ),
150
150
  ]);
151
151
 
152
152
  const legacyRunnerVariables = Object.fromEntries(
153
153
  Object.entries(variables ?? {}).filter(([key]) =>
154
- PIPELINE_RUNNER_VARIABLES.includes(key)
155
- )
154
+ PIPELINE_RUNNER_VARIABLES.includes(key),
155
+ ),
156
156
  );
157
157
 
158
158
  if (Object.keys(legacyRunnerVariables).length > 0) {
159
159
  console.warn(
160
160
  `Legacy variables detected in ${fullJobName}: ${Object.keys(
161
- legacyRunnerVariables
162
- ).join(", ")}. Please move them to the runnerVariables key.`
161
+ legacyRunnerVariables,
162
+ ).join(", ")}. Please move them to the runnerVariables key.`,
163
163
  );
164
164
  }
165
165
  const rules = [
@@ -170,8 +170,8 @@ export const makeGitlabJob = (
170
170
  ...rule,
171
171
  }))
172
172
  : when
173
- ? [{ when }]
174
- : []),
173
+ ? [{ when }]
174
+ : []),
175
175
  ];
176
176
  const modified = addGitlabEnvironment(
177
177
  context,
@@ -194,7 +194,7 @@ export const makeGitlabJob = (
194
194
  },
195
195
  componentName,
196
196
  env,
197
- allJobs
197
+ allJobs,
198
198
  );
199
199
 
200
200
  const gitlabJob: GitlabJobDef = removeUndefined(modified);
@@ -208,7 +208,7 @@ const addGitlabEnvironment = (
208
208
  job: GitlabJobDef,
209
209
  componentName: string,
210
210
  env: string, // TODO: we could actually pull this from contxt
211
- allJobs: AllCatladderJobs
211
+ allJobs: AllCatladderJobs,
212
212
  ): GitlabJobDef => {
213
213
  if (!environment) {
214
214
  return job;
@@ -240,7 +240,7 @@ const addGitlabEnvironment = (
240
240
  on_stop,
241
241
  componentName,
242
242
  env,
243
- allJobs
243
+ allJobs,
244
244
  ),
245
245
  }
246
246
  : {}),
@@ -258,7 +258,7 @@ const addGitlabEnvironment = (
258
258
 
259
259
  export const createGitlabJobs = async (
260
260
  allJobs: AllCatladderJobs,
261
- baseRules?: GitlabRule[]
261
+ baseRules?: GitlabRule[],
262
262
  ): Promise<AllGitlabJobs> => {
263
263
  return Object.keys(allJobs).flatMap((componentName) => {
264
264
  const componentJobs = allJobs[componentName];
@@ -271,7 +271,7 @@ export const createGitlabJobs = async (
271
271
  env,
272
272
  job,
273
273
  allJobs,
274
- baseRules
274
+ baseRules,
275
275
  );
276
276
  return {
277
277
  name: fullJobName,
@@ -23,10 +23,10 @@ export function getPipelineTriggerForGitlabChildPipeline() {
23
23
  isMergeRequest || isHotfixBranch
24
24
  ? "mr"
25
25
  : isDefaultBranch
26
- ? "mainBranch"
27
- : isTaggedRelease
28
- ? "taggedRelease"
29
- : null;
26
+ ? "mainBranch"
27
+ : isTaggedRelease
28
+ ? "taggedRelease"
29
+ : null;
30
30
 
31
31
  if (!trigger) {
32
32
  throw new Error(
@@ -38,8 +38,8 @@ export function getPipelineTriggerForGitlabChildPipeline() {
38
38
  isTaggedRelease,
39
39
  },
40
40
  null,
41
- 2
42
- )
41
+ 2,
42
+ ),
43
43
  );
44
44
  }
45
45
  return trigger;
@@ -10,7 +10,7 @@ import {
10
10
 
11
11
  export const getPackageManagerInfo = async (
12
12
  config: Config,
13
- componentName: string
13
+ componentName: string,
14
14
  ): Promise<PackageManagerInfo> => {
15
15
  // currently only supports yarn
16
16
  const version = await getYarnVersion();
@@ -20,7 +20,7 @@ export const getPackageManagerInfo = async (
20
20
  const component = config.components[componentName];
21
21
  const workspaces = await getWorkspaces(isClassic);
22
22
  const currentWorkspace = workspaces.find((w) =>
23
- pathEqual(component.dir, w.location)
23
+ pathEqual(component.dir, w.location),
24
24
  );
25
25
  const componentIsInWorkspace = Boolean(currentWorkspace);
26
26
  const workspaceRoot = "."; // currently we assume the root folder, later on we might support nested workspaces
@@ -14,7 +14,7 @@ export const getYarnVersion = memoizee(
14
14
  async () => {
15
15
  return await execOrFail("yarn --version", "");
16
16
  },
17
- { promise: true }
17
+ { promise: true },
18
18
  );
19
19
  // export for mocking
20
20
  export const getWorkspaces = memoizee(
@@ -23,23 +23,23 @@ export const getWorkspaces = memoizee(
23
23
  ? Object.values(
24
24
  JSON.parse(
25
25
  JSON.parse(await execOrFail("yarn workspaces --json info", "{}"))
26
- ?.data ?? "{}"
27
- )
26
+ ?.data ?? "{}",
27
+ ),
28
28
  )
29
29
  : JSON.parse(
30
30
  `[${(await execOrFail("yarn workspaces list --json --verbose", ""))
31
31
  .trim()
32
32
  .split("\n")
33
- .join(",")}]`
33
+ .join(",")}]`,
34
34
  );
35
35
  },
36
- { promise: true }
36
+ { promise: true },
37
37
  );
38
38
 
39
39
  // recursivly get all workspace dependencies
40
40
  export const getWorkspaceDependencies = (
41
41
  ws: YarnWorkspace,
42
- allWorkspaces: YarnWorkspace[]
42
+ allWorkspaces: YarnWorkspace[],
43
43
  ): string[] => {
44
44
  return ws
45
45
  ? ([...ws.workspaceDependencies, ...ws.mismatchedWorkspaceDependencies]
@@ -47,7 +47,7 @@ export const getWorkspaceDependencies = (
47
47
  // we have to do this recursivly
48
48
 
49
49
  const otherWorkspace = allWorkspaces.find(
50
- (w) => w.location === location
50
+ (w) => w.location === location,
51
51
  );
52
52
 
53
53
  if (otherWorkspace) {
@@ -11,7 +11,7 @@ export const ALL_PIPELINE_TRIGGERS = [
11
11
  "mr",
12
12
  "taggedRelease",
13
13
  ] as const;
14
- export type PipelineTrigger = typeof ALL_PIPELINE_TRIGGERS[number];
14
+ export type PipelineTrigger = (typeof ALL_PIPELINE_TRIGGERS)[number];
15
15
 
16
16
  /**
17
17
  * all env types with their trigger.
@@ -43,7 +43,7 @@ export const ENV_TYPES = {
43
43
  export const getEnvTypesByTrigger = (trigger: PipelineTrigger) =>
44
44
  Object.entries(ENV_TYPES)
45
45
  .filter(([, e]) =>
46
- (e.triggers as readonly PipelineTrigger[]).includes(trigger)
46
+ (e.triggers as readonly PipelineTrigger[]).includes(trigger),
47
47
  )
48
48
  .map(([e]) => e as EnvType);
49
49
 
@@ -15,7 +15,7 @@ export type UnspecifiedEnvVars = Record<
15
15
  >;
16
16
 
17
17
  export type EnvironmentEnvVars<
18
- V extends UnspecifiedEnvVars = UnspecifiedEnvVars
18
+ V extends UnspecifiedEnvVars = UnspecifiedEnvVars,
19
19
  > = {
20
20
  envVars: V & UnspecifiedEnvVars;
21
21
  secretEnvVarKeys: SecretEnvVar[];
@@ -7,7 +7,7 @@ import type { PipelineType } from "./pipeline";
7
7
 
8
8
  export type EnvironmentContext<
9
9
  B extends BuildConfigType,
10
- D extends DeployConfigType
10
+ D extends DeployConfigType,
11
11
  > = {
12
12
  envConfigRaw: EnvConfigWithComponent;
13
13
  buildConfigRaw: false | BuildConfigGeneric<B>;
package/src/types/jobs.ts CHANGED
@@ -21,7 +21,7 @@ export const BASE_STAGES = [
21
21
  "rollback",
22
22
  "stop",
23
23
  ] as const;
24
- export type BaseStage = typeof BASE_STAGES[number];
24
+ export type BaseStage = (typeof BASE_STAGES)[number];
25
25
 
26
26
  export type CatladderJobNeed =
27
27
  | string
@@ -1,7 +1,7 @@
1
1
  export type PartialDeep<T> = T extends any[]
2
2
  ? T
3
3
  : T extends Record<string, any>
4
- ? {
5
- [P in keyof T]?: PartialDeep<T[P]>;
6
- }
7
- : T;
4
+ ? {
5
+ [P in keyof T]?: PartialDeep<T[P]>;
6
+ }
7
+ : T;
@@ -11,7 +11,7 @@ export const repeatOnFailure = (
11
11
  command: string,
12
12
  options: {
13
13
  pauseInSeconds: number;
14
- }
14
+ },
15
15
  ): string => {
16
16
  return `
17
17
  until ${command}
@@ -1,7 +1,7 @@
1
1
  import { isNil, mergeWith } from "lodash";
2
2
 
3
3
  export function notNil<TValue>(
4
- value: TValue | null | undefined
4
+ value: TValue | null | undefined,
5
5
  ): value is TValue {
6
6
  return value !== null && value !== undefined;
7
7
  }
@@ -14,6 +14,6 @@ export const mergeWithMergingArrays = <A, B>(obj1: A, obj2: B): A & B => {
14
14
  return mergeWith({}, obj1, obj2, (prop1, prop2) =>
15
15
  Array.isArray(prop1) && Array.isArray(prop2)
16
16
  ? [...prop1, ...prop2]
17
- : undefined
17
+ : undefined,
18
18
  );
19
19
  };
@@ -21,7 +21,7 @@ export const writeGeneratedFile = async (
21
21
  commentChar,
22
22
  }: {
23
23
  commentChar: string;
24
- }
24
+ },
25
25
  ) => {
26
26
  await writeFile(
27
27
  path,
@@ -29,7 +29,7 @@ export const writeGeneratedFile = async (
29
29
  [getAutoGeneratedHeader(commentChar), content].join("\n"),
30
30
  {
31
31
  encoding: "utf-8",
32
- }
32
+ },
33
33
  );
34
34
  };
35
35