@contrail/cli 3.5.3-alpha.8e9fe43 → 3.5.3-alpha.915cfe5
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/README.md
CHANGED
|
@@ -17,7 +17,7 @@ $ npm install -g @contrail/cli
|
|
|
17
17
|
$ contrail COMMAND
|
|
18
18
|
running command...
|
|
19
19
|
$ contrail (--version)
|
|
20
|
-
@contrail/cli/3.5.3-alpha.
|
|
20
|
+
@contrail/cli/3.5.3-alpha.915cfe5 linux-x64 node-v24.16.0
|
|
21
21
|
$ contrail --help [COMMAND]
|
|
22
22
|
USAGE
|
|
23
23
|
$ contrail COMMAND
|
|
@@ -78,7 +78,8 @@ async function exportWorkflowsByApp(outputDir, overwrite) {
|
|
|
78
78
|
if (!appIdentifier && workflow.identifier) {
|
|
79
79
|
const match = workflow.identifier.match(/^@([^@]+)@/);
|
|
80
80
|
if (match) {
|
|
81
|
-
|
|
81
|
+
// Keep the @ prefix in the appIdentifier
|
|
82
|
+
appIdentifier = `@${match[1]}`;
|
|
82
83
|
}
|
|
83
84
|
}
|
|
84
85
|
if (appIdentifier) {
|
|
@@ -100,18 +101,13 @@ async function exportWorkflowsByApp(outputDir, overwrite) {
|
|
|
100
101
|
for (const workflow of workflows) {
|
|
101
102
|
exportObj.workflows.push(await buildExportWorkflow(workflow, allSchedules));
|
|
102
103
|
}
|
|
103
|
-
const
|
|
104
|
+
const safeAppIdentifier = appIdentifier.replace(/[\\/]/g, '-');
|
|
105
|
+
const filePath = path.join(resolvedDir, `workflows-${safeAppIdentifier}.yml`);
|
|
104
106
|
await writeYamlFile(exportObj, filePath, overwrite);
|
|
105
107
|
console.log(`${chalk_1.default.green('EXPORTED')} ${filePath}`);
|
|
106
108
|
}
|
|
107
109
|
if (unassigned.length > 0) {
|
|
108
|
-
|
|
109
|
-
for (const workflow of unassigned) {
|
|
110
|
-
exportObj.workflows.push(await buildExportWorkflow(workflow, allSchedules));
|
|
111
|
-
}
|
|
112
|
-
const filePath = path.join(resolvedDir, exports.DEFAULT_FILE_LOCATION);
|
|
113
|
-
await writeYamlFile(exportObj, filePath, overwrite);
|
|
114
|
-
console.log(`${chalk_1.default.green('EXPORTED')} ${filePath}`);
|
|
110
|
+
console.log(`${chalk_1.default.yellow('SKIPPED')} ${unassigned.length} workflows could not be associated with an app. Re-run with --outFile to export them to a single file.`);
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
exports.exportWorkflowsByApp = exportWorkflowsByApp;
|
|
@@ -149,5 +145,6 @@ async function writeYamlFile(data, absolutePath, overwrite) {
|
|
|
149
145
|
if (fs_1.default.existsSync(absolutePath)) {
|
|
150
146
|
await (0, file_helpers_1.safeFileOverwrite)(absolutePath, overwrite);
|
|
151
147
|
}
|
|
148
|
+
fs_1.default.mkdirSync(path.dirname(absolutePath), { recursive: true });
|
|
152
149
|
fs_1.default.writeFileSync(absolutePath, js_yaml_1.default.dump(data), 'utf8');
|
|
153
150
|
}
|
|
@@ -20,7 +20,6 @@ class LocalWorkflowTemplateDeployer {
|
|
|
20
20
|
const existingWorkflows = await (0, event_workflow_templates_1.getExistingWorkflowTemplates)();
|
|
21
21
|
// UPSERT / DELETE BASED ON WORKFLOW TEMPLATES IDENTIFIER
|
|
22
22
|
logger_1.default.info(`${chalk_1.default.yellow.bold('WORKFLOW TEMPLATES')} Deploying workflow templates.`);
|
|
23
|
-
logger_1.default.info(wtDeclaration);
|
|
24
23
|
for (const workflowKey of Object.keys(wtDeclaration.workflows)) {
|
|
25
24
|
await this.deployWorkflowTemplate(wtDeclaration.workflows[workflowKey], existingWorkflows, wtDeclaration.appIdentifier);
|
|
26
25
|
}
|
|
@@ -35,7 +34,7 @@ class LocalWorkflowTemplateDeployer {
|
|
|
35
34
|
return await this.createNewWorkflowTemplate(identifier, workflow, appIdentifier);
|
|
36
35
|
}
|
|
37
36
|
async createNewWorkflowTemplate(workflowKey, workflowTemplate, appIdentifier) {
|
|
38
|
-
|
|
37
|
+
this.populateActionIds(workflowTemplate, workflowKey, appIdentifier);
|
|
39
38
|
const newObject = {
|
|
40
39
|
identifier: getWorkflowTemplateIdentifier(workflowTemplate),
|
|
41
40
|
name: workflowTemplate.name,
|
|
@@ -57,8 +56,10 @@ class LocalWorkflowTemplateDeployer {
|
|
|
57
56
|
}
|
|
58
57
|
async populateActionIds(workflowTemplate, workflowKey, appIdentifier) {
|
|
59
58
|
const installedApps = await (0, apps_1.getInstalledApps)();
|
|
60
|
-
const appOrg = installedApps.find((x) => x.app
|
|
61
|
-
|
|
59
|
+
const appOrg = installedApps.find((x) => x.app?.identifier === appIdentifier);
|
|
60
|
+
if (!appOrg) {
|
|
61
|
+
throw new Error(`Could not find installed app with identifier "${appIdentifier}". Make sure the app is installed in this org before importing workflows.`);
|
|
62
|
+
}
|
|
62
63
|
if (!workflowTemplate?.workflowDefinition?.paths) {
|
|
63
64
|
return;
|
|
64
65
|
}
|
package/oclif.manifest.json
CHANGED