@catladder/cli 0.0.0-main-67fbbdf8 → 0.0.0-main-9778e447
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/apps/cli/config/writeConfig.js +4 -1
- package/dist/apps/cli/config/writeConfig.js.map +1 -1
- package/dist/apps/cli/verify/migration/fromv2.js +59 -35
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -0
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -2
- package/src/apps/cli/config/writeConfig.ts +8 -2
- package/src/apps/cli/verify/migration/fromv2.ts +55 -9
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +1 -0
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
19
|
"@bitwarden/cli": "^1.8.0",
|
|
20
|
-
"@catladder/pipeline": "0.0.0",
|
|
20
|
+
"@catladder/pipeline": "0.0.0-main-9778e447",
|
|
21
21
|
"@kubernetes/client-node": "^0.16.1",
|
|
22
22
|
"child-process-promise": "^2.2.1",
|
|
23
23
|
"clipboardy": "^2.2.0",
|
|
@@ -60,5 +60,6 @@
|
|
|
60
60
|
"eslint": "^8.7.0",
|
|
61
61
|
"typescript": "^4.5.4"
|
|
62
62
|
},
|
|
63
|
-
"version": "0.0.0-main-
|
|
63
|
+
"version": "0.0.0-main-9778e447",
|
|
64
|
+
"stableVersion": "0.0.0-test7"
|
|
64
65
|
}
|
|
@@ -21,8 +21,10 @@ export const writeConfig = async (
|
|
|
21
21
|
choices: [TS, "yaml"],
|
|
22
22
|
message: "In which format do you want the config? 🤔",
|
|
23
23
|
});
|
|
24
|
+
vorpal.log("");
|
|
24
25
|
if (configType === TS) {
|
|
25
|
-
const content = format(
|
|
26
|
+
const content = format(
|
|
27
|
+
`
|
|
26
28
|
import type { Config } from "@catladder/pipeline";
|
|
27
29
|
|
|
28
30
|
const config: Config = ${JSON.stringify(config)};
|
|
@@ -32,7 +34,11 @@ export const writeConfig = async (
|
|
|
32
34
|
|
|
33
35
|
${options?.endComment ? `/*${options.endComment}*/` : ""}
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
`,
|
|
38
|
+
{
|
|
39
|
+
parser: "babel",
|
|
40
|
+
}
|
|
41
|
+
);
|
|
36
42
|
|
|
37
43
|
await writeFile(gitRoot + "/catladder.ts", content, {
|
|
38
44
|
encoding: "utf-8",
|
|
@@ -63,21 +63,51 @@ export const migrateV2 = async (vorpal: Vorpal) => {
|
|
|
63
63
|
const gitlabCi: OldGitlabCiFile = await getGitlabCi();
|
|
64
64
|
const gitRoot = await getGitRoot();
|
|
65
65
|
|
|
66
|
-
const {
|
|
67
|
-
|
|
66
|
+
const {
|
|
67
|
+
CUSTOMER_NAME,
|
|
68
|
+
APP_NAME,
|
|
69
|
+
COMPONENT_NAME,
|
|
70
|
+
APP_DIR,
|
|
71
|
+
CLUSTER_NAME,
|
|
72
|
+
STAGING_ENABLED,
|
|
73
|
+
} = gitlabCi.variables;
|
|
68
74
|
|
|
69
75
|
vorpal
|
|
70
76
|
.command("migrate")
|
|
71
77
|
|
|
72
78
|
.action(async function () {
|
|
79
|
+
this.log("");
|
|
73
80
|
this.log("⚠️ this project uses legacy catladder (v2)");
|
|
74
|
-
this.log("
|
|
81
|
+
this.log("");
|
|
82
|
+
this.log(
|
|
83
|
+
"😼 I can migrate the project for you. This contains the following steps:"
|
|
84
|
+
);
|
|
85
|
+
this.log("");
|
|
86
|
+
this.log(
|
|
87
|
+
" - migrate the config from values-*.yml to catladder config file"
|
|
88
|
+
);
|
|
89
|
+
this.log(
|
|
90
|
+
" - migrate the secrets from bitwarden to gitlab (this will trash the entries in bitwarden)"
|
|
91
|
+
);
|
|
92
|
+
this.log("");
|
|
93
|
+
this.log(
|
|
94
|
+
"☝ make sure that you checked in your current state in case something goes wrong."
|
|
95
|
+
);
|
|
96
|
+
this.log(
|
|
97
|
+
"☝ secrets in bitwarden are deleted, but can be restored within 30 days."
|
|
98
|
+
);
|
|
99
|
+
this.log("");
|
|
75
100
|
const { shouldContinue } = await this.prompt({
|
|
76
101
|
default: true,
|
|
77
|
-
message: "Migrate? 🤔",
|
|
102
|
+
message: "Migrate project now? 🤔",
|
|
78
103
|
name: "shouldContinue",
|
|
79
104
|
type: "confirm",
|
|
80
105
|
});
|
|
106
|
+
vorpal.log("");
|
|
107
|
+
vorpal.log("");
|
|
108
|
+
vorpal.log("💪😼 ok, let's go...");
|
|
109
|
+
vorpal.log("");
|
|
110
|
+
vorpal.log("");
|
|
81
111
|
|
|
82
112
|
if (shouldContinue) {
|
|
83
113
|
const { env, ...baseValues } =
|
|
@@ -104,6 +134,12 @@ export const migrateV2 = async (vorpal: Vorpal) => {
|
|
|
104
134
|
},
|
|
105
135
|
env: await LEGACY_ENVS.reduce<Promise<Env>>(
|
|
106
136
|
async (acc, envName) => {
|
|
137
|
+
if (envName === "stage" && !STAGING_ENABLED) {
|
|
138
|
+
return {
|
|
139
|
+
...(await acc),
|
|
140
|
+
[envName]: false,
|
|
141
|
+
};
|
|
142
|
+
}
|
|
107
143
|
const newEnvName =
|
|
108
144
|
envName === "dev-local" ? "local" : envName;
|
|
109
145
|
|
|
@@ -130,17 +166,15 @@ export const migrateV2 = async (vorpal: Vorpal) => {
|
|
|
130
166
|
},
|
|
131
167
|
},
|
|
132
168
|
};
|
|
133
|
-
this.log("migrate secrets");
|
|
134
|
-
for (const env of LEGACY_ENVS) {
|
|
135
|
-
await migrateSecrets(this, gitlabCi, env);
|
|
136
|
-
}
|
|
137
169
|
|
|
138
170
|
const comment =
|
|
139
171
|
"Old migrated config:\n\n" +
|
|
140
172
|
(await readFile(await getGitlabCiFilePath(), {
|
|
141
173
|
encoding: "utf-8",
|
|
142
174
|
}));
|
|
143
|
-
|
|
175
|
+
|
|
176
|
+
this.log("-------------------");
|
|
177
|
+
this.log("migrate config");
|
|
144
178
|
await writeConfig(this, config, {
|
|
145
179
|
endComment: comment,
|
|
146
180
|
});
|
|
@@ -150,6 +184,18 @@ export const migrateV2 = async (vorpal: Vorpal) => {
|
|
|
150
184
|
"include: https://git.panter.ch/api/v4/projects/catladder%2Fcatladder/packages/generic/ci-includes/main/gitlab-ci.yml",
|
|
151
185
|
{ encoding: "utf-8" }
|
|
152
186
|
);
|
|
187
|
+
|
|
188
|
+
this.log("-------------------");
|
|
189
|
+
this.log("migrate secrets");
|
|
190
|
+
for (const env of LEGACY_ENVS) {
|
|
191
|
+
await migrateSecrets(this, gitlabCi, env);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
this.log("-------------------");
|
|
195
|
+
|
|
196
|
+
this.log("done!");
|
|
197
|
+
|
|
198
|
+
this.log("-------------------");
|
|
153
199
|
}
|
|
154
200
|
});
|
|
155
201
|
|