@quantum-hub/qhubctl 1.5.0 → 1.6.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/commands/up.js +14 -7
- package/package.json +1 -1
package/dist/commands/up.js
CHANGED
|
@@ -7,6 +7,7 @@ import { BuildJobDtoStatusEnum, BuildJobDtoStepEnum, ValidationResultStateEnum }
|
|
|
7
7
|
import { streamToBlob } from '../lib/stream-to-blob.js';
|
|
8
8
|
import { getDescriptionText } from '../lib/up/get-description.js';
|
|
9
9
|
import { zipProjectFolder } from '../lib/up/zip.js';
|
|
10
|
+
import { handleError } from '../lib/error.js';
|
|
10
11
|
import { error, spinner, stdout, warn } from '../lib/output.js';
|
|
11
12
|
import { requireAuth } from '../model/command.js';
|
|
12
13
|
import QuantumHubService from '../service/quantum-hub-service.js';
|
|
@@ -96,7 +97,7 @@ Examples:
|
|
|
96
97
|
export const upCommand = new Command('up')
|
|
97
98
|
.description('Creates or updates a service')
|
|
98
99
|
.option('--silent', 'Suppresses all outputs, helpful when executed in a CI/CD pipeline.', false)
|
|
99
|
-
.option('--no-save-id', 'Prevents storing the created service ID in qhub.json file.'
|
|
100
|
+
.option('--no-save-id', 'Prevents storing the created service ID in qhub.json file.')
|
|
100
101
|
.option('--name <value>', 'Override the service name from qhub.json with a custom name.')
|
|
101
102
|
.addHelpText('after', EXAMPLES)
|
|
102
103
|
.action(async (opts) => {
|
|
@@ -104,7 +105,7 @@ export const upCommand = new Command('up')
|
|
|
104
105
|
const qhubService = new QuantumHubService(userConfig);
|
|
105
106
|
const silentMode = opts.silent;
|
|
106
107
|
// Commander inverts --no-save-id into opts.saveId = false
|
|
107
|
-
const noSaveId = opts.saveId
|
|
108
|
+
const noSaveId = !opts.saveId;
|
|
108
109
|
const serviceConfig = readServiceConfig(process.cwd());
|
|
109
110
|
if (!('descriptionFile' in serviceConfig)) {
|
|
110
111
|
stdout('Warning: Since version 2.14.0, the "description" property in qhub.json has changed to "descriptionFile".\nFor more information, visit: https://docs.hub.kipu-quantum.com/qhub-json-reference.html\n');
|
|
@@ -135,9 +136,15 @@ export const upCommand = new Command('up')
|
|
|
135
136
|
descriptionText: await getDescriptionText(process.cwd()),
|
|
136
137
|
sourceCode: await zipProjectFolder('./'),
|
|
137
138
|
};
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
let service;
|
|
140
|
+
try {
|
|
141
|
+
service = serviceExistsInPlatform
|
|
142
|
+
? await updateService(qhubService, serviceConfig, serviceFiles, silentMode)
|
|
143
|
+
: await createService(qhubService, serviceConfig, serviceFiles, silentMode, noSaveId, opts.name);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
error(await handleError(err));
|
|
147
|
+
}
|
|
141
148
|
const serviceDefinition = service?.serviceDefinitions?.[0];
|
|
142
149
|
if (!serviceDefinition) {
|
|
143
150
|
error('Service definition not found');
|
|
@@ -153,9 +160,9 @@ export const upCommand = new Command('up')
|
|
|
153
160
|
if (validationResult?.state === ValidationResultStateEnum.Error && validationResult.summary) {
|
|
154
161
|
reason = `${reason}: ${validationResult.summary}`;
|
|
155
162
|
}
|
|
156
|
-
|
|
163
|
+
error(reason);
|
|
157
164
|
}
|
|
158
165
|
else {
|
|
159
|
-
|
|
166
|
+
error('Still pending, please check the platform UI to determine the status');
|
|
160
167
|
}
|
|
161
168
|
});
|