@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.
- package/dist/bundles/catenv/index.js +4 -8
- package/dist/bundles/cli/index.js +9 -17
- package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/general/namespaceAutoCompletion.js +1 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoGetShell.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/mongodb/projectMongoPortForward.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/mongodb/utils/index.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupAccessTokens.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +1 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +1 -2
- package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/setup/setupTopic.js.map +1 -1
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +1 -2
- package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/cli/src/gcloud/cloudSql/startProxy.js +1 -2
- package/dist/cli/src/gcloud/cloudSql/startProxy.js.map +1 -1
- package/dist/cli/src/utils/gitlab.js +1 -2
- package/dist/cli/src/utils/gitlab.js.map +1 -1
- package/dist/cli/src/utils/promise.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.js +1 -2
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
- package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +1 -2
- package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +1 -2
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
- package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
- package/dist/pipeline/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js.map +1 -1
- package/dist/pipeline/src/types/config.d.ts +1 -1
- package/dist/pipeline/src/types/jobs.d.ts +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/apps/catci/commands/security/auditDocument.ts +4 -4
- package/src/apps/catci/commands/security/commands.ts +14 -14
- package/src/apps/catci/commands/security/createSecurityAuditMergeRequest.ts +9 -9
- package/src/apps/catci/commands/security/evaluateSecurityAudit.ts +2 -2
- package/src/apps/catci/commands/security/topics.json +8 -16
- package/src/apps/catenv/printVariables.ts +3 -3
- package/src/apps/catenv/utils.ts +4 -4
- package/src/apps/catenv/writeDotEnvFiles.ts +1 -1
- package/src/apps/catenv/writeEnvDTs.ts +3 -3
- package/src/apps/cli/cli.ts +1 -1
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +1 -1
- package/src/apps/cli/commands/general/index.ts +2 -2
- package/src/apps/cli/commands/general/namespaceAutoCompletion.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +11 -11
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +3 -4
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +3 -4
- package/src/apps/cli/commands/mongodb/utils/index.ts +8 -10
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +6 -6
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +7 -7
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +22 -22
- package/src/apps/cli/commands/project/commandDeletePods.ts +1 -1
- package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
- package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +1 -1
- package/src/apps/cli/commands/project/commandGetShell.ts +1 -1
- package/src/apps/cli/commands/project/commandGitlabCi.ts +4 -4
- package/src/apps/cli/commands/project/commandListPods.ts +2 -2
- package/src/apps/cli/commands/project/commandMigrateHelm3.ts +6 -6
- package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGit.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGrafana.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +2 -2
- package/src/apps/cli/commands/project/commandOpenLogs.ts +1 -1
- package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
- package/src/apps/cli/commands/project/commandSecretsClearBackups.ts +1 -1
- package/src/apps/cli/commands/project/commandSecurityEvaluate.ts +2 -2
- package/src/apps/cli/commands/project/commandSetup.ts +1 -1
- package/src/apps/cli/commands/project/setup/index.ts +1 -1
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +5 -6
- package/src/apps/cli/commands/project/setup/setupCloudRun.ts +5 -5
- package/src/apps/cli/commands/project/setup/setupContext.ts +4 -4
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +14 -14
- package/src/apps/cli/commands/project/setup/setupTopic.ts +4 -9
- package/src/apps/cli/commands/project/utils/autocompletions.ts +1 -1
- package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -2
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +5 -5
- package/src/apps/cli/utils/getGoogleAuthUserNumber.ts +1 -1
- package/src/config/getProjectConfig.ts +11 -11
- package/src/gcloud/artifactsRegistry.ts +1 -1
- package/src/gcloud/cloudRun/getCloudRunDomainSuffix.ts +2 -2
- package/src/gcloud/cloudRun/openCloudRunDashboards.ts +2 -2
- package/src/gcloud/cloudSql/copyDb.ts +1 -1
- package/src/gcloud/cloudSql/startProxy.ts +7 -7
- package/src/gcloud/enableServices.ts +2 -2
- package/src/gcloud/openDashboard.ts +1 -1
- package/src/gcloud/serviceAccounts.ts +8 -8
- package/src/kubernetes/index.ts +1 -1
- package/src/kubernetes/openKubernetesDashboards.ts +2 -2
- package/src/kubernetes/portForward.ts +2 -2
- package/src/types/child-process-promise.d.ts +3 -3
- package/src/utils/editAsFile.ts +2 -2
- package/src/utils/gitlab.ts +18 -18
- package/src/utils/log.ts +1 -1
- package/src/utils/portForwards.ts +1 -1
- package/src/utils/promise.ts +7 -5
package/src/utils/gitlab.ts
CHANGED
|
@@ -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
package/src/utils/promise.ts
CHANGED
|
@@ -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 (
|
|
7
|
-
|
|
8
|
-
|
|
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));
|