kurtosis-sdk 0.86.4 → 0.86.6
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.
|
@@ -33,6 +33,7 @@ export declare class EnclaveContext {
|
|
|
33
33
|
getAllFilesArtifactNamesAndUuids(): Promise<Result<FilesArtifactNameAndUuid[], Error>>;
|
|
34
34
|
connectServices(connect: Connect): Promise<Result<ConnectServicesResponse, Error>>;
|
|
35
35
|
getStarlarkRun(): Promise<Result<GetStarlarkRunResponse, Error>>;
|
|
36
|
+
private getPackageNameAndReplaceOptions;
|
|
36
37
|
private static convertApiPortsToServiceContextPorts;
|
|
37
38
|
private assembleRunStarlarkPackageArg;
|
|
38
39
|
private getKurtosisYaml;
|
|
@@ -21,12 +21,25 @@ const service_context_1 = require("../services/service_context");
|
|
|
21
21
|
const port_spec_1 = require("../services/port_spec");
|
|
22
22
|
const api_container_service_pb_1 = require("../../kurtosis_core_rpc_api_bindings/api_container_service_pb");
|
|
23
23
|
const path = require("path");
|
|
24
|
+
const fs = require("fs");
|
|
24
25
|
const kurtosis_yaml_1 = require("./kurtosis_yaml");
|
|
25
26
|
const starlark_run_blocking_1 = require("./starlark_run_blocking");
|
|
26
27
|
const service_identifiers_1 = require("../services/service_identifiers");
|
|
27
28
|
exports.KURTOSIS_YAML_FILENAME = "kurtosis.yml";
|
|
28
29
|
const OS_PATH_SEPARATOR_STRING = "/";
|
|
29
30
|
const DOT_RELATIVE_PATH_INDICATOR_STRING = ".";
|
|
31
|
+
// required to get around the "only Github URLs" validation
|
|
32
|
+
const composePackageIdPlaceholder = 'github.com/NOTIONAL_USER/COMPOSE-PACKAGE';
|
|
33
|
+
// TODO Remove this once package ID is detected ONLY the APIC side (i.e. the CLI doesn't need to tell the APIC what package ID it's using)
|
|
34
|
+
// Doing so requires that we upload completely anonymous packages to the APIC, and it figures things out from there
|
|
35
|
+
let supportedDockerComposeYmlFilenames = [
|
|
36
|
+
"compose.yml",
|
|
37
|
+
"compose.yaml",
|
|
38
|
+
"docker-compose.yml",
|
|
39
|
+
"docker-compose.yaml",
|
|
40
|
+
"docker_compose.yml",
|
|
41
|
+
"docker_compose.yaml",
|
|
42
|
+
];
|
|
30
43
|
// Docs available at https://docs.kurtosis.com/sdk/#enclavecontext
|
|
31
44
|
class EnclaveContext {
|
|
32
45
|
constructor(backend, pathJoiner, genericTgzArchiver) {
|
|
@@ -100,14 +113,12 @@ class EnclaveContext {
|
|
|
100
113
|
// Docs available at https://docs.kurtosis.com/sdk/#runstarlarkpackagestring-packagerootpath-string-serializedparams-boolean-dryrun---streamstarlarkrunresponseline-responselines-error-error
|
|
101
114
|
runStarlarkPackage(packageRootPath, runConfig) {
|
|
102
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
-
const
|
|
104
|
-
if (
|
|
105
|
-
return (0, neverthrow_1.err)(new Error(`Unexpected error while
|
|
106
|
-
}
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const packageReplaceOptions = kurtosisYaml.packageReplaceOptions;
|
|
110
|
-
const args = yield this.assembleRunStarlarkPackageArg(kurtosisYaml, runConfig.relativePathToMainFile, runConfig.mainFunctionName, runConfig.serializedParams, runConfig.dryRun, runConfig.cloudInstanceId, runConfig.cloudUserId);
|
|
116
|
+
const packageNameAndReplaceOptionsResult = yield this.getPackageNameAndReplaceOptions(packageRootPath);
|
|
117
|
+
if (packageNameAndReplaceOptionsResult.isErr()) {
|
|
118
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error occurred while trying to get package name and replace options:\n${packageNameAndReplaceOptionsResult.error}`));
|
|
119
|
+
}
|
|
120
|
+
const [packageName, packageReplaceOptions] = packageNameAndReplaceOptionsResult.value;
|
|
121
|
+
const args = yield this.assembleRunStarlarkPackageArg(packageName, runConfig.relativePathToMainFile, runConfig.mainFunctionName, runConfig.serializedParams, runConfig.dryRun, runConfig.cloudInstanceId, runConfig.cloudUserId);
|
|
111
122
|
if (args.isErr()) {
|
|
112
123
|
return (0, neverthrow_1.err)(new Error(`Unexpected error while assembling arguments to pass to the Starlark executor \n${args.error}`));
|
|
113
124
|
}
|
|
@@ -115,9 +126,9 @@ class EnclaveContext {
|
|
|
115
126
|
if (archiverResponse.isErr()) {
|
|
116
127
|
return (0, neverthrow_1.err)(new Error(`Unexpected error while creating the package's tgs file from '${packageRootPath}'\n${archiverResponse.error}`));
|
|
117
128
|
}
|
|
118
|
-
const uploadStarlarkPackageResponse = yield this.backend.uploadStarlarkPackage(
|
|
129
|
+
const uploadStarlarkPackageResponse = yield this.backend.uploadStarlarkPackage(packageName, archiverResponse.value);
|
|
119
130
|
if (uploadStarlarkPackageResponse.isErr()) {
|
|
120
|
-
return (0, neverthrow_1.err)(new Error(`Unexpected error while uploading Starlark package '${
|
|
131
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error while uploading Starlark package '${packageName}'\n${uploadStarlarkPackageResponse.error}`));
|
|
121
132
|
}
|
|
122
133
|
if (packageReplaceOptions !== undefined && packageReplaceOptions.size > 0) {
|
|
123
134
|
const uploadLocalStarlarkPackageDependenciesResponse = yield this.uploadLocalStarlarkPackageDependencies(packageRootPath, packageReplaceOptions);
|
|
@@ -308,6 +319,42 @@ class EnclaveContext {
|
|
|
308
319
|
// ====================================================================================================
|
|
309
320
|
// Private helper functions
|
|
310
321
|
// ====================================================================================================
|
|
322
|
+
// Determines the package name and replace options based on [packageRootPath]
|
|
323
|
+
// If a kurtosis.yml is detected, package is a kurtosis package
|
|
324
|
+
// If a valid [supportedDockerComposeYaml] is detected, package is a docker compose package
|
|
325
|
+
getPackageNameAndReplaceOptions(packageRootPath) {
|
|
326
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
327
|
+
let packageName;
|
|
328
|
+
let packageReplaceOptions;
|
|
329
|
+
// Use kurtosis package if it exists
|
|
330
|
+
if (fs.existsSync(path.join(packageRootPath, exports.KURTOSIS_YAML_FILENAME))) {
|
|
331
|
+
const kurtosisYmlResult = yield this.getKurtosisYaml(packageRootPath);
|
|
332
|
+
if (kurtosisYmlResult.isErr()) {
|
|
333
|
+
return (0, neverthrow_1.err)(new Error(`Unexpected error while getting the Kurtosis yaml file from path '${packageRootPath}'`));
|
|
334
|
+
}
|
|
335
|
+
const kurtosisYml = kurtosisYmlResult.value;
|
|
336
|
+
packageName = kurtosisYml.name;
|
|
337
|
+
packageReplaceOptions = kurtosisYml.packageReplaceOptions;
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
// Use compose package if it exists
|
|
341
|
+
let composeAbsFilepath = '';
|
|
342
|
+
for (const candidateComposeFilename of supportedDockerComposeYmlFilenames) {
|
|
343
|
+
const candidateComposeAbsFilepath = path.join(packageRootPath, candidateComposeFilename);
|
|
344
|
+
if (fs.existsSync(candidateComposeAbsFilepath)) {
|
|
345
|
+
composeAbsFilepath = candidateComposeAbsFilepath;
|
|
346
|
+
break;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
if (composeAbsFilepath === '') {
|
|
350
|
+
return (0, neverthrow_1.err)(new Error(`Neither a '${exports.KURTOSIS_YAML_FILENAME}' file nor one of the default Compose files (${supportedDockerComposeYmlFilenames.join(', ')}) was found in the package root; at least one of these is required`));
|
|
351
|
+
}
|
|
352
|
+
packageName = composePackageIdPlaceholder;
|
|
353
|
+
packageReplaceOptions = new Map();
|
|
354
|
+
}
|
|
355
|
+
return (0, neverthrow_1.ok)([packageName, packageReplaceOptions]);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
311
358
|
// convertApiPortsToServiceContextPorts returns a converted map where Port objects associated with strings in [apiPorts] are
|
|
312
359
|
// properly converted to PortSpec objects.
|
|
313
360
|
// Returns error if:
|
|
@@ -329,10 +376,10 @@ class EnclaveContext {
|
|
|
329
376
|
}
|
|
330
377
|
return (0, neverthrow_1.ok)(result);
|
|
331
378
|
}
|
|
332
|
-
assembleRunStarlarkPackageArg(
|
|
379
|
+
assembleRunStarlarkPackageArg(packageName, relativePathToMainFile, mainFunctionName, serializedParams, dryRun, cloudInstanceId, cloudUserId) {
|
|
333
380
|
return __awaiter(this, void 0, void 0, function* () {
|
|
334
381
|
const args = new api_container_service_pb_1.RunStarlarkPackageArgs;
|
|
335
|
-
args.setPackageId(
|
|
382
|
+
args.setPackageId(packageName);
|
|
336
383
|
args.setSerializedParams(serializedParams);
|
|
337
384
|
args.setDryRun(dryRun);
|
|
338
385
|
args.setRelativePathToMainFile(relativePathToMainFile);
|
|
@@ -4,5 +4,5 @@ exports.KURTOSIS_VERSION = void 0;
|
|
|
4
4
|
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
|
|
5
5
|
// This is necessary so that Kurt Core consumers (e.g. modules) will know if they're compatible with the currently-running
|
|
6
6
|
// API container
|
|
7
|
-
exports.KURTOSIS_VERSION = "0.86.
|
|
7
|
+
exports.KURTOSIS_VERSION = "0.86.6";
|
|
8
8
|
// !!!!!!!!!!! DO NOT UPDATE! WILL BE MANUALLY UPDATED DURING THE RELEASE PROCESS !!!!!!!!!!!!!!!!!!!!!!
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kurtosis-sdk",
|
|
3
3
|
"//": "NOTE: DO NOT UPDATE THIS VERSION MANUALLY - IT WILL BE UPDATED DURING THE RELEASE PROCESS!",
|
|
4
|
-
"version": "0.86.
|
|
4
|
+
"version": "0.86.6",
|
|
5
5
|
"main": "./build/index",
|
|
6
6
|
"description": "This repo contains a Typescript client for communicating with the Kurtosis Engine server, which is responsible for creating, managing and destroying Kurtosis Enclaves.",
|
|
7
7
|
"types": "./build/index",
|