@catladder/cli 1.145.0 → 1.146.1
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 +1 -1
- package/dist/bundles/cli/index.js +1 -1
- package/dist/cli/src/apps/catci/commands/security/evaluateSecurityAudit.js.map +1 -1
- package/dist/cli/src/apps/catenv/catenv.js +8 -12
- package/dist/cli/src/apps/catenv/catenv.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.d.ts +1 -1
- package/dist/cli/src/utils/gitlab.js +38 -26
- 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/generatePipelineFiles.js +5 -5
- package/dist/pipeline/src/pipeline/generatePipelineFiles.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 +2 -2
- 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/catenv.ts +8 -7
- 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 +43 -27
- package/src/utils/log.ts +1 -1
- package/src/utils/portForwards.ts +1 -1
- package/src/utils/promise.ts +7 -5
|
@@ -14,7 +14,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
14
14
|
vorpal
|
|
15
15
|
.command(
|
|
16
16
|
"project-cloud-sql-restore-db",
|
|
17
|
-
"restores a project db from one source to another target"
|
|
17
|
+
"restores a project db from one source to another target",
|
|
18
18
|
)
|
|
19
19
|
.action(async function restoreDb() {
|
|
20
20
|
const envs = await envAndComponents();
|
|
@@ -31,13 +31,13 @@ export default async (vorpal: Vorpal) =>
|
|
|
31
31
|
|
|
32
32
|
const sourceContext = await getPipelineContextByChoice(
|
|
33
33
|
sourceEnv,
|
|
34
|
-
sourceComponent
|
|
34
|
+
sourceComponent,
|
|
35
35
|
);
|
|
36
36
|
|
|
37
37
|
const sourceEnvVars = await getEnvVarsResolved(
|
|
38
38
|
this,
|
|
39
39
|
sourceContext.environment.shortName,
|
|
40
|
-
sourceContext.componentName
|
|
40
|
+
sourceContext.componentName,
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
let sourceProxy: CloudSqlBackgroundProxy;
|
|
@@ -94,13 +94,13 @@ export default async (vorpal: Vorpal) =>
|
|
|
94
94
|
|
|
95
95
|
const targetContext = await getPipelineContextByChoice(
|
|
96
96
|
targetEnv,
|
|
97
|
-
targetComponent
|
|
97
|
+
targetComponent,
|
|
98
98
|
);
|
|
99
99
|
|
|
100
100
|
const targetEnvVars = await getEnvVarsResolved(
|
|
101
101
|
this,
|
|
102
102
|
targetContext.environment.shortName,
|
|
103
|
-
targetContext.componentName
|
|
103
|
+
targetContext.componentName,
|
|
104
104
|
);
|
|
105
105
|
|
|
106
106
|
if (targetEnv === "local") {
|
|
@@ -141,7 +141,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
141
141
|
|
|
142
142
|
if (targetContext.environment.envType === "prod") {
|
|
143
143
|
this.log(
|
|
144
|
-
`\n🚨 You are overriding a production environment. Please type in ${targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME} to continue\n\n
|
|
144
|
+
`\n🚨 You are overriding a production environment. Please type in ${targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME} to continue\n\n`,
|
|
145
145
|
);
|
|
146
146
|
const { confirmInstance } = await this.prompt({
|
|
147
147
|
type: "input",
|
|
@@ -35,7 +35,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
35
35
|
|
|
36
36
|
if (env === "review") {
|
|
37
37
|
vorpal.log(
|
|
38
|
-
"⚠️ connection string does not include mr information on review environments"
|
|
38
|
+
"⚠️ connection string does not include mr information on review environments",
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
41
|
if (isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
@@ -63,11 +63,11 @@ export default async (vorpal: Vorpal) =>
|
|
|
63
63
|
this.log("connection strings:");
|
|
64
64
|
this.log("");
|
|
65
65
|
this.log(
|
|
66
|
-
`DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@localhost:${localPort}/${DB_NAME}?schema=public
|
|
66
|
+
`DATABASE_URL=postgresql://${DB_USER}:${DB_PASSWORD}@localhost:${localPort}/${DB_NAME}?schema=public`,
|
|
67
67
|
);
|
|
68
68
|
this.log("");
|
|
69
69
|
this.log(
|
|
70
|
-
`DATABASE_JDBC_URL=jdbc:postgresql://localhost:${localPort}/${DB_NAME}?schema=public&user=${DB_USER}&password=${DB_PASSWORD}
|
|
70
|
+
`DATABASE_JDBC_URL=jdbc:postgresql://localhost:${localPort}/${DB_NAME}?schema=public&user=${DB_USER}&password=${DB_PASSWORD}`,
|
|
71
71
|
);
|
|
72
72
|
this.log("");
|
|
73
73
|
|
|
@@ -79,7 +79,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
79
79
|
|
|
80
80
|
const getProxyInfoForKubernetes = async (
|
|
81
81
|
vorpal: CommandInstance,
|
|
82
|
-
context: Context
|
|
82
|
+
context: Context,
|
|
83
83
|
): Promise<ProxyInfo> => {
|
|
84
84
|
if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
|
|
85
85
|
throw new Error("unsupported");
|
|
@@ -88,7 +88,7 @@ const getProxyInfoForKubernetes = async (
|
|
|
88
88
|
const envVars = await getEnvVarsResolved(
|
|
89
89
|
vorpal,
|
|
90
90
|
context.environment.shortName,
|
|
91
|
-
context.componentName
|
|
91
|
+
context.componentName,
|
|
92
92
|
);
|
|
93
93
|
// bit hacky, would be nicer if we would also declare this through env vars
|
|
94
94
|
const cloudSqlValues = createKubernetesCloudsqlBaseValues(context);
|
|
@@ -109,7 +109,7 @@ const getProxyInfoForKubernetes = async (
|
|
|
109
109
|
|
|
110
110
|
const getProxyInfoForCloudRun = async (
|
|
111
111
|
vorpal: CommandInstance,
|
|
112
|
-
context: Context
|
|
112
|
+
context: Context,
|
|
113
113
|
): Promise<ProxyInfo> => {
|
|
114
114
|
if (
|
|
115
115
|
!isOfDeployType(context.componentConfig.deploy, "google-cloudrun") ||
|
|
@@ -121,7 +121,7 @@ const getProxyInfoForCloudRun = async (
|
|
|
121
121
|
const envVars = await getEnvVarsResolved(
|
|
122
122
|
vorpal,
|
|
123
123
|
context.environment.shortName,
|
|
124
|
-
context.componentName
|
|
124
|
+
context.componentName,
|
|
125
125
|
);
|
|
126
126
|
|
|
127
127
|
const DB_PASSWORD = envVars?.DB_PASSWORD;
|
|
@@ -37,21 +37,21 @@ const resolveJson = (v: Vars) =>
|
|
|
37
37
|
} catch (e) {
|
|
38
38
|
return [key, value];
|
|
39
39
|
}
|
|
40
|
-
})
|
|
40
|
+
}),
|
|
41
41
|
),
|
|
42
|
-
])
|
|
42
|
+
]),
|
|
43
43
|
),
|
|
44
44
|
];
|
|
45
|
-
})
|
|
45
|
+
}),
|
|
46
46
|
);
|
|
47
47
|
|
|
48
48
|
const getSecretEnvVarKeysToConfigure = async (
|
|
49
49
|
env: string,
|
|
50
|
-
componentName: string
|
|
50
|
+
componentName: string,
|
|
51
51
|
) => {
|
|
52
52
|
const { secretEnvVarKeys, jobOnlyVars } = await getEnvironment(
|
|
53
53
|
env,
|
|
54
|
-
componentName
|
|
54
|
+
componentName,
|
|
55
55
|
);
|
|
56
56
|
return [
|
|
57
57
|
...jobOnlyVars.build.secretEnvVarKeys,
|
|
@@ -64,18 +64,18 @@ const getSecretEnvVarKeysToConfigure = async (
|
|
|
64
64
|
const getEnvVarsToEdit = async (
|
|
65
65
|
instance: CommandInstance,
|
|
66
66
|
env: string,
|
|
67
|
-
componentName: string
|
|
67
|
+
componentName: string,
|
|
68
68
|
) => {
|
|
69
69
|
const secretEnvVarKeys = await getSecretEnvVarKeysToConfigure(
|
|
70
70
|
env,
|
|
71
|
-
componentName
|
|
71
|
+
componentName,
|
|
72
72
|
);
|
|
73
73
|
|
|
74
74
|
const normalEnvVars = await getEnvVarsResolved(instance, env, componentName);
|
|
75
75
|
const jobOnlyEnvVars = await getJobOnlyEnvVarsResolved(
|
|
76
76
|
instance,
|
|
77
77
|
env,
|
|
78
|
-
componentName
|
|
78
|
+
componentName,
|
|
79
79
|
);
|
|
80
80
|
const allEnvVars = {
|
|
81
81
|
...normalEnvVars,
|
|
@@ -88,14 +88,14 @@ const getEnvVarsToEdit = async (
|
|
|
88
88
|
const variableIsNotSet =
|
|
89
89
|
value === "$" + getSecretVarName(env, componentName, key);
|
|
90
90
|
return [key, variableIsNotSet ? "🚨 FILL ME" : value];
|
|
91
|
-
})
|
|
91
|
+
}),
|
|
92
92
|
);
|
|
93
93
|
};
|
|
94
94
|
const doItFor = async (
|
|
95
95
|
instance: CommandInstance,
|
|
96
96
|
envAndComponents: {
|
|
97
97
|
[componentName: string]: string[];
|
|
98
|
-
}
|
|
98
|
+
},
|
|
99
99
|
) => {
|
|
100
100
|
let valuesToEdit: Vars = Object.fromEntries(
|
|
101
101
|
await Promise.all(
|
|
@@ -106,11 +106,11 @@ const doItFor = async (
|
|
|
106
106
|
envs.map(async (env) => [
|
|
107
107
|
env,
|
|
108
108
|
await getEnvVarsToEdit(instance, env, componentName),
|
|
109
|
-
])
|
|
110
|
-
)
|
|
109
|
+
]),
|
|
110
|
+
),
|
|
111
111
|
),
|
|
112
|
-
])
|
|
113
|
-
)
|
|
112
|
+
]),
|
|
113
|
+
),
|
|
114
114
|
);
|
|
115
115
|
let hasErrors = true;
|
|
116
116
|
while (hasErrors) {
|
|
@@ -121,11 +121,11 @@ const doItFor = async (
|
|
|
121
121
|
|
|
122
122
|
${Object.entries(envAndComponents)
|
|
123
123
|
.map(
|
|
124
|
-
([componentName, envs]) => `- ${componentName}: ${envs.join(", ")}
|
|
124
|
+
([componentName, envs]) => `- ${componentName}: ${envs.join(", ")}`,
|
|
125
125
|
)
|
|
126
126
|
.join("\n")}
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
`,
|
|
129
129
|
);
|
|
130
130
|
// check for errors
|
|
131
131
|
hasErrors = false;
|
|
@@ -137,7 +137,7 @@ const doItFor = async (
|
|
|
137
137
|
// check whether newValues have the exact number of keys
|
|
138
138
|
const secretEnvVarKeys = await getSecretEnvVarKeysToConfigure(
|
|
139
139
|
env,
|
|
140
|
-
componentName
|
|
140
|
+
componentName,
|
|
141
141
|
);
|
|
142
142
|
|
|
143
143
|
const extranous = difference(usedKeys, secretEnvVarKeys);
|
|
@@ -146,7 +146,7 @@ const doItFor = async (
|
|
|
146
146
|
if (extranous.length > 0 || missing.length > 0) {
|
|
147
147
|
instance.log("");
|
|
148
148
|
instance.log(
|
|
149
|
-
`😿 Oh no! There is something wrong with "${componentName}"
|
|
149
|
+
`😿 Oh no! There is something wrong with "${componentName}"`,
|
|
150
150
|
);
|
|
151
151
|
instance.log("");
|
|
152
152
|
if (extranous.length > 0) {
|
|
@@ -186,7 +186,7 @@ const doItFor = async (
|
|
|
186
186
|
instance,
|
|
187
187
|
valuesToEdit[componentName][env],
|
|
188
188
|
env,
|
|
189
|
-
componentName
|
|
189
|
+
componentName,
|
|
190
190
|
);
|
|
191
191
|
instance.log("");
|
|
192
192
|
instance.log("✅ " + env + ":" + componentName);
|
|
@@ -199,7 +199,7 @@ const doItFor = async (
|
|
|
199
199
|
|
|
200
200
|
export const projectConfigSecrets = async (
|
|
201
201
|
vorpal: CommandInstance,
|
|
202
|
-
envComponent?: string
|
|
202
|
+
envComponent?: string,
|
|
203
203
|
) => {
|
|
204
204
|
if (!envComponent) {
|
|
205
205
|
const allEnvAndcomponents = await getAllComponentsWithAllEnvsHierarchical();
|
|
@@ -212,7 +212,7 @@ export const projectConfigSecrets = async (
|
|
|
212
212
|
const components = await getProjectComponents();
|
|
213
213
|
await doItFor(
|
|
214
214
|
vorpal,
|
|
215
|
-
Object.fromEntries(components.map((c) => [c, [env]]))
|
|
215
|
+
Object.fromEntries(components.map((c) => [c, [env]])),
|
|
216
216
|
);
|
|
217
217
|
}
|
|
218
218
|
if (componentName) {
|
|
@@ -227,7 +227,7 @@ export default async (vorpal: Vorpal) => {
|
|
|
227
227
|
vorpal
|
|
228
228
|
.command(
|
|
229
229
|
"project-config-secrets [envComponent]",
|
|
230
|
-
"setup/update secrets stored in pass"
|
|
230
|
+
"setup/update secrets stored in pass",
|
|
231
231
|
)
|
|
232
232
|
.autocomplete(await allEnvsAndAllComponents())
|
|
233
233
|
.action(async function ({ envComponent }) {
|
|
@@ -27,7 +27,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
this.log(
|
|
30
|
-
"the following pods will be DELETED 🙀 (and therefore restarted 😸)"
|
|
30
|
+
"the following pods will be DELETED 🙀 (and therefore restarted 😸)",
|
|
31
31
|
);
|
|
32
32
|
this.log("");
|
|
33
33
|
selectedPodNames.forEach((n: string) => this.log(n));
|
|
@@ -7,7 +7,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
7
7
|
vorpal
|
|
8
8
|
.command(
|
|
9
9
|
"project-delete <envComponent>",
|
|
10
|
-
"deletes a environment of a project (it deletes the namespace)"
|
|
10
|
+
"deletes a environment of a project (it deletes the namespace)",
|
|
11
11
|
)
|
|
12
12
|
.autocomplete(await envAndComponents())
|
|
13
13
|
.action(async function ({ envComponent }) {
|
|
@@ -13,6 +13,6 @@ export default async (vorpal: Vorpal) =>
|
|
|
13
13
|
const { env, componentName } = parseChoice(envComponent);
|
|
14
14
|
const envvars = await getEnvVarsResolved(this, env, componentName);
|
|
15
15
|
Object.keys(envvars).forEach((key) =>
|
|
16
|
-
this.log(`${key}: ${envvars[key]}`)
|
|
16
|
+
this.log(`${key}: ${envvars[key]}`),
|
|
17
17
|
);
|
|
18
18
|
});
|
|
@@ -5,7 +5,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
5
5
|
vorpal
|
|
6
6
|
.command(
|
|
7
7
|
"project-get-my-total-worktime",
|
|
8
|
-
"show the total worktime that you spent on a project"
|
|
8
|
+
"show the total worktime that you spent on a project",
|
|
9
9
|
)
|
|
10
10
|
.action(async () => {
|
|
11
11
|
await spawn("sh", ["-c", "curl -s -L http://bit.ly/3VQEKNq | bash"], {
|
|
@@ -11,7 +11,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
11
11
|
vorpal
|
|
12
12
|
.command(
|
|
13
13
|
"project-get-shell <envComponent>",
|
|
14
|
-
"get a shell to a pod in the environment"
|
|
14
|
+
"get a shell to a pod in the environment",
|
|
15
15
|
)
|
|
16
16
|
.autocomplete(await envAndComponents())
|
|
17
17
|
.action(async function ({ envComponent }) {
|
|
@@ -40,7 +40,7 @@ const promptJob = async (vorpal: CommandInstance, projectId: any, ctx: any) => {
|
|
|
40
40
|
|
|
41
41
|
const jobsToName = (jo: any[]) =>
|
|
42
42
|
jo.map(
|
|
43
|
-
(j: any) => `${j.ref}-${j.name}-${j.user.username}-${j.status}-${j.id}
|
|
43
|
+
(j: any) => `${j.ref}-${j.name}-${j.user.username}-${j.status}-${j.id}`,
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const preferredJobs = jobs.filter((j: any) => j.commit.id === commitId);
|
|
@@ -84,13 +84,13 @@ export default async (vorpal: Vorpal) => {
|
|
|
84
84
|
while (!finished) {
|
|
85
85
|
const trace = await exec(
|
|
86
86
|
`curl -s --header "PRIVATE-TOKEN: ${await getGitlabToken(
|
|
87
|
-
this
|
|
88
|
-
)}" "https://git.panter.ch/api/v4/projects/${projectId}/jobs/${id}/trace"
|
|
87
|
+
this,
|
|
88
|
+
)}" "https://git.panter.ch/api/v4/projects/${projectId}/jobs/${id}/trace"`,
|
|
89
89
|
);
|
|
90
90
|
|
|
91
91
|
const job = await doGitlabRequest(
|
|
92
92
|
this,
|
|
93
|
-
`projects/${projectId}/jobs/${id}
|
|
93
|
+
`projects/${projectId}/jobs/${id}`,
|
|
94
94
|
);
|
|
95
95
|
|
|
96
96
|
if (trace.stdout) {
|
|
@@ -14,7 +14,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
14
14
|
const pods = await getProjectPods(envComponent);
|
|
15
15
|
this.log(
|
|
16
16
|
stringify(
|
|
17
|
-
pods.map((p) => pick(p, ["metadata.name", "status.startTime"]))
|
|
18
|
-
)
|
|
17
|
+
pods.map((p) => pick(p, ["metadata.name", "status.startTime"])),
|
|
18
|
+
),
|
|
19
19
|
);
|
|
20
20
|
});
|
|
@@ -16,12 +16,12 @@ export default async (vorpal: Vorpal) =>
|
|
|
16
16
|
vorpal
|
|
17
17
|
.command(
|
|
18
18
|
"project-migrate-helm3 <envComponent>",
|
|
19
|
-
"Do manual step for helm2 to helm3 migration"
|
|
19
|
+
"Do manual step for helm2 to helm3 migration",
|
|
20
20
|
)
|
|
21
21
|
.autocomplete(
|
|
22
22
|
(await envAndComponents()).filter(
|
|
23
|
-
(e) => !e.startsWith("local") && !e.startsWith("review")
|
|
24
|
-
)
|
|
23
|
+
(e) => !e.startsWith("local") && !e.startsWith("review"),
|
|
24
|
+
),
|
|
25
25
|
)
|
|
26
26
|
.action(async function ({ envComponent }) {
|
|
27
27
|
try {
|
|
@@ -34,10 +34,10 @@ export default async (vorpal: Vorpal) =>
|
|
|
34
34
|
}
|
|
35
35
|
try {
|
|
36
36
|
await exec(
|
|
37
|
-
"helm plugin install https://github.com/helm/helm-2to3.git"
|
|
37
|
+
"helm plugin install https://github.com/helm/helm-2to3.git",
|
|
38
38
|
);
|
|
39
39
|
this.log(
|
|
40
|
-
"successfully installed plugin https://github.com/helm/helm-2to3.git"
|
|
40
|
+
"successfully installed plugin https://github.com/helm/helm-2to3.git",
|
|
41
41
|
);
|
|
42
42
|
} catch (e) {
|
|
43
43
|
// ignore
|
|
@@ -51,7 +51,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
51
51
|
this.log("migrating now... 😼. This may take a moment");
|
|
52
52
|
this.log("");
|
|
53
53
|
const r = await exec(
|
|
54
|
-
`helm 2to3 convert --delete-v2-releases ${releaseName}
|
|
54
|
+
`helm 2to3 convert --delete-v2-releases ${releaseName}`,
|
|
55
55
|
);
|
|
56
56
|
this.log(r);
|
|
57
57
|
} catch (e) {
|
|
@@ -6,7 +6,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
6
6
|
vorpal
|
|
7
7
|
.command(
|
|
8
8
|
"project-namespace <envComponent>",
|
|
9
|
-
"show namespace of local project"
|
|
9
|
+
"show namespace of local project",
|
|
10
10
|
)
|
|
11
11
|
.autocomplete(await envAndComponents())
|
|
12
12
|
.action(async function ({ envComponent }) {
|
|
@@ -15,7 +15,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
15
15
|
vorpal
|
|
16
16
|
.command(
|
|
17
17
|
"project-check-costs <envComponent>",
|
|
18
|
-
"Shows you how much you're spending"
|
|
18
|
+
"Shows you how much you're spending",
|
|
19
19
|
)
|
|
20
20
|
.autocomplete(await envAndComponents())
|
|
21
21
|
.action(async function ({ envComponent }) {
|
|
@@ -26,7 +26,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
26
26
|
"deployment/kubecost-cost-analyzer",
|
|
27
27
|
GRAFANA_PROXY_LOCAL_PORT,
|
|
28
28
|
GRAFANA_PROXY_TARGET_PORT,
|
|
29
|
-
"kubecost"
|
|
29
|
+
"kubecost",
|
|
30
30
|
);
|
|
31
31
|
open(url);
|
|
32
32
|
});
|
|
@@ -13,7 +13,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
13
13
|
vorpal
|
|
14
14
|
.command(
|
|
15
15
|
"project-open-dashboard <envComponent>",
|
|
16
|
-
"open an apps dashboard (kubernetes or cloudrun)"
|
|
16
|
+
"open an apps dashboard (kubernetes or cloudrun)",
|
|
17
17
|
)
|
|
18
18
|
.autocomplete(await envAndComponents())
|
|
19
19
|
.action(async function ({ envComponent }) {
|
|
@@ -14,7 +14,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
14
14
|
vorpal
|
|
15
15
|
.command(
|
|
16
16
|
"project-open-grafana <envComponent>",
|
|
17
|
-
"open Grafana dashboard for your namespace"
|
|
17
|
+
"open Grafana dashboard for your namespace",
|
|
18
18
|
)
|
|
19
19
|
.autocomplete(await envAndComponents())
|
|
20
20
|
.action(async function ({ envComponent }) {
|
|
@@ -25,7 +25,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
25
25
|
"deployment/kubecost-cost-analyzer",
|
|
26
26
|
GRAFANA_PROXY_LOCAL_PORT,
|
|
27
27
|
GRAFANA_PROXY_TARGET_PORT,
|
|
28
|
-
"kubecost"
|
|
28
|
+
"kubecost",
|
|
29
29
|
);
|
|
30
30
|
open(url);
|
|
31
31
|
});
|
|
@@ -15,7 +15,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
15
15
|
vorpal
|
|
16
16
|
.command(
|
|
17
17
|
"project-open-grafana-pod <envComponent>",
|
|
18
|
-
"open Grafana dashboard for a specific pod"
|
|
18
|
+
"open Grafana dashboard for a specific pod",
|
|
19
19
|
)
|
|
20
20
|
.autocomplete(await envAndComponents())
|
|
21
21
|
.action(async function ({ envComponent }) {
|
|
@@ -37,7 +37,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
37
37
|
"deployment/kubecost-cost-analyzer",
|
|
38
38
|
GRAFANA_PROXY_LOCAL_PORT,
|
|
39
39
|
GRAFANA_PROXY_TARGET_PORT,
|
|
40
|
-
"kubecost"
|
|
40
|
+
"kubecost",
|
|
41
41
|
);
|
|
42
42
|
open(url);
|
|
43
43
|
});
|
|
@@ -10,7 +10,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
10
10
|
vorpal
|
|
11
11
|
.command(
|
|
12
12
|
"project-open-logs <envComponent>",
|
|
13
|
-
"open google cloud logs (stackdriver logs)"
|
|
13
|
+
"open google cloud logs (stackdriver logs)",
|
|
14
14
|
)
|
|
15
15
|
.autocomplete(await envAndComponents())
|
|
16
16
|
.action(async function ({ envComponent }) {
|
|
@@ -7,7 +7,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
7
7
|
vorpal
|
|
8
8
|
.command(
|
|
9
9
|
"project-pause <envComponent>",
|
|
10
|
-
"halts all running pods (scales to 0)"
|
|
10
|
+
"halts all running pods (scales to 0)",
|
|
11
11
|
)
|
|
12
12
|
.autocomplete(await envAndComponents())
|
|
13
13
|
.action(async function ({ envComponent }) {
|
|
@@ -9,7 +9,7 @@ export default async (vorpal: Vorpal) => {
|
|
|
9
9
|
vorpal
|
|
10
10
|
.command(
|
|
11
11
|
"project-security-evaluate",
|
|
12
|
-
"evaluate project's security audit document"
|
|
12
|
+
"evaluate project's security audit document",
|
|
13
13
|
)
|
|
14
14
|
.action(async function () {
|
|
15
15
|
const gitRoot = await getGitRoot();
|
|
@@ -17,7 +17,7 @@ export default async (vorpal: Vorpal) => {
|
|
|
17
17
|
if (result.isErr()) {
|
|
18
18
|
console.error(
|
|
19
19
|
"Could not evaluate security audit document:",
|
|
20
|
-
result.error
|
|
20
|
+
result.error,
|
|
21
21
|
);
|
|
22
22
|
} else {
|
|
23
23
|
console.log(makeSecurityAuditOverview(result.value));
|
|
@@ -5,7 +5,7 @@ export default async (vorpal: Vorpal) =>
|
|
|
5
5
|
vorpal
|
|
6
6
|
.command(
|
|
7
7
|
"project-setup",
|
|
8
|
-
"Initializes all environments and creates requires resources, service accounts, etc."
|
|
8
|
+
"Initializes all environments and creates requires resources, service accounts, etc.",
|
|
9
9
|
)
|
|
10
10
|
.action(async function () {
|
|
11
11
|
await setupProject(this);
|
|
@@ -25,7 +25,7 @@ export const setupProject = async (instance: CommandInstance) => {
|
|
|
25
25
|
await projectConfigSecrets(instance);
|
|
26
26
|
} else {
|
|
27
27
|
instance.log(
|
|
28
|
-
"👆 don't forget to config secret using `project-config-secrets`"
|
|
28
|
+
"👆 don't forget to config secret using `project-config-secrets`",
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
instance.log("");
|
|
@@ -3,9 +3,8 @@ import type { CommandInstance } from "vorpal";
|
|
|
3
3
|
import { doGitlabRequest, getProjectInfo } from "../../../../../utils/gitlab";
|
|
4
4
|
|
|
5
5
|
export const setupAccessTokens = async (instance: CommandInstance) => {
|
|
6
|
-
const { id: projectId, web_url: projectWebUrl } =
|
|
7
|
-
instance
|
|
8
|
-
);
|
|
6
|
+
const { id: projectId, web_url: projectWebUrl } =
|
|
7
|
+
await getProjectInfo(instance);
|
|
9
8
|
try {
|
|
10
9
|
await doGitlabRequest(instance, `projects/${projectId}/variables/GL_TOKEN`);
|
|
11
10
|
} catch (e) {
|
|
@@ -15,10 +14,10 @@ export const setupAccessTokens = async (instance: CommandInstance) => {
|
|
|
15
14
|
// not found
|
|
16
15
|
|
|
17
16
|
instance.log(
|
|
18
|
-
"I need add a GL_TOKEN to the project, so that semantic release will work\n"
|
|
17
|
+
"I need add a GL_TOKEN to the project, so that semantic release will work\n",
|
|
19
18
|
);
|
|
20
19
|
instance.log(
|
|
21
|
-
"👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - role: maintainer - scopes: api, read_repository"
|
|
20
|
+
"👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - role: maintainer - scopes: api, read_repository",
|
|
22
21
|
);
|
|
23
22
|
instance.log("\n");
|
|
24
23
|
|
|
@@ -52,7 +51,7 @@ export const setupAccessTokens = async (instance: CommandInstance) => {
|
|
|
52
51
|
value: GL_TOKEN,
|
|
53
52
|
masked: true,
|
|
54
53
|
},
|
|
55
|
-
"POST"
|
|
54
|
+
"POST",
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
57
|
};
|
|
@@ -14,7 +14,7 @@ import { upsertAllVariables } from "../../../../../utils/gitlab";
|
|
|
14
14
|
|
|
15
15
|
export const setupCloudRun = async (
|
|
16
16
|
instance: CommandInstance,
|
|
17
|
-
context: Context
|
|
17
|
+
context: Context,
|
|
18
18
|
) => {
|
|
19
19
|
if (!isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
20
20
|
throw new Error("deploy config is not of type 'google-cloudrun'");
|
|
@@ -35,7 +35,7 @@ export const setupCloudRun = async (
|
|
|
35
35
|
? ["sqladmin.googleapis.com", "sql-component.googleapis.com"]
|
|
36
36
|
: []),
|
|
37
37
|
],
|
|
38
|
-
config
|
|
38
|
+
config,
|
|
39
39
|
);
|
|
40
40
|
instance.log("upsert artifacts registry...");
|
|
41
41
|
await upsertGcloudArtifactsRegistry(config);
|
|
@@ -58,7 +58,7 @@ export const setupCloudRun = async (
|
|
|
58
58
|
...(config.cloudSql ? ["roles/cloudsql.admin"] : []),
|
|
59
59
|
],
|
|
60
60
|
},
|
|
61
|
-
GCLOUD_DEPLOY_CREDENTIALS_KEY
|
|
61
|
+
GCLOUD_DEPLOY_CREDENTIALS_KEY,
|
|
62
62
|
);
|
|
63
63
|
|
|
64
64
|
// gcloud run automatically gives us a hostname
|
|
@@ -66,7 +66,7 @@ export const setupCloudRun = async (
|
|
|
66
66
|
// so we get this through some magic and add this as a ci/cd variable
|
|
67
67
|
// the pipeline than can use this to construct the canonical host
|
|
68
68
|
instance.log(
|
|
69
|
-
"get service domain suffix... that might take a while initially"
|
|
69
|
+
"get service domain suffix... that might take a while initially",
|
|
70
70
|
);
|
|
71
71
|
const suffix = await getCloudRunDomainSuffix(config);
|
|
72
72
|
instance.log("domain suffix: " + suffix);
|
|
@@ -79,6 +79,6 @@ export const setupCloudRun = async (
|
|
|
79
79
|
context.environment.shortName,
|
|
80
80
|
context.componentName,
|
|
81
81
|
false, // backup
|
|
82
|
-
false // masked
|
|
82
|
+
false, // masked
|
|
83
83
|
);
|
|
84
84
|
};
|
|
@@ -7,11 +7,11 @@ import { setupKubernetes } from "./setupKubernetes";
|
|
|
7
7
|
|
|
8
8
|
export const setupContext = async (
|
|
9
9
|
instance: CommandInstance,
|
|
10
|
-
context: Context
|
|
10
|
+
context: Context,
|
|
11
11
|
) => {
|
|
12
12
|
instance.log("");
|
|
13
13
|
instance.log(
|
|
14
|
-
"=================================================================================="
|
|
14
|
+
"==================================================================================",
|
|
15
15
|
);
|
|
16
16
|
|
|
17
17
|
instance.log(
|
|
@@ -19,7 +19,7 @@ export const setupContext = async (
|
|
|
19
19
|
context.environment.shortName +
|
|
20
20
|
":" +
|
|
21
21
|
context.componentName +
|
|
22
|
-
"..."
|
|
22
|
+
"...",
|
|
23
23
|
);
|
|
24
24
|
instance.log("");
|
|
25
25
|
if (isOfDeployType(context.componentConfig.deploy, "google-cloudrun")) {
|
|
@@ -37,7 +37,7 @@ export const setupContext = async (
|
|
|
37
37
|
context.environment.shortName +
|
|
38
38
|
":" +
|
|
39
39
|
context.componentName +
|
|
40
|
-
" done!"
|
|
40
|
+
" done!",
|
|
41
41
|
);
|
|
42
42
|
|
|
43
43
|
instance.log("");
|