@orchagent/cli 0.3.116 → 0.3.117
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/commands/service.js +31 -0
- package/package.json +1 -1
package/dist/commands/service.js
CHANGED
|
@@ -339,6 +339,37 @@ function registerServiceCommand(program) {
|
|
|
339
339
|
throw e;
|
|
340
340
|
}
|
|
341
341
|
});
|
|
342
|
+
// orch service update <service-id>
|
|
343
|
+
service
|
|
344
|
+
.command('update <service-id>')
|
|
345
|
+
.description('Update a service to the latest agent version')
|
|
346
|
+
.option('--workspace <slug>', 'Workspace slug (default: current workspace)')
|
|
347
|
+
.option('--json', 'Output as JSON')
|
|
348
|
+
.action(async (serviceId, options) => {
|
|
349
|
+
const config = await (0, config_1.getResolvedConfig)();
|
|
350
|
+
if (!config.apiKey) {
|
|
351
|
+
throw new errors_1.CliError('Missing API key. Run `orch login` first.');
|
|
352
|
+
}
|
|
353
|
+
const workspaceId = await resolveWorkspaceId(config, options.workspace);
|
|
354
|
+
const spinner = (0, spinner_1.createSpinner)('Updating service to latest version...');
|
|
355
|
+
spinner.start();
|
|
356
|
+
try {
|
|
357
|
+
const result = await (0, api_1.request)(config, 'POST', `/workspaces/${workspaceId}/services/${serviceId}/update-version`);
|
|
358
|
+
spinner.succeed('Service updated');
|
|
359
|
+
if (options.json) {
|
|
360
|
+
(0, output_1.printJson)(result);
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const svc = result.service;
|
|
364
|
+
process.stdout.write(`${chalk_1.default.green('\u2713')} Service '${svc.service_name}' updated to ${result.updated_to || svc.agent_version}\n`);
|
|
365
|
+
process.stdout.write(` ${chalk_1.default.bold('Agent:')} ${svc.agent_name}@${svc.agent_version}\n`);
|
|
366
|
+
process.stdout.write(` ${chalk_1.default.bold('State:')} ${stateColor(svc.current_state)}\n`);
|
|
367
|
+
}
|
|
368
|
+
catch (e) {
|
|
369
|
+
spinner.stop();
|
|
370
|
+
throw e;
|
|
371
|
+
}
|
|
372
|
+
});
|
|
342
373
|
// orch service info <service-id>
|
|
343
374
|
service
|
|
344
375
|
.command('info <service-id>')
|
package/package.json
CHANGED