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

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 (103) hide show
  1. package/dist/bundles/catenv/index.js +4 -8
  2. package/dist/bundles/cli/index.js +9 -17
  3. package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +1 -1
  4. package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +1 -1
  5. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -1
  6. package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/mongodb/utils/index.js.map +1 -1
  8. package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +1 -2
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +1 -2
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  13. package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
  14. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +1 -2
  15. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  16. package/dist/cli/src/gcloud/cloudSql/startProxy.js +1 -2
  17. package/dist/cli/src/gcloud/cloudSql/startProxy.js.map +1 -1
  18. package/dist/cli/src/utils/gitlab.js +1 -2
  19. package/dist/cli/src/utils/gitlab.js.map +1 -1
  20. package/dist/cli/src/utils/promise.js.map +1 -1
  21. package/dist/pipeline/src/context/getEnvironmentVariables.js +1 -2
  22. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  23. package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
  24. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  25. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +1 -2
  26. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
  27. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  28. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +1 -2
  29. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  30. package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
  31. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  32. package/dist/pipeline/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js.map +1 -1
  33. package/dist/pipeline/src/types/config.d.ts +1 -1
  34. package/dist/pipeline/src/types/jobs.d.ts +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/package.json +1 -1
  37. package/src/apps/catci/commands/security/auditDocument.ts +4 -4
  38. package/src/apps/catci/commands/security/commands.ts +14 -14
  39. package/src/apps/catci/commands/security/createSecurityAuditMergeRequest.ts +9 -9
  40. package/src/apps/catci/commands/security/evaluateSecurityAudit.ts +2 -2
  41. package/src/apps/catci/commands/security/topics.json +8 -16
  42. package/src/apps/catenv/printVariables.ts +3 -3
  43. package/src/apps/catenv/utils.ts +4 -4
  44. package/src/apps/catenv/writeDotEnvFiles.ts +1 -1
  45. package/src/apps/catenv/writeEnvDTs.ts +3 -3
  46. package/src/apps/cli/cli.ts +1 -1
  47. package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +1 -1
  48. package/src/apps/cli/commands/general/index.ts +2 -2
  49. package/src/apps/cli/commands/general/namespaceAutoCompletion.ts +1 -1
  50. package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +11 -11
  51. package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +3 -4
  52. package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +3 -4
  53. package/src/apps/cli/commands/mongodb/utils/index.ts +8 -10
  54. package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +6 -6
  55. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +7 -7
  56. package/src/apps/cli/commands/project/commandConfigSecrets.ts +22 -22
  57. package/src/apps/cli/commands/project/commandDeletePods.ts +1 -1
  58. package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
  59. package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
  60. package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +1 -1
  61. package/src/apps/cli/commands/project/commandGetShell.ts +1 -1
  62. package/src/apps/cli/commands/project/commandGitlabCi.ts +4 -4
  63. package/src/apps/cli/commands/project/commandListPods.ts +2 -2
  64. package/src/apps/cli/commands/project/commandMigrateHelm3.ts +6 -6
  65. package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
  66. package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +2 -2
  67. package/src/apps/cli/commands/project/commandOpenDashboard.ts +1 -1
  68. package/src/apps/cli/commands/project/commandOpenGit.ts +1 -1
  69. package/src/apps/cli/commands/project/commandOpenGrafana.ts +2 -2
  70. package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +2 -2
  71. package/src/apps/cli/commands/project/commandOpenLogs.ts +1 -1
  72. package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
  73. package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +1 -1
  74. package/src/apps/cli/commands/project/commandSecurityEvaluate.ts +2 -2
  75. package/src/apps/cli/commands/project/commandSetup.ts +1 -1
  76. package/src/apps/cli/commands/project/setup/index.ts +1 -1
  77. package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +5 -6
  78. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +5 -5
  79. package/src/apps/cli/commands/project/setup/setupContext.ts +4 -4
  80. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +14 -14
  81. package/src/apps/cli/commands/project/setup/setupTopic.ts +4 -9
  82. package/src/apps/cli/commands/project/utils/autocompletions.ts +1 -1
  83. package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -2
  84. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +5 -5
  85. package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +1 -1
  86. package/src/config/getProjectConfig.ts +11 -11
  87. package/src/gcloud/artifactsRegistry.ts +1 -1
  88. package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +2 -2
  89. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
  90. package/src/gcloud/cloudSql/copyDb.ts +1 -1
  91. package/src/gcloud/cloudSql/startProxy.ts +7 -7
  92. package/src/gcloud/enableServices.ts +2 -2
  93. package/src/gcloud/openDashboard.ts +1 -1
  94. package/src/gcloud/serviceAccounts.ts +8 -8
  95. package/src/kubernetes/index.ts +1 -1
  96. package/src/kubernetes/openKubernetesDashboards.ts +2 -2
  97. package/src/kubernetes/portForward.ts +2 -2
  98. package/src/types/child-process-promise.d.ts +3 -3
  99. package/src/utils/editAsFile.ts +2 -2
  100. package/src/utils/gitlab.ts +18 -18
  101. package/src/utils/log.ts +1 -1
  102. package/src/utils/portForwards.ts +1 -1
  103. package/src/utils/promise.ts +7 -5
@@ -42,7 +42,7 @@ export const getGitlabToken = async (vorpal: CommandInstance | null) => {
42
42
  if (!(await hasGitlabToken())) {
43
43
  if (!vorpal) {
44
44
  console.error(
45
- "⚠️ gitlab token missing, please run catladder to set it up"
45
+ "⚠️ gitlab token missing, please run catladder to set it up",
46
46
  );
47
47
  process.exit(1);
48
48
  }
@@ -56,7 +56,7 @@ export const doGitlabRequest = async <T = any>(
56
56
  vorpal: CommandInstance | null,
57
57
  path: string,
58
58
  data: any = undefined,
59
- method: Method = "GET"
59
+ method: Method = "GET",
60
60
  ): Promise<T> => {
61
61
  const rootToken = await getGitlabToken(vorpal);
62
62
 
@@ -84,23 +84,23 @@ export const doGitlabRequest = async <T = any>(
84
84
  throw new Error(
85
85
  `Could not send request to gitlab api ${path}: ${result.status} "${
86
86
  result.statusText
87
- }".\nResponse: ${JSON.stringify(await result.json(), null, 2)}`
87
+ }".\nResponse: ${JSON.stringify(await result.json(), null, 2)}`,
88
88
  );
89
89
  };
90
90
 
91
91
  export const getProjectInfo = async (
92
- vorpal: CommandInstance | null
92
+ vorpal: CommandInstance | null,
93
93
  ): Promise<{ id: string; web_url: string }> => {
94
94
  const gitRemoteOriginUrl = (
95
95
  await exec("git config --get remote.origin.url")
96
96
  ).stdout.trim();
97
97
  const projectPath =
98
98
  /(https:\/\/|git@)git\.panter\.ch[:/]([^.]*)(\.git)?/g.exec(
99
- gitRemoteOriginUrl
99
+ gitRemoteOriginUrl,
100
100
  );
101
101
  const project = await doGitlabRequest(
102
102
  vorpal,
103
- `projects/${encodeURIComponent(projectPath[2])}`
103
+ `projects/${encodeURIComponent(projectPath[2])}`,
104
104
  );
105
105
  return project;
106
106
  };
@@ -123,19 +123,19 @@ export const getAllVariables = memoizee(
123
123
  result = await doGitlabRequest(
124
124
  vorpal,
125
125
  // 100 is max page size
126
- `projects/${id}/variables?per_page=100&page=${page}`
126
+ `projects/${id}/variables?per_page=100&page=${page}`,
127
127
  );
128
128
  page++;
129
129
  all = [...all, ...result];
130
130
  } while (result?.length > 0);
131
131
  return all;
132
132
  },
133
- { promise: true }
133
+ { promise: true },
134
134
  );
135
135
 
136
136
  export const getVariableValueByRawName = async (
137
137
  vorpal: CommandInstance,
138
- rawName: string
138
+ rawName: string,
139
139
  ) => {
140
140
  const allVariables = await getAllVariables(vorpal);
141
141
  return allVariables.find((v) => v.key === rawName)?.value;
@@ -150,7 +150,7 @@ const createVariable = async (
150
150
  key: string,
151
151
  value: string,
152
152
  masked = true,
153
- environment_scope = "*"
153
+ environment_scope = "*",
154
154
  ) => {
155
155
  return await doGitlabRequest(
156
156
  vorpal,
@@ -161,7 +161,7 @@ const createVariable = async (
161
161
  masked: masked && isMaskable(value),
162
162
  environment_scope,
163
163
  },
164
- "POST"
164
+ "POST",
165
165
  );
166
166
  };
167
167
 
@@ -170,7 +170,7 @@ const updateVariable = async (
170
170
  projectId: string,
171
171
  key: string,
172
172
  value: string,
173
- masked = true
173
+ masked = true,
174
174
  ) => {
175
175
  return await doGitlabRequest(
176
176
  vorpal,
@@ -179,20 +179,20 @@ const updateVariable = async (
179
179
  value,
180
180
  masked: masked && isMaskable(value),
181
181
  },
182
- "PUT"
182
+ "PUT",
183
183
  );
184
184
  };
185
185
 
186
186
  const deleteVariable = async (
187
187
  vorpal: CommandInstance,
188
188
  projectId: string,
189
- key: string
189
+ key: string,
190
190
  ) => {
191
191
  return await doGitlabRequest(
192
192
  vorpal,
193
193
  `projects/${projectId}/variables/${key}`,
194
194
  undefined,
195
- "DELETE"
195
+ "DELETE",
196
196
  );
197
197
  };
198
198
 
@@ -233,7 +233,7 @@ const getAllCatladderEnvVarsInGitlab = async (vorpal: CommandInstance) => {
233
233
  }
234
234
 
235
235
  return acc;
236
- }, {})
236
+ }, {}),
237
237
  );
238
238
  return allVariables;
239
239
  };
@@ -260,7 +260,7 @@ export const upsertAllVariables = async (
260
260
  env: string,
261
261
  componentName: string,
262
262
  backup = true,
263
- masked = true // FIXME: would be better to have this per variable
263
+ masked = true, // FIXME: would be better to have this per variable
264
264
  ): Promise<void> => {
265
265
  const { id } = await getProjectInfo(vorpal);
266
266
 
@@ -286,7 +286,7 @@ export const upsertAllVariables = async (
286
286
  getBackupKey(fullKey, new Date().getTime()),
287
287
  oldValue,
288
288
  masked,
289
- "_backup"
289
+ "_backup",
290
290
  );
291
291
  }
292
292
  } else {
package/src/utils/log.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export const logError = (
2
2
  cmd: any,
3
3
  message: string,
4
- additionalMessage?: any
4
+ additionalMessage?: any,
5
5
  ) => {
6
6
  cmd.log("");
7
7
  cmd.log(`[ERROR] 🙀 :${message}`);
@@ -34,7 +34,7 @@ const addPortForward = (name: string, portForward: PortForward) => {
34
34
 
35
35
  export const startPortForwardCommand = async (
36
36
  name: string,
37
- command: string
37
+ command: string,
38
38
  ) => {
39
39
  // stop if already there
40
40
  await stopPortForward(name);
@@ -1,11 +1,13 @@
1
1
  export async function filter<T>(
2
2
  arr: T[],
3
- iterator: (item: T) => Promise<boolean>
3
+ iterator: (item: T) => Promise<boolean>,
4
4
  ) {
5
5
  const fail = Symbol("fail");
6
- return ((await Promise.all(
7
- arr.map(async item => ((await iterator(item)) ? item : fail))
8
- )).filter(i => i !== fail) as any) as Promise<T[]>;
6
+ return (
7
+ await Promise.all(
8
+ arr.map(async (item) => ((await iterator(item)) ? item : fail)),
9
+ )
10
+ ).filter((i) => i !== fail) as any as Promise<T[]>;
9
11
  }
10
12
 
11
- export const delay = (ms: number) => new Promise(res => setTimeout(res, ms));
13
+ export const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));