@platforma-sdk/package-builder-lib 1.4.1 → 1.4.3
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/assets/conda-dockerfile.template +1 -0
- package/dist/_virtual/_rolldown/runtime.cjs +2 -3
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/core/archive.cjs +1 -2
- package/dist/core/archive.cjs.map +1 -1
- package/dist/core/archive.js +1 -2
- package/dist/core/conda/builder.cjs +1 -2
- package/dist/core/conda/builder.cjs.map +1 -1
- package/dist/core/conda/builder.js +1 -2
- package/dist/core/conda/builder.js.map +1 -1
- package/dist/core/conda/validate-spec.cjs +1 -2
- package/dist/core/conda/validate-spec.js +1 -2
- package/dist/core/core.cjs +11 -12
- package/dist/core/core.cjs.map +1 -1
- package/dist/core/core.d.ts +3 -5
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.js +13 -13
- package/dist/core/core.js.map +1 -1
- package/dist/core/docker-conda.cjs +1 -2
- package/dist/core/docker-conda.js +1 -2
- package/dist/core/docker-coverage.cjs +1 -2
- package/dist/core/docker-coverage.d.ts +1 -3
- package/dist/core/docker-coverage.d.ts.map +1 -1
- package/dist/core/docker-coverage.js +3 -3
- package/dist/core/docker-coverage.js.map +1 -1
- package/dist/core/docker-python.cjs +1 -2
- package/dist/core/docker-python.js +1 -2
- package/dist/core/docker.cjs +1 -2
- package/dist/core/docker.cjs.map +1 -1
- package/dist/core/docker.js +1 -2
- package/dist/core/envs.cjs +1 -2
- package/dist/core/envs.d.ts +0 -1
- package/dist/core/envs.js +1 -2
- package/dist/core/package-info.cjs +13 -12
- package/dist/core/package-info.cjs.map +1 -1
- package/dist/core/package-info.d.ts +4 -5
- package/dist/core/package-info.d.ts.map +1 -1
- package/dist/core/package-info.js +13 -12
- package/dist/core/package-info.js.map +1 -1
- package/dist/core/paths.cjs +1 -2
- package/dist/core/paths.cjs.map +1 -1
- package/dist/core/paths.js +1 -2
- package/dist/core/paths.js.map +1 -1
- package/dist/core/push-guard.cjs +1 -2
- package/dist/core/push-guard.cjs.map +1 -1
- package/dist/core/push-guard.d.ts +0 -2
- package/dist/core/push-guard.d.ts.map +1 -1
- package/dist/core/push-guard.js +1 -2
- package/dist/core/resolver.cjs +1 -2
- package/dist/core/resolver.js +1 -2
- package/dist/core/schemas/artifacts.cjs +1 -2
- package/dist/core/schemas/artifacts.d.ts +1 -169
- package/dist/core/schemas/artifacts.d.ts.map +1 -1
- package/dist/core/schemas/artifacts.js +1 -2
- package/dist/core/schemas/entrypoints.cjs +1 -2
- package/dist/core/schemas/entrypoints.d.ts +1 -352
- package/dist/core/schemas/entrypoints.d.ts.map +1 -1
- package/dist/core/schemas/entrypoints.js +1 -2
- package/dist/core/schemas/sw-json.cjs +1 -2
- package/dist/core/schemas/sw-json.js +1 -2
- package/dist/core/storage.cjs +1 -2
- package/dist/core/storage.js +1 -2
- package/dist/core/sw-json-render.cjs +1 -2
- package/dist/core/sw-json-render.js +1 -2
- package/dist/core/util.cjs +1 -2
- package/dist/core/util.cjs.map +1 -1
- package/dist/core/util.d.ts +0 -1
- package/dist/core/util.js +1 -2
- package/dist/defaults.cjs +1 -2
- package/dist/defaults.d.ts +0 -1
- package/dist/defaults.js +1 -2
- package/dist/index.cjs +1 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -2
- package/package.json +20 -15
- package/src/core/conda/builder.ts +1 -1
|
@@ -6,7 +6,7 @@ import { micromambaDownloadUrl } from "./conda/builder.js";
|
|
|
6
6
|
import { validateCondaSpec } from "./conda/validate-spec.js";
|
|
7
7
|
import * as fs$1 from "node:fs";
|
|
8
8
|
import * as path$1 from "node:path";
|
|
9
|
-
|
|
9
|
+
// src/core/docker-conda.ts
|
|
10
10
|
const tmpSpecFile = "tmp-env-spec-88344b62d74b9307.yaml";
|
|
11
11
|
function generateCondaDockerfileContent(options, arch) {
|
|
12
12
|
const templatePath = assets("conda-dockerfile.template");
|
|
@@ -65,7 +65,6 @@ function verifyDockerOptions(options) {
|
|
|
65
65
|
if (!fs$1.existsSync(options.dockerfile)) throw CLIError(`Dockerfile '${options.dockerfile}' not found`);
|
|
66
66
|
if (!fs$1.existsSync(options.context)) throw CLIError(`Context '${options.context}' not found`);
|
|
67
67
|
}
|
|
68
|
-
//#endregion
|
|
69
68
|
export { prepareDockerOptions, tmpSpecFile };
|
|
70
69
|
|
|
71
70
|
//# sourceMappingURL=docker-conda.js.map
|
|
@@ -2,7 +2,7 @@ const require_defaults = require("../defaults.cjs");
|
|
|
2
2
|
const require_envs = require("./envs.cjs");
|
|
3
3
|
const require_util = require("./util.cjs");
|
|
4
4
|
const require_docker = require("./docker.cjs");
|
|
5
|
-
|
|
5
|
+
// src/core/docker-coverage.ts
|
|
6
6
|
/**
|
|
7
7
|
* The software entrypoints among `entrypoints` that yield no docker image.
|
|
8
8
|
*
|
|
@@ -48,7 +48,6 @@ function assertDockerCoverage(coverage) {
|
|
|
48
48
|
const list = coverage.softwareWithoutDocker.map((name) => ` - ${name}`).join("\n");
|
|
49
49
|
throw require_util.CLIError(`These software entrypoints produce no docker image, so no kubernetes installation can run them:\n${list}\n An image is autogenerated only for 'python' and 'conda' artifacts. Give each entrypoint above an explicit 'docker' block next to its 'binary' one.\n If this package really is meant to be binary-only, declare that with "block-software": { "requireDocker": false }.`);
|
|
50
50
|
}
|
|
51
|
-
//#endregion
|
|
52
51
|
exports.assertDockerCoverage = assertDockerCoverage;
|
|
53
52
|
exports.descriptorHasNoDockerVariant = descriptorHasNoDockerVariant;
|
|
54
53
|
exports.softwareEntrypointsWithoutDocker = softwareEntrypointsWithoutDocker;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { Entrypoint
|
|
2
|
-
//#region src/core/docker-coverage.d.ts
|
|
1
|
+
import { Entrypoint } from "./schemas/entrypoints.js";
|
|
3
2
|
export type DockerCoverage = {
|
|
4
3
|
/** Names of software entrypoints that produce no docker image. */
|
|
5
4
|
softwareWithoutDocker: string[];
|
|
@@ -31,5 +30,4 @@ export declare function softwareEntrypointsWithoutDocker(entrypoints: Map<string
|
|
|
31
30
|
export declare function descriptorHasNoDockerVariant(descriptor: unknown): boolean;
|
|
32
31
|
/** Throws when CI is about to describe software that no k8s install can run. */
|
|
33
32
|
export declare function assertDockerCoverage(coverage: DockerCoverage): void;
|
|
34
|
-
//#endregion
|
|
35
33
|
//# sourceMappingURL=docker-coverage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-coverage.d.ts","names":[],"sources":["../../src/core/docker-coverage.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docker-coverage.d.ts","names":["entrypoint.Entrypoint"],"sources":["../../src/core/docker-coverage.ts"],"mappings":";YAwBY;;EAEV;;EAEA;;;;;;;;;;;;;;;wBAgBc,iCACd,aAAa,YAAYA;;;;;;;;;wBAgCX,6BAA6B;;wBAmB7B,qBAAqB,UAAU"}
|
|
@@ -2,7 +2,7 @@ import { NO_SOFTWARE_PLACEHOLDER } from "../defaults.js";
|
|
|
2
2
|
import { isCI } from "./envs.js";
|
|
3
3
|
import { CLIError } from "./util.js";
|
|
4
4
|
import { entrypointName } from "./docker.js";
|
|
5
|
-
|
|
5
|
+
// src/core/docker-coverage.ts
|
|
6
6
|
/**
|
|
7
7
|
* The software entrypoints among `entrypoints` that yield no docker image.
|
|
8
8
|
*
|
|
@@ -45,9 +45,9 @@ function assertDockerCoverage(coverage) {
|
|
|
45
45
|
if (!isCI()) return;
|
|
46
46
|
if (coverage.requirementWaived) return;
|
|
47
47
|
if (coverage.softwareWithoutDocker.length === 0) return;
|
|
48
|
-
|
|
48
|
+
const list = coverage.softwareWithoutDocker.map((name) => ` - ${name}`).join("\n");
|
|
49
|
+
throw CLIError(`These software entrypoints produce no docker image, so no kubernetes installation can run them:\n${list}\n An image is autogenerated only for 'python' and 'conda' artifacts. Give each entrypoint above an explicit 'docker' block next to its 'binary' one.\n If this package really is meant to be binary-only, declare that with "block-software": { "requireDocker": false }.`);
|
|
49
50
|
}
|
|
50
|
-
//#endregion
|
|
51
51
|
export { assertDockerCoverage, descriptorHasNoDockerVariant, softwareEntrypointsWithoutDocker };
|
|
52
52
|
|
|
53
53
|
//# sourceMappingURL=docker-coverage.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker-coverage.js","names":["docker.entrypointName","defaults.NO_SOFTWARE_PLACEHOLDER","envs.isCI","util.CLIError"],"sources":["../../src/core/docker-coverage.ts"],"sourcesContent":["// Guard against releasing software that cannot run where we deploy it.\n//\n// Nothing else requires a docker variant: an image is autogenerated only for\n// `python` and `conda` artifacts (`artifacts.dockerAutogenTypes`), so a `java`,\n// `R` or plain `binary` entrypoint without an explicit `docker:` block writes a\n// descriptor carrying `binary` and nothing else. Every Platforma installation\n// is kubernetes-based, and the k8s runner has no binary fallback — it fails the\n// command with a bare \"docker image is not specified\". CI stays green, the\n// defect surfaces the first time a user runs the block (MILAB-6872).\n//\n// So: in CI, describing a software entrypoint that produces no image is an\n// error, unless the package declares itself binary-only with\n// `\"block-software\": { \"requireDocker\": false }`.\n//\n// The check reads the package's declaration, not what this particular run\n// built: `--variant binary` and other partial builds are legitimate, a\n// misdeclared entrypoint is not.\n\nimport * as defaults from \"../defaults\";\nimport * as docker from \"./docker\";\nimport * as envs from \"./envs\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport * as util from \"./util\";\n\nexport type DockerCoverage = {\n /** Names of software entrypoints that produce no docker image. */\n softwareWithoutDocker: string[];\n /** Package opted out with `\"block-software\": { \"requireDocker\": false }`. */\n requirementWaived: boolean;\n};\n\n/**\n * The software entrypoints among `entrypoints` that yield no docker image.\n *\n * `entrypoints` is expected in the shape `PackageInfo.entrypoints` produces:\n * one entry per declared entrypoint plus a virtual `<name>:docker` companion\n * carrying the image, explicit or autogenerated. So a missing companion is the\n * whole signal.\n *\n * Run environments and assets are not software and never carry an image of\n * their own (a python image bakes its environment in), so they are skipped. So\n * are references, which re-export a descriptor this package neither builds nor\n * can fix — `SwJsonRenderer.copySwJson` warns about those instead.\n */\nexport function softwareEntrypointsWithoutDocker(\n entrypoints: Map<string, entrypoint.Entrypoint>,\n): string[] {\n const uncovered: string[] = [];\n\n for (const [name, ep] of entrypoints.entries()) {\n if (ep.type !== \"software\") continue;\n\n // This entry *is* an image: the virtual companion, or a docker-only entrypoint.\n // Told apart by artifact type rather than by the ':docker' name suffix —\n // entrypoint names are barely constrained, so `main:docker` is a legal name for a\n // declared entrypoint, and reading the suffix as \"generated companion\" would let a\n // binary-only entrypoint hide behind it. Pairing stays consistent either way: a\n // declared `main:docker` is answered by the companion key `main:docker:docker`,\n // which is exactly what PackageInfo generates for it.\n if (ep.artifact.type === \"docker\") continue;\n\n if (entrypoints.has(docker.entrypointName(name))) continue;\n\n uncovered.push(name);\n }\n\n return uncovered;\n}\n\n/**\n * True when an already-rendered descriptor describes runnable software carrying no\n * image — the shape no kubernetes installation can run.\n *\n * Reads the descriptor rather than a package declaration, for the one case where the\n * declaration is out of reach: a reference entrypoint, whose descriptor is copied\n * verbatim from the package that owns it.\n */\nexport function descriptorHasNoDockerVariant(descriptor: unknown): boolean {\n if (typeof descriptor !== \"object\" || descriptor === null) return false;\n\n const d = descriptor as {\n binary?: { registry?: unknown };\n docker?: unknown;\n local?: unknown;\n };\n\n // No `binary` means a run environment or an asset; `docker` means it is covered;\n // `local` is a dev-mode descriptor, which points at a directory rather than a\n // registry and never runs on a cluster.\n if (d.binary === undefined || d.docker !== undefined || d.local !== undefined) return false;\n\n // The `variant=none` placeholder describes a package built without software at all.\n return d.binary.registry !== defaults.NO_SOFTWARE_PLACEHOLDER;\n}\n\n/** Throws when CI is about to describe software that no k8s install can run. */\nexport function assertDockerCoverage(coverage: DockerCoverage): void {\n if (!envs.isCI()) return;\n if (coverage.requirementWaived) return;\n if (coverage.softwareWithoutDocker.length === 0) return;\n\n const list = coverage.softwareWithoutDocker.map((name) => ` - ${name}`).join(\"\\n\");\n\n throw util.CLIError(\n `These software entrypoints produce no docker image, so no kubernetes installation ` +\n `can run them:\\n${list}\\n` +\n ` An image is autogenerated only for 'python' and 'conda' artifacts. Give each ` +\n `entrypoint above an explicit 'docker' block next to its 'binary' one.\\n` +\n ` If this package really is meant to be binary-only, declare that with ` +\n `\"block-software\": { \"requireDocker\": false }.`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,SAAgB,iCACd,aACU;CACV,MAAM,YAAsB,CAAC;CAE7B,KAAK,MAAM,CAAC,MAAM,OAAO,YAAY,QAAQ,GAAG;EAC9C,IAAI,GAAG,SAAS,YAAY;EAS5B,IAAI,GAAG,SAAS,SAAS,UAAU;EAEnC,IAAI,YAAY,IAAIA,eAAsB,IAAI,CAAC,GAAG;EAElD,UAAU,KAAK,IAAI;CACrB;CAEA,OAAO;AACT;;;;;;;;;AAUA,SAAgB,6BAA6B,YAA8B;CACzE,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAElE,MAAM,IAAI;CASV,IAAI,EAAE,WAAW,KAAA,KAAa,EAAE,WAAW,KAAA,KAAa,EAAE,UAAU,KAAA,GAAW,OAAO;CAGtF,OAAO,EAAE,OAAO,aAAaC;AAC/B;;AAGA,SAAgB,qBAAqB,UAAgC;CACnE,IAAI,CAACC,KAAU,GAAG;CAClB,IAAI,SAAS,mBAAmB;CAChC,IAAI,SAAS,sBAAsB,WAAW,GAAG;
|
|
1
|
+
{"version":3,"file":"docker-coverage.js","names":["docker.entrypointName","defaults.NO_SOFTWARE_PLACEHOLDER","envs.isCI","util.CLIError"],"sources":["../../src/core/docker-coverage.ts"],"sourcesContent":["// Guard against releasing software that cannot run where we deploy it.\n//\n// Nothing else requires a docker variant: an image is autogenerated only for\n// `python` and `conda` artifacts (`artifacts.dockerAutogenTypes`), so a `java`,\n// `R` or plain `binary` entrypoint without an explicit `docker:` block writes a\n// descriptor carrying `binary` and nothing else. Every Platforma installation\n// is kubernetes-based, and the k8s runner has no binary fallback — it fails the\n// command with a bare \"docker image is not specified\". CI stays green, the\n// defect surfaces the first time a user runs the block (MILAB-6872).\n//\n// So: in CI, describing a software entrypoint that produces no image is an\n// error, unless the package declares itself binary-only with\n// `\"block-software\": { \"requireDocker\": false }`.\n//\n// The check reads the package's declaration, not what this particular run\n// built: `--variant binary` and other partial builds are legitimate, a\n// misdeclared entrypoint is not.\n\nimport * as defaults from \"../defaults\";\nimport * as docker from \"./docker\";\nimport * as envs from \"./envs\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport * as util from \"./util\";\n\nexport type DockerCoverage = {\n /** Names of software entrypoints that produce no docker image. */\n softwareWithoutDocker: string[];\n /** Package opted out with `\"block-software\": { \"requireDocker\": false }`. */\n requirementWaived: boolean;\n};\n\n/**\n * The software entrypoints among `entrypoints` that yield no docker image.\n *\n * `entrypoints` is expected in the shape `PackageInfo.entrypoints` produces:\n * one entry per declared entrypoint plus a virtual `<name>:docker` companion\n * carrying the image, explicit or autogenerated. So a missing companion is the\n * whole signal.\n *\n * Run environments and assets are not software and never carry an image of\n * their own (a python image bakes its environment in), so they are skipped. So\n * are references, which re-export a descriptor this package neither builds nor\n * can fix — `SwJsonRenderer.copySwJson` warns about those instead.\n */\nexport function softwareEntrypointsWithoutDocker(\n entrypoints: Map<string, entrypoint.Entrypoint>,\n): string[] {\n const uncovered: string[] = [];\n\n for (const [name, ep] of entrypoints.entries()) {\n if (ep.type !== \"software\") continue;\n\n // This entry *is* an image: the virtual companion, or a docker-only entrypoint.\n // Told apart by artifact type rather than by the ':docker' name suffix —\n // entrypoint names are barely constrained, so `main:docker` is a legal name for a\n // declared entrypoint, and reading the suffix as \"generated companion\" would let a\n // binary-only entrypoint hide behind it. Pairing stays consistent either way: a\n // declared `main:docker` is answered by the companion key `main:docker:docker`,\n // which is exactly what PackageInfo generates for it.\n if (ep.artifact.type === \"docker\") continue;\n\n if (entrypoints.has(docker.entrypointName(name))) continue;\n\n uncovered.push(name);\n }\n\n return uncovered;\n}\n\n/**\n * True when an already-rendered descriptor describes runnable software carrying no\n * image — the shape no kubernetes installation can run.\n *\n * Reads the descriptor rather than a package declaration, for the one case where the\n * declaration is out of reach: a reference entrypoint, whose descriptor is copied\n * verbatim from the package that owns it.\n */\nexport function descriptorHasNoDockerVariant(descriptor: unknown): boolean {\n if (typeof descriptor !== \"object\" || descriptor === null) return false;\n\n const d = descriptor as {\n binary?: { registry?: unknown };\n docker?: unknown;\n local?: unknown;\n };\n\n // No `binary` means a run environment or an asset; `docker` means it is covered;\n // `local` is a dev-mode descriptor, which points at a directory rather than a\n // registry and never runs on a cluster.\n if (d.binary === undefined || d.docker !== undefined || d.local !== undefined) return false;\n\n // The `variant=none` placeholder describes a package built without software at all.\n return d.binary.registry !== defaults.NO_SOFTWARE_PLACEHOLDER;\n}\n\n/** Throws when CI is about to describe software that no k8s install can run. */\nexport function assertDockerCoverage(coverage: DockerCoverage): void {\n if (!envs.isCI()) return;\n if (coverage.requirementWaived) return;\n if (coverage.softwareWithoutDocker.length === 0) return;\n\n const list = coverage.softwareWithoutDocker.map((name) => ` - ${name}`).join(\"\\n\");\n\n throw util.CLIError(\n `These software entrypoints produce no docker image, so no kubernetes installation ` +\n `can run them:\\n${list}\\n` +\n ` An image is autogenerated only for 'python' and 'conda' artifacts. Give each ` +\n `entrypoint above an explicit 'docker' block next to its 'binary' one.\\n` +\n ` If this package really is meant to be binary-only, declare that with ` +\n `\"block-software\": { \"requireDocker\": false }.`,\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4CA,SAAgB,iCACd,aACU;CACV,MAAM,YAAsB,CAAC;CAE7B,KAAK,MAAM,CAAC,MAAM,OAAO,YAAY,QAAQ,GAAG;EAC9C,IAAI,GAAG,SAAS,YAAY;EAS5B,IAAI,GAAG,SAAS,SAAS,UAAU;EAEnC,IAAI,YAAY,IAAIA,eAAsB,IAAI,CAAC,GAAG;EAElD,UAAU,KAAK,IAAI;CACrB;CAEA,OAAO;AACT;;;;;;;;;AAUA,SAAgB,6BAA6B,YAA8B;CACzE,IAAI,OAAO,eAAe,YAAY,eAAe,MAAM,OAAO;CAElE,MAAM,IAAI;CASV,IAAI,EAAE,WAAW,KAAA,KAAa,EAAE,WAAW,KAAA,KAAa,EAAE,UAAU,KAAA,GAAW,OAAO;CAGtF,OAAO,EAAE,OAAO,aAAaC;AAC/B;;AAGA,SAAgB,qBAAqB,UAAgC;CACnE,IAAI,CAACC,KAAU,GAAG;CAClB,IAAI,SAAS,mBAAmB;CAChC,IAAI,SAAS,sBAAsB,WAAW,GAAG;CAEjD,MAAM,OAAO,SAAS,sBAAsB,KAAK,SAAS,SAAS,MAAM,CAAC,CAAC,KAAK,IAAI;CAEpF,MAAMC,SACJ,oGACoB,KAAK,6QAK3B;AACF"}
|
|
@@ -8,7 +8,7 @@ let node_fs = require("node:fs");
|
|
|
8
8
|
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
node_path = require_runtime.__toESM(node_path, 1);
|
|
11
|
-
|
|
11
|
+
// src/core/docker-python.ts
|
|
12
12
|
const PYTHON_VERSION_PATTERNS = {
|
|
13
13
|
PY3_PREFIX: /^3\./,
|
|
14
14
|
VERSION_FORMAT: /^3\.\d+(?:\.\d+)?(?:[-+_][a-zA-Z0-9]+|(?:a|b|rc)\d+|[a-zA-Z]+\d+(?:\.[a-zA-Z0-9]+)*)*$/,
|
|
@@ -141,7 +141,6 @@ function pythonVersionToDockerTag(pythonVersion) {
|
|
|
141
141
|
if (parts.length > 2) return `python:${parts[0]}.${parts[1]}-slim`;
|
|
142
142
|
return `python:${pythonVersion}-slim`;
|
|
143
143
|
}
|
|
144
|
-
//#endregion
|
|
145
144
|
exports.getRunEnvironmentPythonInfo = getRunEnvironmentPythonInfo;
|
|
146
145
|
exports.prepareDockerOptions = prepareDockerOptions;
|
|
147
146
|
|
|
@@ -5,7 +5,7 @@ import { assets } from "./paths.js";
|
|
|
5
5
|
import { resolveRunEnvironment } from "./resolver.js";
|
|
6
6
|
import * as fs$1 from "node:fs";
|
|
7
7
|
import * as path$1 from "node:path";
|
|
8
|
-
|
|
8
|
+
// src/core/docker-python.ts
|
|
9
9
|
const PYTHON_VERSION_PATTERNS = {
|
|
10
10
|
PY3_PREFIX: /^3\./,
|
|
11
11
|
VERSION_FORMAT: /^3\.\d+(?:\.\d+)?(?:[-+_][a-zA-Z0-9]+|(?:a|b|rc)\d+|[a-zA-Z]+\d+(?:\.[a-zA-Z0-9]+)*)*$/,
|
|
@@ -138,7 +138,6 @@ function pythonVersionToDockerTag(pythonVersion) {
|
|
|
138
138
|
if (parts.length > 2) return `python:${parts[0]}.${parts[1]}-slim`;
|
|
139
139
|
return `python:${pythonVersion}-slim`;
|
|
140
140
|
}
|
|
141
|
-
//#endregion
|
|
142
141
|
export { getRunEnvironmentPythonInfo, prepareDockerOptions };
|
|
143
142
|
|
|
144
143
|
//# sourceMappingURL=docker-python.js.map
|
package/dist/core/docker.cjs
CHANGED
|
@@ -8,7 +8,7 @@ node_path = require_runtime.__toESM(node_path, 1);
|
|
|
8
8
|
let node_os = require("node:os");
|
|
9
9
|
node_os = require_runtime.__toESM(node_os, 1);
|
|
10
10
|
let node_child_process = require("node:child_process");
|
|
11
|
-
|
|
11
|
+
// src/core/docker.ts
|
|
12
12
|
/**
|
|
13
13
|
* To allow entrypoint keep both docker and binary package at the same time, we create virtual entrypoint with ':docker' suffix,
|
|
14
14
|
* as entrypoints could not keep two different artifacts at the same time.
|
|
@@ -204,7 +204,6 @@ function contentHash(contextFullPath, dockerfileFullPath) {
|
|
|
204
204
|
function dockerTag(packageName, contentHash, registry) {
|
|
205
205
|
return `${registry ?? "containers.pl-open.science/milaboratories/pl-containers"}:${packageName.replaceAll("/", ".")}.${contentHash}`;
|
|
206
206
|
}
|
|
207
|
-
//#endregion
|
|
208
207
|
exports.addTag = addTag;
|
|
209
208
|
exports.build = build;
|
|
210
209
|
exports.dockerfileAutogenPath = dockerfileAutogenPath;
|
package/dist/core/docker.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.cjs","names":["os","path","fs"],"sources":["../../src/core/docker.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport * as defaults from \"../defaults\";\nimport type * as artifacts from \"./schemas/artifacts\";\nimport * as util from \"./util\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\n\n/**\n * To allow entrypoint keep both docker and binary package at the same time, we create virtual entrypoint with ':docker' suffix,\n * as entrypoints could not keep two different artifacts at the same time.\n */\nexport function entrypointName(name: string): string {\n return name + \":docker\";\n}\n\nexport function isVirtualDockerEntrypointName(name: string): boolean {\n return name.endsWith(\":docker\");\n}\n\nexport function entrypointNameToOrigin(name: string): string {\n if (!isVirtualDockerEntrypointName(name)) {\n return name;\n }\n return name.substring(0, name.length - \":docker\".length);\n}\n\nexport function getImageHash(tag: string): string {\n const result = spawnSync(\n \"docker\",\n [\"image\", \"ls\", \"--filter=reference=\" + tag, \"--format={{.ID}}\"],\n {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n },\n );\n\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`local docker image check failed with status ${result.status}`);\n }\n\n const output = result.stdout.toString().trim();\n if (output.split(\"\\n\").length > 1) {\n throw util.CLIError(\n `package-builder internal logic error: more than one image found by exact tag match: ${output}`,\n );\n }\n\n return output;\n}\n\nexport function getImageEntrypoint(tag: string): string[] {\n const result = spawnSync(\n \"docker\",\n [\"image\", \"inspect\", tag, \"--format\", \"{{ .Config.Entrypoint | json }}\"],\n {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n },\n );\n\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker image inspect' failed with status ${result.status}`);\n }\n\n const output = result.stdout.toString().trim(); // 'null' or '[<string>, ...]' in JSON format\n return (JSON.parse(output) ?? []) as string[];\n}\n\nexport function localImageExists(tag: string): boolean {\n return getImageHash(tag) !== \"\";\n}\n\nexport function remoteImageExists(tag: string): boolean {\n const result = spawnSync(\"docker\", [\"manifest\", \"inspect\", tag], {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n\n if (result.error || result.status !== 0) {\n return false;\n }\n\n return true;\n}\n\nexport function build(\n context: string,\n dockerfile: string,\n tag: string,\n softwarePackage: string,\n softwareVersion: string | undefined,\n) {\n const result = spawnSync(\n \"docker\",\n [\n \"build\",\n // Pin platform so Platforma's linux/amd64 K8s nodes can run the image\n // regardless of host arch (cross-compile via qemu on non-x64 hosts).\n \"--platform\",\n defaults.DOCKER_BUILD_PLATFORM,\n \"-t\",\n tag,\n context,\n \"-f\",\n dockerfile,\n \"--label\",\n \"com.milaboratories.package-builder.software=true\",\n \"--label\",\n \"com.milaboratories.package-builder.software.package=\" + softwarePackage,\n \"--label\",\n \"com.milaboratories.package-builder.software.version=\" + softwareVersion,\n ],\n {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n // Disables buildx default provenance so the image ID stays stable; podman ignores it.\n BUILDX_NO_DEFAULT_ATTESTATIONS: \"1\",\n },\n },\n );\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker build' failed with status ${result.status}`);\n }\n}\n\nexport function push(tag: string) {\n const result = spawnSync(\"docker\", [\"push\", tag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n const registry = tag.split(\"/\")[0];\n throw util.CLIError(\n `'docker push ${tag}' failed with status ${result.status}.\\n` +\n `If the error above mentions authentication or denied access, log in first:\\n` +\n ` aws sso login --profile research-poweruser <YOUR_PROFILE:research-poweruser?> \\n` +\n `Then login in docker:` +\n ` aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${registry}\\n` +\n `(for a private ECR use 'aws ecr' and your region instead of 'ecr-public'/us-east-1).`,\n );\n }\n}\n\nexport function addTag(imageIdOrTag: string, newTag: string) {\n const result = spawnSync(\"docker\", [\"image\", \"tag\", imageIdOrTag, newTag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker tag' failed with status ${result.status}`);\n }\n}\n\nexport function removeTag(imageTag: string) {\n const result = spawnSync(\"docker\", [\"image\", \"rm\", imageTag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker image rm' failed with status ${result.status}`);\n }\n}\n\n/**\n * Generate unique content-addressable image tag\n * @param artifactName: artifact name generated from package name and artifact ID (or explicitly set for artifact in .name field)\n * @param imageID: unique image content hash (docker image ID in docker ls)\n * @param registry: custom registry and repository to use for this image\n * @returns full image tag in format: <registry>/repository:<artifactName>.<imageID>\n */\nexport function generateRemoteTagName(\n artifactName: string,\n imageID: string,\n registry?: string,\n): string {\n return dockerTag(artifactName, imageID, registry);\n}\n\n/**\n * Generate unique content-addressable image tag out of directories and Dockerfile.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns full image tag in format: <registry>/repository:<artifactName>.<contentHash>\n */\nexport function generateLocalTagName(packageRoot: string, artifact: artifacts.dockerType): string {\n const dockerfile = dockerfileAbsPath(packageRoot, artifact);\n const context = contextAbsPath(packageRoot, artifact);\n const hash = contentHash(context, dockerfile);\n\n return dockerTag(\"local-image\", hash);\n}\n\n/**\n * Absolute path to autogenerated Dockerfile for given artifact.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifactID: artifact ID\n * @returns absolute path to autogenerated Dockerfile\n */\nexport function dockerfileAutogenPath(packageRoot: string, artifactID: string): string {\n return path.resolve(packageRoot, \"dist\", \"docker\", `Dockerfile-${artifactID}`);\n}\n\n/**\n * Resolve path to Dockerfile.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns absolute path to Dockerfile\n */\nfunction dockerfileAbsPath(packageRoot: string, artifact: artifacts.dockerType): string {\n return path.resolve(packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n}\n\n/**\n * Resolve path to docker build context directory.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns absolute path to docker build context directory\n */\nfunction contextAbsPath(packageRoot: string, artifact: artifacts.dockerType): string {\n if (artifact.context === \"./\" || artifact.context === \".\") {\n throw util.CLIError(\n `Invalid Docker context: \"${artifact.context}\". Context cannot be \"./\" or \".\" - use absolute path or relative path without \"./\" prefix`,\n );\n }\n return path.resolve(packageRoot, artifact.context ?? \".\");\n}\n\n/**\n * Calculate cummulative hash of docker build context directory context and Dockerfile.\n * To speedup hash calculation, we do not read contents of each item in context dir but\n * use metadata (size, mtime, ...).\n *\n * @param contextFullPath: abs path to docker build context\n * @param dockerfileFullPath: abs path to Dockerfile\n * @returns hash of what the keep\n */\nfunction contentHash(contextFullPath: string, dockerfileFullPath: string): string {\n if (!fs.existsSync(dockerfileFullPath)) {\n throw util.CLIError(`Dockerfile '${dockerfileFullPath}' not found`);\n }\n\n if (!fs.existsSync(contextFullPath)) {\n throw util.CLIError(`Context '${contextFullPath}' not found`);\n }\n\n const contextHash = util.hashDirMetaSync(contextFullPath);\n const dockerfileContent = fs.readFileSync(dockerfileFullPath, \"utf8\");\n contextHash.update(dockerfileContent);\n\n return contextHash.digest(\"hex\").slice(0, 12);\n}\n\nfunction dockerTag(packageName: string, contentHash: string, registry?: string): string {\n const dockerRegistry = registry ?? defaults.DOCKER_REGISTRY;\n return `${dockerRegistry}:${packageName.replaceAll(\"/\", \".\")}.${contentHash}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,MAAsB;CACnD,OAAO,OAAO;AAChB;AAEA,SAAgB,8BAA8B,MAAuB;CACnE,OAAO,KAAK,SAAS,SAAS;AAChC;AAEA,SAAgB,uBAAuB,MAAsB;CAC3D,IAAI,CAAC,8BAA8B,IAAI,GACrC,OAAO;CAET,OAAO,KAAK,UAAU,GAAG,KAAK,SAAS,CAAgB;AACzD;AAEA,SAAgB,aAAa,KAAqB;CAChD,MAAM,UAAA,GAAA,mBAAA,UAAA,CACJ,UACA;EAAC;EAAS;EAAM,wBAAwB;EAAK;CAAkB,GAC/D;EACE,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,MAAM,QAAQ,IAAI,QAAQA,QAAG,QAAQ;EACvC;CACF,CACF;CAEA,IAAI,OAAO,OACT,MAAM,OAAO;CAEf,IAAI,OAAO,WAAW,GACpB,MAAA,aAAA,SAAoB,+CAA+C,OAAO,QAAQ;CAGpF,MAAM,SAAS,OAAO,OAAO,SAAS,CAAC,CAAC,KAAK;CAC7C,IAAI,OAAO,MAAM,IAAI,CAAC,CAAC,SAAS,GAC9B,MAAA,aAAA,SACE,uFAAuF,QACzF;CAGF,OAAO;AACT;AAEA,SAAgB,mBAAmB,KAAuB;CACxD,MAAM,UAAA,GAAA,mBAAA,UAAA,CACJ,UACA;EAAC;EAAS;EAAW;EAAK;EAAY;CAAiC,GACvE;EACE,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,MAAM,QAAQ,IAAI,QAAQA,QAAG,QAAQ;EACvC;CACF,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B,eAAe,mBAAmB,YAAY;CAGpE,IAAI,CAACA,QAAG,WAAW,eAAe,GAChC,MAAA,aAAA,SAAoB,YAAY,gBAAgB,YAAY;CAG9D,MAAM,cAAA,aAAA,gBAAmC,eAAe;CACxD,MAAM,oBAAoBA,QAAG,aAAa,oBAAoB,MAAM;CACpE,YAAY,OAAO,iBAAiB;CAEpC,OAAO,YAAY,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;AAC9C;AAEA,SAAS,UAAU,aAAqB,aAAqB,UAA2B;CAEtF,OAAO,GADgB,YAAY,0DACV,GAAG,YAAY,WAAW,KAAK,GAAG,EAAE,GAAG;AAClE"}
|
|
1
|
+
{"version":3,"file":"docker.cjs","names":["spawnSync","os","path","fs"],"sources":["../../src/core/docker.ts"],"sourcesContent":["import { spawnSync } from \"node:child_process\";\nimport * as defaults from \"../defaults\";\nimport type * as artifacts from \"./schemas/artifacts\";\nimport * as util from \"./util\";\nimport * as fs from \"node:fs\";\nimport * as path from \"node:path\";\nimport * as os from \"node:os\";\n\n/**\n * To allow entrypoint keep both docker and binary package at the same time, we create virtual entrypoint with ':docker' suffix,\n * as entrypoints could not keep two different artifacts at the same time.\n */\nexport function entrypointName(name: string): string {\n return name + \":docker\";\n}\n\nexport function isVirtualDockerEntrypointName(name: string): boolean {\n return name.endsWith(\":docker\");\n}\n\nexport function entrypointNameToOrigin(name: string): string {\n if (!isVirtualDockerEntrypointName(name)) {\n return name;\n }\n return name.substring(0, name.length - \":docker\".length);\n}\n\nexport function getImageHash(tag: string): string {\n const result = spawnSync(\n \"docker\",\n [\"image\", \"ls\", \"--filter=reference=\" + tag, \"--format={{.ID}}\"],\n {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n },\n );\n\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`local docker image check failed with status ${result.status}`);\n }\n\n const output = result.stdout.toString().trim();\n if (output.split(\"\\n\").length > 1) {\n throw util.CLIError(\n `package-builder internal logic error: more than one image found by exact tag match: ${output}`,\n );\n }\n\n return output;\n}\n\nexport function getImageEntrypoint(tag: string): string[] {\n const result = spawnSync(\n \"docker\",\n [\"image\", \"inspect\", tag, \"--format\", \"{{ .Config.Entrypoint | json }}\"],\n {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n },\n );\n\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker image inspect' failed with status ${result.status}`);\n }\n\n const output = result.stdout.toString().trim(); // 'null' or '[<string>, ...]' in JSON format\n return (JSON.parse(output) ?? []) as string[];\n}\n\nexport function localImageExists(tag: string): boolean {\n return getImageHash(tag) !== \"\";\n}\n\nexport function remoteImageExists(tag: string): boolean {\n const result = spawnSync(\"docker\", [\"manifest\", \"inspect\", tag], {\n stdio: \"pipe\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n\n if (result.error || result.status !== 0) {\n return false;\n }\n\n return true;\n}\n\nexport function build(\n context: string,\n dockerfile: string,\n tag: string,\n softwarePackage: string,\n softwareVersion: string | undefined,\n) {\n const result = spawnSync(\n \"docker\",\n [\n \"build\",\n // Pin platform so Platforma's linux/amd64 K8s nodes can run the image\n // regardless of host arch (cross-compile via qemu on non-x64 hosts).\n \"--platform\",\n defaults.DOCKER_BUILD_PLATFORM,\n \"-t\",\n tag,\n context,\n \"-f\",\n dockerfile,\n \"--label\",\n \"com.milaboratories.package-builder.software=true\",\n \"--label\",\n \"com.milaboratories.package-builder.software.package=\" + softwarePackage,\n \"--label\",\n \"com.milaboratories.package-builder.software.version=\" + softwareVersion,\n ],\n {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n // Disables buildx default provenance so the image ID stays stable; podman ignores it.\n BUILDX_NO_DEFAULT_ATTESTATIONS: \"1\",\n },\n },\n );\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker build' failed with status ${result.status}`);\n }\n}\n\nexport function push(tag: string) {\n const result = spawnSync(\"docker\", [\"push\", tag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n const registry = tag.split(\"/\")[0];\n throw util.CLIError(\n `'docker push ${tag}' failed with status ${result.status}.\\n` +\n `If the error above mentions authentication or denied access, log in first:\\n` +\n ` aws sso login --profile research-poweruser <YOUR_PROFILE:research-poweruser?> \\n` +\n `Then login in docker:` +\n ` aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin ${registry}\\n` +\n `(for a private ECR use 'aws ecr' and your region instead of 'ecr-public'/us-east-1).`,\n );\n }\n}\n\nexport function addTag(imageIdOrTag: string, newTag: string) {\n const result = spawnSync(\"docker\", [\"image\", \"tag\", imageIdOrTag, newTag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker tag' failed with status ${result.status}`);\n }\n}\n\nexport function removeTag(imageTag: string) {\n const result = spawnSync(\"docker\", [\"image\", \"rm\", imageTag], {\n stdio: \"inherit\",\n env: {\n ...process.env, // PATH variable from parent process affects execution\n HOME: process.env.HOME || os.homedir(), // Ensure HOME is set\n },\n });\n if (result.error) {\n throw result.error;\n }\n if (result.status !== 0) {\n throw util.CLIError(`'docker image rm' failed with status ${result.status}`);\n }\n}\n\n/**\n * Generate unique content-addressable image tag\n * @param artifactName: artifact name generated from package name and artifact ID (or explicitly set for artifact in .name field)\n * @param imageID: unique image content hash (docker image ID in docker ls)\n * @param registry: custom registry and repository to use for this image\n * @returns full image tag in format: <registry>/repository:<artifactName>.<imageID>\n */\nexport function generateRemoteTagName(\n artifactName: string,\n imageID: string,\n registry?: string,\n): string {\n return dockerTag(artifactName, imageID, registry);\n}\n\n/**\n * Generate unique content-addressable image tag out of directories and Dockerfile.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns full image tag in format: <registry>/repository:<artifactName>.<contentHash>\n */\nexport function generateLocalTagName(packageRoot: string, artifact: artifacts.dockerType): string {\n const dockerfile = dockerfileAbsPath(packageRoot, artifact);\n const context = contextAbsPath(packageRoot, artifact);\n const hash = contentHash(context, dockerfile);\n\n return dockerTag(\"local-image\", hash);\n}\n\n/**\n * Absolute path to autogenerated Dockerfile for given artifact.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifactID: artifact ID\n * @returns absolute path to autogenerated Dockerfile\n */\nexport function dockerfileAutogenPath(packageRoot: string, artifactID: string): string {\n return path.resolve(packageRoot, \"dist\", \"docker\", `Dockerfile-${artifactID}`);\n}\n\n/**\n * Resolve path to Dockerfile.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns absolute path to Dockerfile\n */\nfunction dockerfileAbsPath(packageRoot: string, artifact: artifacts.dockerType): string {\n return path.resolve(packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n}\n\n/**\n * Resolve path to docker build context directory.\n * @param packageRoot: package root path from where to resolve artifact's paths (context, Dockerfile, ...)\n * @param artifact: docker artifact configuration\n * @returns absolute path to docker build context directory\n */\nfunction contextAbsPath(packageRoot: string, artifact: artifacts.dockerType): string {\n if (artifact.context === \"./\" || artifact.context === \".\") {\n throw util.CLIError(\n `Invalid Docker context: \"${artifact.context}\". Context cannot be \"./\" or \".\" - use absolute path or relative path without \"./\" prefix`,\n );\n }\n return path.resolve(packageRoot, artifact.context ?? \".\");\n}\n\n/**\n * Calculate cummulative hash of docker build context directory context and Dockerfile.\n * To speedup hash calculation, we do not read contents of each item in context dir but\n * use metadata (size, mtime, ...).\n *\n * @param contextFullPath: abs path to docker build context\n * @param dockerfileFullPath: abs path to Dockerfile\n * @returns hash of what the keep\n */\nfunction contentHash(contextFullPath: string, dockerfileFullPath: string): string {\n if (!fs.existsSync(dockerfileFullPath)) {\n throw util.CLIError(`Dockerfile '${dockerfileFullPath}' not found`);\n }\n\n if (!fs.existsSync(contextFullPath)) {\n throw util.CLIError(`Context '${contextFullPath}' not found`);\n }\n\n const contextHash = util.hashDirMetaSync(contextFullPath);\n const dockerfileContent = fs.readFileSync(dockerfileFullPath, \"utf8\");\n contextHash.update(dockerfileContent);\n\n return contextHash.digest(\"hex\").slice(0, 12);\n}\n\nfunction dockerTag(packageName: string, contentHash: string, registry?: string): string {\n const dockerRegistry = registry ?? defaults.DOCKER_REGISTRY;\n return `${dockerRegistry}:${packageName.replaceAll(\"/\", \".\")}.${contentHash}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;AAYA,SAAgB,eAAe,MAAsB;CACnD,OAAO,OAAO;AAChB;AAEA,SAAgB,8BAA8B,MAAuB;CACnE,OAAO,KAAK,SAAS,SAAS;AAChC;AAEA,SAAgB,uBAAuB,MAAsB;CAC3D,IAAI,CAAC,8BAA8B,IAAI,GACrC,OAAO;CAET,OAAO,KAAK,UAAU,GAAG,KAAK,SAAS,CAAgB;AACzD;AAEA,SAAgB,aAAa,KAAqB;CAChD,MAAM,UAAA,GAASA,mBAAAA,UAAAA,CACb,UACA;EAAC;EAAS;EAAM,wBAAwB;EAAK;CAAkB,GAC/D;EACE,OAAO;EACP,KAAK;GACH,GAAG,QAAQ;GACX,MAAM,QAAQ,IAAI,QAAQC,QAAG,QAAQ;EACvC;CACF,CACF;CAEA,IAAI,OAAO,OACT,MAAM,OAAO;CAEf,IAAI,OAAO,WAAW,GACpB,MAAA,aAAA,SAAoB,+CAA+C,OAAO,QAA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AAS,kBAAkB,aAAqB,UAAwC;CACtF,OAAOA,UAAK,QAAQ,aAAa,SAAS,cAAc,YAAY;AACtE;;;;;;;AAQA,SAAS,eAAe,aAAqB,UAAwC;CACnF,IAAI,SAAS,YAAY,QAAQ,SAAS,YAAY,KACpD,MAAA,aAAA,SACE,4BAA4B,SAAS,QAAQ,0FAC/C;CAEF,OAAOA,UAAK,QAAQ,aAAa,SAAS,WAAW,GAAG;AAC1D;;;;;;;;;;AAWA,SAAS,YAAY,iBAAyB,oBAAoC;CAChF,IAAI,CAACC,QAAG,WAAW,kBAAkB,GACnC,MAAA,aAAA,SAAoB,eAAe,mBAAmB,YAAY;CAGpE,IAAI,CAACA,QAAG,WAAW,eAAe,GAChC,MAAA,aAAA,SAAoB,YAAY,gBAAgB,YAAY;CAG9D,MAAM,cAAA,aAAA,gBAAmC,eAAe;CACxD,MAAM,oBAAoBA,QAAG,aAAa,oBAAoB,MAAM;CACpE,YAAY,OAAO,iBAAiB;CAEpC,OAAO,YAAY,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,EAAE;AAC9C;AAEA,SAAS,UAAU,aAAqB,aAAqB,UAA2B;CAEtF,OAAO,GADgB,YAAY,0DACV,GAAG,YAAY,WAAW,KAAK,GAAG,EAAE,GAAG;AAClE"}
|
package/dist/core/docker.js
CHANGED
|
@@ -4,7 +4,7 @@ import * as fs$1 from "node:fs";
|
|
|
4
4
|
import * as path$1 from "node:path";
|
|
5
5
|
import * as os from "node:os";
|
|
6
6
|
import { spawnSync } from "node:child_process";
|
|
7
|
-
|
|
7
|
+
// src/core/docker.ts
|
|
8
8
|
/**
|
|
9
9
|
* To allow entrypoint keep both docker and binary package at the same time, we create virtual entrypoint with ':docker' suffix,
|
|
10
10
|
* as entrypoints could not keep two different artifacts at the same time.
|
|
@@ -200,7 +200,6 @@ function contentHash(contextFullPath, dockerfileFullPath) {
|
|
|
200
200
|
function dockerTag(packageName, contentHash, registry) {
|
|
201
201
|
return `${registry ?? "containers.pl-open.science/milaboratories/pl-containers"}:${packageName.replaceAll("/", ".")}.${contentHash}`;
|
|
202
202
|
}
|
|
203
|
-
//#endregion
|
|
204
203
|
export { addTag, build, dockerfileAutogenPath, entrypointName, entrypointNameToOrigin, generateLocalTagName, generateRemoteTagName, getImageEntrypoint, getImageHash, isVirtualDockerEntrypointName, localImageExists, push, remoteImageExists };
|
|
205
204
|
|
|
206
205
|
//# sourceMappingURL=docker.js.map
|
package/dist/core/envs.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/core/envs.ts
|
|
2
2
|
var envs_exports = /* @__PURE__ */ require("../_virtual/_rolldown/runtime.cjs").__exportAll({
|
|
3
3
|
CI: () => "CI",
|
|
4
4
|
PL_CONDA_BUILD: () => PL_CONDA_BUILD,
|
|
@@ -56,7 +56,6 @@ function isCI() {
|
|
|
56
56
|
function isRunnerDebug() {
|
|
57
57
|
return process.env["RUNNER_DEBUG"] === "true" || process.env["RUNNER_DEBUG"] === "1";
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
exports.PL_CONDA_BUILD = PL_CONDA_BUILD;
|
|
61
60
|
exports.PL_CONDA_NO_BUILD = PL_CONDA_NO_BUILD;
|
|
62
61
|
exports.PL_DEV_BINARY_UPLOAD_URL = PL_DEV_BINARY_UPLOAD_URL;
|
package/dist/core/envs.d.ts
CHANGED
|
@@ -27,6 +27,5 @@ export declare const CI = "CI";
|
|
|
27
27
|
export declare const RUNNER_DEBUG = "RUNNER_DEBUG";
|
|
28
28
|
export declare function isCI(): boolean;
|
|
29
29
|
export declare function isRunnerDebug(): boolean;
|
|
30
|
-
//#endregion
|
|
31
30
|
export { envs_d_exports };
|
|
32
31
|
//# sourceMappingURL=envs.d.ts.map
|
package/dist/core/envs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
|
|
2
|
+
// src/core/envs.ts
|
|
3
3
|
var envs_exports = /* @__PURE__ */ __exportAll({
|
|
4
4
|
CI: () => "CI",
|
|
5
5
|
PL_CONDA_BUILD: () => PL_CONDA_BUILD,
|
|
@@ -57,7 +57,6 @@ function isCI() {
|
|
|
57
57
|
function isRunnerDebug() {
|
|
58
58
|
return process.env["RUNNER_DEBUG"] === "true" || process.env["RUNNER_DEBUG"] === "1";
|
|
59
59
|
}
|
|
60
|
-
//#endregion
|
|
61
60
|
export { PL_CONDA_BUILD, PL_CONDA_NO_BUILD, PL_DEV_BINARY_UPLOAD_URL, PL_DEV_DOCKER_PULL_URL, PL_DEV_DOCKER_PUSH_URL, PL_DOCKER_AUTOPUSH, PL_DOCKER_BUILD, PL_DOCKER_NO_AUTOPUSH, PL_DOCKER_NO_BUILD, PL_DOCKER_REGISTRY, PL_DOCKER_REGISTRY_PUSH_TO, PL_PKG_ARCH, PL_PKG_ARCHIVE, PL_PKG_CONTENT_ROOT, PL_PKG_DEV, PL_PKG_FULL_HASH, PL_PKG_OS, PL_PKG_STORAGE_URL, PL_PKG_VERSION, PL_RELEASE_BINARY_UPLOAD_URL, PL_RELEASE_DOCKER_PULL_URL, PL_RELEASE_DOCKER_PUSH_URL, RUNNER_DEBUG, envs_exports, isCI, isRunnerDebug };
|
|
62
61
|
|
|
63
62
|
//# sourceMappingURL=envs.js.map
|
|
@@ -14,7 +14,7 @@ node_path = require_runtime.__toESM(node_path, 1);
|
|
|
14
14
|
let node_crypto = require("node:crypto");
|
|
15
15
|
let zod_v4 = require("zod/v4");
|
|
16
16
|
let _milaboratories_resolve_helper = require("@milaboratories/resolve-helper");
|
|
17
|
-
|
|
17
|
+
// src/core/package-info.ts
|
|
18
18
|
const storagePresetSchema = zod_v4.z.object({
|
|
19
19
|
downloadURL: zod_v4.z.string().optional(),
|
|
20
20
|
storageURL: zod_v4.z.string().optional()
|
|
@@ -351,16 +351,18 @@ var PackageInfo = class {
|
|
|
351
351
|
downloadURL: registries.default?.downloadURL,
|
|
352
352
|
storageURL: registries.default?.storageURL
|
|
353
353
|
};
|
|
354
|
-
if (registry)
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
354
|
+
if (registry) {
|
|
355
|
+
if (typeof registry === "string") {
|
|
356
|
+
result.name = registry;
|
|
357
|
+
const regDefault = wellKnownRegistries[result.name];
|
|
358
|
+
result.downloadURL = registries[result.name]?.downloadURL ?? regDefault?.downloadURL;
|
|
359
|
+
result.storageURL = registries[result.name]?.storageURL ?? regDefault?.storageURL;
|
|
360
|
+
} else {
|
|
361
|
+
result.name = registry.name;
|
|
362
|
+
const regDefault = wellKnownRegistries[result.name];
|
|
363
|
+
result.downloadURL = registry.downloadURL ?? registries[result.name]?.downloadURL ?? regDefault?.downloadURL;
|
|
364
|
+
result.storageURL = registry.storageURL ?? registries[result.name]?.storageURL ?? regDefault?.storageURL;
|
|
365
|
+
}
|
|
364
366
|
}
|
|
365
367
|
const regNameUpper = result.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, "_");
|
|
366
368
|
const uploadTo = process.env[`PL_REGISTRY_${regNameUpper}_UPLOAD_URL`];
|
|
@@ -503,7 +505,6 @@ function requireArtifactType(artifact, type, errMsg) {
|
|
|
503
505
|
if (errMsg) errMsg = `${errMsg}: `;
|
|
504
506
|
throw require_util.CLIError(`${errMsg}wrong artifact type: expected '${type}', got '${artifact.type}'`);
|
|
505
507
|
}
|
|
506
|
-
//#endregion
|
|
507
508
|
exports.PackageInfo = PackageInfo;
|
|
508
509
|
|
|
509
510
|
//# sourceMappingURL=package-info.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-info.cjs","names":["z","path","fs","pythonDockerOptions","condaDockerOptions"],"sources":["../../src/core/package-info.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport type winston from \"winston\";\nimport { z } from \"zod/v4\";\n\nimport * as defaults from \"../defaults\";\nimport * as util from \"./util\";\nimport * as envs from \"./envs\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport * as entrypoints from \"./schemas/entrypoints\";\nimport { tryResolve } from \"@milaboratories/resolve-helper\";\nimport * as docker from \"./docker\";\nimport { prepareDockerOptions as pythonDockerOptions } from \"./docker-python\";\nimport { prepareDockerOptions as condaDockerOptions } from \"./docker-conda\";\n\nconst storagePresetSchema = z.object({\n downloadURL: z.string().optional(),\n storageURL: z.string().optional(),\n});\ntype storagePreset = z.infer<typeof storagePresetSchema>;\n\nconst binaryRegistryPresetsSchema = z.record(z.string(), storagePresetSchema);\ntype binaryRegistryPresets = z.infer<typeof binaryRegistryPresetsSchema>;\n\nconst packageJsonSchema = z.object({\n name: z.string(),\n version: z.string(),\n private: z.boolean().optional(),\n\n \"block-software\": z.object({\n registries: z\n .object({\n binary: binaryRegistryPresetsSchema.optional(),\n })\n .optional(),\n\n artifacts: artifacts.artifactIndexSchema.optional(),\n entrypoints: entrypoints.entrypointListSchema,\n\n // Opt out of the \"every software entrypoint needs a docker image\" rule for a\n // package that is deliberately binary-only. Kept here rather than behind a CLI\n // flag or env var: the exception belongs to the package, where it is reviewable,\n // not to whichever CI run happens to build it. See core/docker-coverage.ts.\n requireDocker: z.boolean().optional(),\n }),\n});\ntype packageJson = z.infer<typeof packageJsonSchema>;\n\nconst wellKnownRegistries: Record<string, storagePreset> = {\n [defaults.BIN_REGISTRY_NAME]: {\n downloadURL: defaults.BIN_REGISTRY_DOWNLOAD_URL,\n },\n};\n\n/*\n * package.json -> block-software structure example:\n * {\n * \"block-software\": {\n * \"registries\": {\n * \"binary\": {\n * \"default\": { \"uploadURL\": \"s3://<bucket>/<some-prefix>?region=<region-name>\" }\n * }\n * },\n *\n * \"artifacts\": {\n * \"pkg-1\": {\n * \"type\": \"binary\",\n * \"roots\": {\n * \"linux-x64\": \"./linux-x64/src\",\n * \"linux-aarch64\": \"./linux-aarch/src\",\n * \"...and so on...\": \"platform-dependant roots\",\n * }\n * }\n * }\n *\n * \"entrypoints\": {\n * \"script1\": {\n * \"software\": {\n * \"artifact\": \"pkg-1\",\n * \"cmd\": [ \"{pkg}/script1\" ]\n * }\n * }\n * }\n * }\n * }\n */\nexport class PackageInfo {\n public readonly packageRoot: string;\n public readonly packageName: string;\n\n private readonly pkgJson: packageJson;\n private _versionOverride: string | undefined;\n\n /** Backing store for `Core.buildMode` (Core delegates its accessor here); gates content-addressable dev naming. */\n public buildMode: util.BuildMode = \"release\";\n\n constructor(\n private logger: winston.Logger,\n options?: {\n packageRoot?: string;\n pkgJsonData?: string;\n },\n ) {\n this.logger.debug(\"Reading package information...\");\n\n this.packageRoot = options?.packageRoot ?? util.findPackageRoot(logger);\n\n let pkgJsonData: string;\n if (options?.pkgJsonData) {\n pkgJsonData = options.pkgJsonData;\n } else {\n const pkgJsonPath = path.resolve(this.packageRoot, util.packageJsonName);\n\n this.logger.debug(` - loading '${pkgJsonPath}'`);\n if (!fs.existsSync(pkgJsonPath)) {\n this.logger.error(`no '${util.packageJsonName}' file found at '${this.packageRoot}'`);\n throw util.CLIError(\"not a platform software package directory\");\n }\n\n pkgJsonData = fs.readFileSync(pkgJsonPath, \"utf8\");\n }\n\n const result = parsePackageJson(pkgJsonData);\n if (!result.success) {\n throw util.CLIError(`\\n` + util.formatZodIssues(result.error.issues));\n }\n this.pkgJson = result.data;\n this.logger.debug(\" \" + JSON.stringify(this.pkgJson));\n\n this.validateConfig();\n\n this.packageName = this.pkgJson.name;\n\n logger.debug(\" package information loaded successfully.\");\n }\n\n get isPrivate(): boolean {\n return this.pkgJson.private ?? false;\n }\n\n /** Whether every software entrypoint of this package must ship a docker image. */\n get requireDocker(): boolean {\n return this.pkgJson[\"block-software\"].requireDocker ?? true;\n }\n\n get binaryRegistries(): binaryRegistryPresets {\n return this.pkgJson[\"block-software\"].registries?.binary ?? {};\n }\n\n get entrypoints(): Map<string, entrypoints.Entrypoint> {\n const list = new Map<string, entrypoints.Entrypoint>();\n\n for (const [epName, ep] of Object.entries(this.pkgJson[\"block-software\"].entrypoints)) {\n if (ep.docker) {\n const artifactID = typeof ep.docker.artifact === \"string\" ? ep.docker.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"docker\");\n\n // will mix docker to separate entrypoint\n // render function have to merge\n list.set(docker.entrypointName(epName), {\n type: \"software\",\n name: epName,\n artifact: artifact,\n cmd: ep.docker.cmd ?? [],\n env: ep.docker.envVars ?? [],\n });\n }\n\n if (ep.reference) {\n list.set(epName, {\n type: \"reference\",\n name: epName,\n reference: ep.reference,\n });\n continue;\n }\n\n if (ep.binary || ep.conda) {\n const swOptions: entrypoints.softwareOptionsType = ep.binary ? ep.binary : ep.conda!;\n const artifactOrRef = ep.binary ? ep.binary.artifact : ep.conda!.artifact;\n const artifactID = typeof artifactOrRef === \"string\" ? artifactOrRef : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n if (artifact.type === \"asset\") {\n throw util.CLIError(`binary entrypoint cannot point to asset artifact: ${epName}`);\n }\n if (artifact.type === \"environment\") {\n throw util.CLIError(`binary entrypoint cannot point to environment artifact: ${epName}`);\n }\n\n list.set(epName, {\n type: \"software\",\n name: epName,\n artifact: artifact,\n cmd: swOptions.cmd,\n env: swOptions.envVars ?? [],\n });\n\n if (!ep.docker) {\n if (artifacts.dockerAutogenTypes.includes(artifact.type)) {\n switch (artifact.type) {\n case \"conda\":\n case \"python\":\n list.set(docker.entrypointName(epName), {\n type: \"software\",\n name: epName,\n artifact: this.generateDockerPackage(artifact),\n cmd: swOptions.cmd,\n env: swOptions.envVars ?? [],\n });\n continue;\n default: {\n throw new Error(`docker autogeneration is not defined for type: ${artifact.type}`);\n }\n }\n }\n }\n }\n\n if (ep.environment) {\n const packageID =\n typeof ep.environment.artifact === \"string\" ? ep.environment.artifact : epName;\n list.set(epName, {\n type: \"environment\",\n name: epName,\n artifact: this.getArtifact(packageID, \"environment\"),\n env: ep.environment.envVars ?? [],\n });\n continue;\n }\n\n if (ep.asset) {\n const packageID = typeof ep.asset === \"string\" ? ep.asset : epName;\n list.set(epName, {\n type: \"asset\",\n name: epName,\n artifact: this.getArtifact(packageID, \"asset\"),\n });\n continue;\n }\n\n if (list.size === 0) {\n throw util.CLIError(\n `entrypoint '${epName}' type is not supported by current platforma package builder`,\n );\n }\n }\n\n return list;\n }\n\n // Get not docker entrypoint if exists.\n // If only docker entrypoint exists, return it.\n public getMainEntrypoint(name: string): entrypoints.Entrypoint {\n const ep = this.entrypoints.get(name);\n if (ep) {\n return ep;\n }\n\n return this.entrypoints.get(docker.entrypointName(name))!;\n }\n\n /**\n * Resolves entrypoint reference to full entrypoint file path and type\n */\n public resolveReference(epName: string, ep: entrypoints.ReferenceEntrypoint): string {\n this.logger.debug(\n `resolving entrypoint '${epName}' reference '${ep.reference}'. packageRoot='${this.packageRoot}'`,\n );\n\n const refInfo = ep.reference.match(entrypoints.EnyrypointReferencePattern)?.groups;\n\n if (!refInfo) {\n this.logger.error(\n `entrypoint reference '${epName}' has incorrect reference format. <full package name>/<path to entrypoint> is expected`,\n );\n throw util.CLIError(`invalid entrypoint '${epName}' reference format`);\n }\n\n const refPath = tryResolve(this.packageRoot, ep.reference);\n if (!refPath) {\n this.logger.error(`entrypoint reference '${epName}' cannot be resolved into file path`);\n throw util.CLIError(`invalid entrypoint '${epName}' reference`);\n }\n\n return refPath;\n }\n\n // Packages are buildable artifacts with entrypoints\n get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const result = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const ep of this.entrypoints.values()) {\n if (ep.type === \"reference\") {\n // Entrypoint references are not buildable\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, ep.artifact);\n }\n }\n\n return result;\n }\n\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"docker\",\n platform: util.ArchType,\n ): string;\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"archive\",\n platform?: util.PlatformType,\n ): string;\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"archive\" | \"docker\",\n platform?: util.PlatformType | util.ArchType,\n ): string {\n const platformPart = platform ? `_${platform}` : \"\";\n return path.resolve(\n this.packageRoot,\n \"dist\",\n \"artifacts\",\n pkgID,\n `${artifactType}${platformPart}.json`,\n );\n }\n\n private generateDockerPackage(\n artifact: artifacts.withId<artifacts.pythonType | artifacts.condaType>,\n ): artifacts.withId<artifacts.dockerType> {\n switch (artifact.type) {\n case \"python\": {\n const options = pythonDockerOptions(\n this.logger,\n this.packageRoot,\n this.packageName,\n artifact.id,\n artifact,\n );\n\n return {\n id: artifact.id,\n type: \"docker\",\n registry: artifact[\"docker-registry\"],\n ...options,\n };\n }\n case \"conda\": {\n const options = condaDockerOptions(\n this.logger,\n this.packageRoot,\n artifact.id,\n artifact,\n util.currentArch(),\n );\n\n return {\n id: artifact.id,\n type: \"docker\",\n registry: artifact[\"docker-registry\"],\n ...options,\n };\n }\n default: {\n util.assertNever(artifact);\n throw new Error(\"calm down the linter\");\n }\n }\n }\n\n public getArtifact(\n id: string,\n type: \"asset\",\n ): artifacts.withId<artifacts.withType<\"asset\", artifacts.assetType>>;\n public getArtifact(id: string, type: \"environment\"): artifacts.withId<artifacts.environmentType>;\n public getArtifact(id: string, type: \"binary\"): artifacts.withId<artifacts.binaryType>;\n public getArtifact(id: string, type: \"java\"): artifacts.withId<artifacts.javaType>;\n public getArtifact(id: string, type: \"python\"): artifacts.withId<artifacts.pythonType>;\n public getArtifact(id: string, type: \"R\"): artifacts.withId<artifacts.rType>;\n public getArtifact(id: string, type: \"docker\"): artifacts.withId<artifacts.dockerType>;\n public getArtifact(id: string, type: \"conda\"): artifacts.withId<artifacts.condaType>;\n public getArtifact(id: string, type: \"any\"): artifacts.withId<artifacts.anyArtifactType>;\n public getArtifact(\n id: string,\n type: artifacts.artifactType | \"any\",\n ): artifacts.withId<artifacts.anyArtifactType> {\n const artifacts = this.pkgJson[\"block-software\"].artifacts ?? {};\n const entrypoints = this.pkgJson[\"block-software\"].entrypoints;\n\n let artifact: artifacts.anyArtifactType | undefined;\n let errMsg = \"\";\n if (artifacts[id]) {\n artifact = artifacts[id];\n } else {\n const ep = entrypoints[id];\n if (!ep) {\n throw util.CLIError(\n `artifact with id '${id}' not found neither in 'entrypoints', nor in 'artifacts'`,\n );\n }\n\n errMsg = `incorrect artifact reference in entrypoint '${id}'`;\n\n if (ep.asset) {\n artifact =\n typeof ep.asset === \"string\"\n ? artifacts[ep.asset]\n : ({ type: \"asset\", ...ep.asset } as artifacts.assetType);\n } else if (ep.binary && type !== \"docker\") {\n // single entrypoint can keep both binary and docker\n const a = ep.binary.artifact;\n artifact = typeof a === \"string\" ? artifacts[a] : a;\n } else if (ep.conda && type !== \"docker\") {\n // single entrypoint can keep both conda and docker\n const a = ep.conda.artifact;\n artifact =\n typeof a === \"string\" ? artifacts[a] : ({ type: \"conda\", ...a } as artifacts.condaType);\n } else if (ep.environment) {\n const a = ep.environment.artifact;\n artifact =\n typeof a === \"string\"\n ? artifacts[a]\n : ({ type: \"environment\", ...a } as artifacts.environmentType);\n } else if (ep.docker) {\n const a = ep.docker.artifact;\n artifact =\n typeof a === \"string\" ? artifacts[a] : ({ type: \"docker\", ...a } as artifacts.dockerType);\n }\n }\n\n if (!artifact) {\n throw util.CLIError(\n `artifact '${id}' not found neither in 'entrypoints', nor in 'artifacts'`,\n );\n }\n\n switch (type) {\n case \"docker\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"docker\", errMsg),\n };\n }\n case \"asset\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"asset\", errMsg),\n };\n }\n case \"environment\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"environment\", errMsg),\n };\n }\n case \"binary\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"binary\", errMsg),\n };\n }\n case \"java\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"java\", errMsg),\n };\n }\n case \"python\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"python\", errMsg),\n };\n }\n case \"R\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"R\", errMsg),\n };\n }\n case \"conda\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"conda\", errMsg),\n };\n }\n case \"any\": {\n return {\n id: id,\n ...artifact,\n };\n }\n default: {\n util.assertNever(type);\n throw util.CLIError(`invalid artifact type`); // calm down the linter\n }\n }\n }\n\n public set version(v: string | undefined) {\n this._versionOverride = v;\n }\n\n public artifactName(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n if (artifact.type !== \"docker\") {\n if (artifact.name) {\n return artifact.name;\n }\n }\n\n return util.trimPrefix(this.pkgJson.name, \"@\") + \"/\" + artifact.id;\n }\n\n public artifactVersion(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n const base = this.baseArtifactVersion(artifact);\n\n if (util.isDevMode(this.buildMode) && artifact.type !== \"docker\") {\n const hash = this.devContentHash(artifact);\n if (hash) {\n return `${base}-${hash}`;\n }\n }\n\n return base;\n }\n\n private baseArtifactVersion(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n if (this._versionOverride) {\n return this._versionOverride;\n }\n\n if (process.env[envs.PL_PKG_VERSION]) {\n return process.env[envs.PL_PKG_VERSION];\n }\n\n if (artifact.type !== \"docker\" && artifact.version) {\n return artifact.version;\n }\n\n return this.pkgJson.version;\n }\n\n /**\n * Short content hash of the artifact's content root(s), used as the dev version suffix.\n */\n private readonly devContentHashCache = new Map<string, string | undefined>();\n\n private devContentHash(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string | undefined {\n // Content roots are stable for the lifetime of this builder, so hash each artifact once.\n if (this.devContentHashCache.has(artifact.id)) {\n return this.devContentHashCache.get(artifact.id);\n }\n\n const hash = this.computeDevContentHash(artifact);\n this.devContentHashCache.set(artifact.id, hash);\n return hash;\n }\n\n private computeDevContentHash(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string | undefined {\n const hasher = createHash(\"sha256\");\n let hashedAny = false;\n\n let platforms: util.PlatformType[];\n try {\n // Sorted so the hash is independent of package.json root-key order.\n platforms = this.artifactPlatforms(artifact).toSorted();\n } catch {\n return undefined; // no content roots at all — leave the version without a suffix\n }\n\n for (const platform of platforms) {\n let root: string;\n try {\n root = this.artifactContentRoot(artifact, platform);\n } catch {\n continue; // platform without a defined/present root — skip\n }\n if (!fs.existsSync(root)) {\n continue;\n }\n // Hash the platform name too, so the same files under a different platform yield a different\n // hash.\n hasher.update(platform);\n util.hashDirSync(root, hasher);\n hashedAny = true;\n }\n\n return hashedAny ? hasher.digest(\"hex\").slice(0, 12) : undefined;\n }\n\n public artifactRegistrySettings(artifact: artifacts.anyArtifactType): artifacts.registry {\n if (artifact.type === \"docker\") {\n return {\n name: artifact.registry,\n };\n }\n\n const registry = artifact.registry;\n const registries = this.binaryRegistries;\n\n const result: artifacts.registry = {\n name: \"default\",\n downloadURL: registries.default?.downloadURL,\n storageURL: registries.default?.storageURL,\n };\n\n if (registry) {\n if (typeof registry === \"string\") {\n result.name = registry;\n const regDefault = wellKnownRegistries[result.name];\n result.downloadURL = registries[result.name]?.downloadURL ?? regDefault?.downloadURL;\n result.storageURL = registries[result.name]?.storageURL ?? regDefault?.storageURL;\n } else {\n result.name = registry.name;\n const regDefault = wellKnownRegistries[result.name];\n result.downloadURL =\n registry.downloadURL ?? registries[result.name]?.downloadURL ?? regDefault?.downloadURL;\n result.storageURL =\n registry.storageURL ?? registries[result.name]?.storageURL ?? regDefault?.storageURL;\n }\n }\n\n const regNameUpper = result.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n\n const uploadTo = process.env[`PL_REGISTRY_${regNameUpper}_UPLOAD_URL`];\n if (uploadTo) {\n result.storageURL = uploadTo;\n }\n\n const downloadFrom = process.env[`PL_REGISTRY_${regNameUpper}_DOWNLOAD_URL`];\n if (downloadFrom) {\n result.downloadURL = downloadFrom;\n }\n\n // Dev channel: the embedded binary registry is the built-in `midev` uploading to its built-in\n // endpoint, flipping to `dev` and `PL_DEV_BINARY_UPLOAD_URL` when that is set.\n if (util.isDevMode(this.buildMode)) {\n const devUpload = process.env[envs.PL_DEV_BINARY_UPLOAD_URL];\n result.name = devUpload\n ? defaults.DEV_BIN_REGISTRY_NAME_OVERRIDDEN\n : defaults.DEV_BIN_REGISTRY_NAME;\n result.storageURL = devUpload ?? defaults.DEV_BINARY_UPLOAD_TARGET;\n } else {\n const releaseUpload = process.env[envs.PL_RELEASE_BINARY_UPLOAD_URL];\n if (releaseUpload) {\n result.storageURL = releaseUpload;\n }\n }\n\n if (result.downloadURL) {\n const u = new URL(result.downloadURL, \"file:/nonexistent\"); // check download URL is valid URL\n if (![\"https:\", \"http:\"].includes(u.protocol)) {\n throw util.CLIError(\n `registry ${result.name} download URL is not valid. Only 'https://' and 'http://' schemes are supported for now`,\n );\n }\n }\n\n return result;\n }\n\n public artifactContentRoot(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n ): string {\n if (\"root\" in artifact && artifact.root) {\n return path.resolve(this.packageRoot, artifact.root);\n }\n if (\"roots\" in artifact && artifact.roots[platform]) {\n return path.resolve(this.packageRoot, artifact.roots[platform]);\n }\n\n throw util.CLIError(\n `root path of software archive on ${platform} is undefined for binary package`,\n );\n }\n\n public artifactPlatforms(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): util.PlatformType[] {\n if (artifact.type === \"docker\") {\n return [util.currentPlatform()];\n }\n\n if (\"root\" in artifact && artifact.root) {\n return [util.currentPlatform()];\n }\n\n if (\"roots\" in artifact) {\n return Object.keys(artifact.roots) as util.PlatformType[];\n }\n\n throw util.CLIError(\n `no platforms are defined as supported for artifact '${artifact.id}' in binary mode ` +\n `(no 'roots' are defined)`,\n );\n }\n\n public artifactArchiveFullName(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n ): string {\n const group = artifact.type === \"asset\" ? \"assets\" : \"software\";\n const extension = artifact.type === \"asset\" ? \"zip\" : \"tgz\";\n const name = this.artifactName(artifact);\n const version = this.artifactVersion(artifact);\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n return `${group}/${name}/${version}.${extension}`;\n }\n\n const { os, arch } = util.splitPlatform(platform);\n return `${group}/${name}/${version}-${os}-${arch}.${extension}`;\n }\n\n public artifactArchiveAddressPattern(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string {\n const group = artifact.type === \"asset\" ? \"assets\" : \"software\";\n const extension = artifact.type === \"asset\" ? \"zip\" : \"tgz\";\n const name = this.artifactName(artifact);\n const version = this.artifactVersion(artifact);\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n return `${group}/${name}/${version}.${extension}`;\n }\n\n return `${group}/${name}/${version}-{os}-{arch}.${extension}`;\n }\n\n private validateConfig() {\n let hasErrors: boolean = false;\n\n const blockSoftware = this.pkgJson[\"block-software\"];\n\n const as = blockSoftware.artifacts ?? {};\n const entrypoints = blockSoftware.entrypoints ?? {};\n\n for (const [epName, ep] of Object.entries(entrypoints)) {\n if (ep.binary) {\n const artifactID = typeof ep.binary.artifact === \"string\" ? ep.binary.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n\n if (!artifact) {\n this.logger.error(\n `entrypoint '${epName}' refers to artifact '${artifactID}' which is not defined in '${util.softwareConfigName}'`,\n );\n hasErrors = true;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n if (!artifacts.isBuildable(artifact.type)) {\n this.logger.error(\n `entrypoint '${epName}' artifact type '${artifact.type}' is not buildable to binary package`,\n );\n hasErrors = true;\n }\n\n if (artifact.type === \"environment\") {\n this.logger.error(\n `entrypoint '${epName}' artifact type '${artifact.type}' cannot be build into software pacakge. Use 'environment' entrypoint`,\n );\n hasErrors = true;\n }\n }\n\n if (ep.environment) {\n const artifactID =\n typeof ep.environment.artifact === \"string\" ? ep.environment.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n\n if (!artifact) {\n this.logger.error(\n `entrypoint '${epName}' refers to artifact '${artifactID}' which is not defined in '${util.softwareConfigName}'`,\n );\n hasErrors = true;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n if (artifact.type !== \"environment\") {\n this.logger.error(\n `entrypoint '${epName}' with 'environment' settings should refer to 'environment' artifact type`,\n );\n hasErrors = true;\n }\n }\n\n // TODO: add docker validation here\n // TODO(rfiskov)[MILAB-3163]: Carefully handle docker artifacts, as some (e.g., for Python) may be autogenerated dynamically rather than explicitly defined.\n }\n\n const uniquePackageNames = new Set<string>();\n\n for (const [artifactID, artifact] of Object.entries(as)) {\n if (!artifacts.isBuildable(artifact.type)) {\n continue;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n const withId = { id: artifactID, ...artifact };\n const name = this.artifactName(withId);\n const version = this.artifactVersion(withId);\n const uniqueName = `${name}-${version}`;\n if (uniquePackageNames.has(uniqueName)) {\n this.logger.error(\n `found two packages with the same name '${name}' and version '${version}'`,\n );\n hasErrors = true;\n }\n\n uniquePackageNames.add(uniqueName);\n }\n\n if (hasErrors) {\n throw util.CLIError(\n `${util.softwareConfigName} has xconfiguration errors in 'block-software' section. See error log messages above for details`,\n );\n }\n }\n\n private validateArtifact(artifactName: string, artifact: artifacts.anyArtifactType): boolean {\n if (artifacts.isBuildable(artifact.type)) {\n // Validate that root is not equal to package root\n const resolvedRoots: string[] = [];\n const aType = artifact.type;\n switch (aType) {\n case \"asset\":\n case \"java\":\n case \"R\":\n case \"python\": {\n resolvedRoots.push(path.resolve(this.packageRoot, artifact.root));\n break;\n }\n case \"docker\": {\n resolvedRoots.push(path.resolve(this.packageRoot, artifact.context));\n break;\n }\n case \"environment\":\n case \"conda\":\n case \"binary\": {\n resolvedRoots.push(\n ...Object.values(artifact.roots).map((root) => path.resolve(this.packageRoot, root)),\n );\n break;\n }\n default:\n util.assertNever(aType);\n }\n\n for (const root of resolvedRoots) {\n if (root === this.packageRoot) {\n this.logger.error(\n `Invalid configuration: '${artifact.type}' artifact '${artifactName}' has 'root' set to the package root, which is not allowed`,\n );\n return false;\n }\n }\n }\n\n return true;\n }\n}\n\nfunction parsePackageJson(data: string): z.ZodSafeParseResult<packageJson> {\n const parsedData: unknown = JSON.parse(data);\n return packageJsonSchema.safeParse(parsedData);\n}\n\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"asset\",\n errMsg: string,\n): artifacts.withType<\"asset\", artifacts.assetType>;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"environment\",\n errMsg: string,\n): artifacts.environmentType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"java\",\n errMsg: string,\n): artifacts.javaType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"python\",\n errMsg: string,\n): artifacts.pythonType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"R\",\n errMsg: string,\n): artifacts.rType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"binary\",\n errMsg: string,\n): artifacts.binaryType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"docker\",\n errMsg: string,\n): artifacts.dockerType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"conda\",\n errMsg: string,\n): artifacts.condaType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: artifacts.artifactType,\n errMsg: string,\n): artifacts.anyArtifactType {\n if (artifact.type === type) {\n return artifact;\n }\n\n if (errMsg) {\n errMsg = `${errMsg}: `;\n }\n\n throw util.CLIError(`${errMsg}wrong artifact type: expected '${type}', got '${artifact.type}'`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,sBAAsBA,OAAAA,EAAE,OAAO;CACnC,aAAaA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,YAAYA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;AAClC,CAAC;AAGD,M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EA,IAAI,WACF,MAAA,aAAA,SACE,GAAA,aAAA,mBAA2B,iGAC7B;CAEJ;CAEA,iBAAyB,cAAsB,UAA8C;EAC3F,IAAA,kBAAA,YAA0B,SAAS,IAAI,GAAG;GAExC,MAAM,gBAA0B,CAAC;GACjC,MAAM,QAAQ,SAAS;GACvB,QAAQ,OAAR;IACE,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;KACH,cAAc,KAAKA,UAAK,QAAQ,KAAK,aAAa,SAAS,IAAI,CAAC;KAChE;IAEF,KAAK;KACH,cAAc,KAAKA,UAAK,QAAQ,KAAK,aAAa,SAAS,OAAO,CAAC;KACnE;IAEF,KAAK;IACL,KAAK;IACL,KAAK;KACH,cAAc,KACZ,GAAG,OAAO,OAAO,SAAS,KAAK,CAAC,CAAC,KAAK,SAASA,UAAK,QAAQ,KAAK,aAAa,IAAI,CAAC,CACrF;KACA;IAEF,SACE,aAAA,YAAiB,KAAK;GAC1B;GAEA,KAAK,MAAM,QAAQ,eACjB,IAAI,SAAS,KAAK,aAAa;IAC7B,KAAK,OAAO,MACV,2BAA2B,SAAS,KAAK,cAAc,aAAa,2DACtE;IACA,OAAO;GACT;EAEJ;EAEA,OAAO;CACT;AACF;AAEA,SAAS,iBAAiB,MAAiD;CACzE,MAAM,aAAsB,KAAK,MAAM,IAAI;CAC3C,OAAO,kBAAkB,UAAU,UAAU;AAC/C;AA0CA,SAAS,oBACP,UACA,MACA,QAC2B;CAC3B,IAAI,SAAS,SAAS,MACpB,OAAO;CAGT,IAAI,QACF,SAAS,GAAG,OAAO;CAGrB,MAAA,aAAA,SAAoB,GAAG,OAAO,iCAAiC,KAAK,UAAU,SAAS,KAAK,EAAE;AAChG"}
|
|
1
|
+
{"version":3,"file":"package-info.cjs","names":["z","path","fs","tryResolve","pythonDockerOptions","condaDockerOptions","createHash"],"sources":["../../src/core/package-info.ts"],"sourcesContent":["import * as path from \"node:path\";\nimport * as fs from \"node:fs\";\nimport { createHash } from \"node:crypto\";\nimport type winston from \"winston\";\nimport { z } from \"zod/v4\";\n\nimport * as defaults from \"../defaults\";\nimport * as util from \"./util\";\nimport * as envs from \"./envs\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport * as entrypoints from \"./schemas/entrypoints\";\nimport { tryResolve } from \"@milaboratories/resolve-helper\";\nimport * as docker from \"./docker\";\nimport { prepareDockerOptions as pythonDockerOptions } from \"./docker-python\";\nimport { prepareDockerOptions as condaDockerOptions } from \"./docker-conda\";\n\nconst storagePresetSchema = z.object({\n downloadURL: z.string().optional(),\n storageURL: z.string().optional(),\n});\ntype storagePreset = z.infer<typeof storagePresetSchema>;\n\nconst binaryRegistryPresetsSchema = z.record(z.string(), storagePresetSchema);\ntype binaryRegistryPresets = z.infer<typeof binaryRegistryPresetsSchema>;\n\nconst packageJsonSchema = z.object({\n name: z.string(),\n version: z.string(),\n private: z.boolean().optional(),\n\n \"block-software\": z.object({\n registries: z\n .object({\n binary: binaryRegistryPresetsSchema.optional(),\n })\n .optional(),\n\n artifacts: artifacts.artifactIndexSchema.optional(),\n entrypoints: entrypoints.entrypointListSchema,\n\n // Opt out of the \"every software entrypoint needs a docker image\" rule for a\n // package that is deliberately binary-only. Kept here rather than behind a CLI\n // flag or env var: the exception belongs to the package, where it is reviewable,\n // not to whichever CI run happens to build it. See core/docker-coverage.ts.\n requireDocker: z.boolean().optional(),\n }),\n});\ntype packageJson = z.infer<typeof packageJsonSchema>;\n\nconst wellKnownRegistries: Record<string, storagePreset> = {\n [defaults.BIN_REGISTRY_NAME]: {\n downloadURL: defaults.BIN_REGISTRY_DOWNLOAD_URL,\n },\n};\n\n/*\n * package.json -> block-software structure example:\n * {\n * \"block-software\": {\n * \"registries\": {\n * \"binary\": {\n * \"default\": { \"uploadURL\": \"s3://<bucket>/<some-prefix>?region=<region-name>\" }\n * }\n * },\n *\n * \"artifacts\": {\n * \"pkg-1\": {\n * \"type\": \"binary\",\n * \"roots\": {\n * \"linux-x64\": \"./linux-x64/src\",\n * \"linux-aarch64\": \"./linux-aarch/src\",\n * \"...and so on...\": \"platform-dependant roots\",\n * }\n * }\n * }\n *\n * \"entrypoints\": {\n * \"script1\": {\n * \"software\": {\n * \"artifact\": \"pkg-1\",\n * \"cmd\": [ \"{pkg}/script1\" ]\n * }\n * }\n * }\n * }\n * }\n */\nexport class PackageInfo {\n public readonly packageRoot: string;\n public readonly packageName: string;\n\n private readonly pkgJson: packageJson;\n private _versionOverride: string | undefined;\n\n /** Backing store for `Core.buildMode` (Core delegates its accessor here); gates content-addressable dev naming. */\n public buildMode: util.BuildMode = \"release\";\n\n constructor(\n private logger: winston.Logger,\n options?: {\n packageRoot?: string;\n pkgJsonData?: string;\n },\n ) {\n this.logger.debug(\"Reading package information...\");\n\n this.packageRoot = options?.packageRoot ?? util.findPackageRoot(logger);\n\n let pkgJsonData: string;\n if (options?.pkgJsonData) {\n pkgJsonData = options.pkgJsonData;\n } else {\n const pkgJsonPath = path.resolve(this.packageRoot, util.packageJsonName);\n\n this.logger.debug(` - loading '${pkgJsonPath}'`);\n if (!fs.existsSync(pkgJsonPath)) {\n this.logger.error(`no '${util.packageJsonName}' file found at '${this.packageRoot}'`);\n throw util.CLIError(\"not a platform software package directory\");\n }\n\n pkgJsonData = fs.readFileSync(pkgJsonPath, \"utf8\");\n }\n\n const result = parsePackageJson(pkgJsonData);\n if (!result.success) {\n throw util.CLIError(`\\n` + util.formatZodIssues(result.error.issues));\n }\n this.pkgJson = result.data;\n this.logger.debug(\" \" + JSON.stringify(this.pkgJson));\n\n this.validateConfig();\n\n this.packageName = this.pkgJson.name;\n\n logger.debug(\" package information loaded successfully.\");\n }\n\n get isPrivate(): boolean {\n return this.pkgJson.private ?? false;\n }\n\n /** Whether every software entrypoint of this package must ship a docker image. */\n get requireDocker(): boolean {\n return this.pkgJson[\"block-software\"].requireDocker ?? true;\n }\n\n get binaryRegistries(): binaryRegistryPresets {\n return this.pkgJson[\"block-software\"].registries?.binary ?? {};\n }\n\n get entrypoints(): Map<string, entrypoints.Entrypoint> {\n const list = new Map<string, entrypoints.Entrypoint>();\n\n for (const [epName, ep] of Object.entries(this.pkgJson[\"block-software\"].entrypoints)) {\n if (ep.docker) {\n const artifactID = typeof ep.docker.artifact === \"string\" ? ep.docker.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"docker\");\n\n // will mix docker to separate entrypoint\n // render function have to merge\n list.set(docker.entrypointName(epName), {\n type: \"software\",\n name: epName,\n artifact: artifact,\n cmd: ep.docker.cmd ?? [],\n env: ep.docker.envVars ?? [],\n });\n }\n\n if (ep.reference) {\n list.set(epName, {\n type: \"reference\",\n name: epName,\n reference: ep.reference,\n });\n continue;\n }\n\n if (ep.binary || ep.conda) {\n const swOptions: entrypoints.softwareOptionsType = ep.binary ? ep.binary : ep.conda!;\n const artifactOrRef = ep.binary ? ep.binary.artifact : ep.conda!.artifact;\n const artifactID = typeof artifactOrRef === \"string\" ? artifactOrRef : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n if (artifact.type === \"asset\") {\n throw util.CLIError(`binary entrypoint cannot point to asset artifact: ${epName}`);\n }\n if (artifact.type === \"environment\") {\n throw util.CLIError(`binary entrypoint cannot point to environment artifact: ${epName}`);\n }\n\n list.set(epName, {\n type: \"software\",\n name: epName,\n artifact: artifact,\n cmd: swOptions.cmd,\n env: swOptions.envVars ?? [],\n });\n\n if (!ep.docker) {\n if (artifacts.dockerAutogenTypes.includes(artifact.type)) {\n switch (artifact.type) {\n case \"conda\":\n case \"python\":\n list.set(docker.entrypointName(epName), {\n type: \"software\",\n name: epName,\n artifact: this.generateDockerPackage(artifact),\n cmd: swOptions.cmd,\n env: swOptions.envVars ?? [],\n });\n continue;\n default: {\n throw new Error(`docker autogeneration is not defined for type: ${artifact.type}`);\n }\n }\n }\n }\n }\n\n if (ep.environment) {\n const packageID =\n typeof ep.environment.artifact === \"string\" ? ep.environment.artifact : epName;\n list.set(epName, {\n type: \"environment\",\n name: epName,\n artifact: this.getArtifact(packageID, \"environment\"),\n env: ep.environment.envVars ?? [],\n });\n continue;\n }\n\n if (ep.asset) {\n const packageID = typeof ep.asset === \"string\" ? ep.asset : epName;\n list.set(epName, {\n type: \"asset\",\n name: epName,\n artifact: this.getArtifact(packageID, \"asset\"),\n });\n continue;\n }\n\n if (list.size === 0) {\n throw util.CLIError(\n `entrypoint '${epName}' type is not supported by current platforma package builder`,\n );\n }\n }\n\n return list;\n }\n\n // Get not docker entrypoint if exists.\n // If only docker entrypoint exists, return it.\n public getMainEntrypoint(name: string): entrypoints.Entrypoint {\n const ep = this.entrypoints.get(name);\n if (ep) {\n return ep;\n }\n\n return this.entrypoints.get(docker.entrypointName(name))!;\n }\n\n /**\n * Resolves entrypoint reference to full entrypoint file path and type\n */\n public resolveReference(epName: string, ep: entrypoints.ReferenceEntrypoint): string {\n this.logger.debug(\n `resolving entrypoint '${epName}' reference '${ep.reference}'. packageRoot='${this.packageRoot}'`,\n );\n\n const refInfo = ep.reference.match(entrypoints.EnyrypointReferencePattern)?.groups;\n\n if (!refInfo) {\n this.logger.error(\n `entrypoint reference '${epName}' has incorrect reference format. <full package name>/<path to entrypoint> is expected`,\n );\n throw util.CLIError(`invalid entrypoint '${epName}' reference format`);\n }\n\n const refPath = tryResolve(this.packageRoot, ep.reference);\n if (!refPath) {\n this.logger.error(`entrypoint reference '${epName}' cannot be resolved into file path`);\n throw util.CLIError(`invalid entrypoint '${epName}' reference`);\n }\n\n return refPath;\n }\n\n // Packages are buildable artifacts with entrypoints\n get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const result = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const ep of this.entrypoints.values()) {\n if (ep.type === \"reference\") {\n // Entrypoint references are not buildable\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, ep.artifact);\n }\n }\n\n return result;\n }\n\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"docker\",\n platform: util.ArchType,\n ): string;\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"archive\",\n platform?: util.PlatformType,\n ): string;\n public artifactInfoLocation(\n pkgID: string,\n artifactType: \"archive\" | \"docker\",\n platform?: util.PlatformType | util.ArchType,\n ): string {\n const platformPart = platform ? `_${platform}` : \"\";\n return path.resolve(\n this.packageRoot,\n \"dist\",\n \"artifacts\",\n pkgID,\n `${artifactType}${platformPart}.json`,\n );\n }\n\n private generateDockerPackage(\n artifact: artifacts.withId<artifacts.pythonType | artifacts.condaType>,\n ): artifacts.withId<artifacts.dockerType> {\n switch (artifact.type) {\n case \"python\": {\n const options = pythonDockerOptions(\n this.logger,\n this.packageRoot,\n this.packageName,\n artifact.id,\n artifact,\n );\n\n return {\n id: artifact.id,\n type: \"docker\",\n registry: artifact[\"docker-registry\"],\n ...options,\n };\n }\n case \"conda\": {\n const options = condaDockerOptions(\n this.logger,\n this.packageRoot,\n artifact.id,\n artifact,\n util.currentArch(),\n );\n\n return {\n id: artifact.id,\n type: \"docker\",\n registry: artifact[\"docker-registry\"],\n ...options,\n };\n }\n default: {\n util.assertNever(artifact);\n throw new Error(\"calm down the linter\");\n }\n }\n }\n\n public getArtifact(\n id: string,\n type: \"asset\",\n ): artifacts.withId<artifacts.withType<\"asset\", artifacts.assetType>>;\n public getArtifact(id: string, type: \"environment\"): artifacts.withId<artifacts.environmentType>;\n public getArtifact(id: string, type: \"binary\"): artifacts.withId<artifacts.binaryType>;\n public getArtifact(id: string, type: \"java\"): artifacts.withId<artifacts.javaType>;\n public getArtifact(id: string, type: \"python\"): artifacts.withId<artifacts.pythonType>;\n public getArtifact(id: string, type: \"R\"): artifacts.withId<artifacts.rType>;\n public getArtifact(id: string, type: \"docker\"): artifacts.withId<artifacts.dockerType>;\n public getArtifact(id: string, type: \"conda\"): artifacts.withId<artifacts.condaType>;\n public getArtifact(id: string, type: \"any\"): artifacts.withId<artifacts.anyArtifactType>;\n public getArtifact(\n id: string,\n type: artifacts.artifactType | \"any\",\n ): artifacts.withId<artifacts.anyArtifactType> {\n const artifacts = this.pkgJson[\"block-software\"].artifacts ?? {};\n const entrypoints = this.pkgJson[\"block-software\"].entrypoints;\n\n let artifact: artifacts.anyArtifactType | undefined;\n let errMsg = \"\";\n if (artifacts[id]) {\n artifact = artifacts[id];\n } else {\n const ep = entrypoints[id];\n if (!ep) {\n throw util.CLIError(\n `artifact with id '${id}' not found neither in 'entrypoints', nor in 'artifacts'`,\n );\n }\n\n errMsg = `incorrect artifact reference in entrypoint '${id}'`;\n\n if (ep.asset) {\n artifact =\n typeof ep.asset === \"string\"\n ? artifacts[ep.asset]\n : ({ type: \"asset\", ...ep.asset } as artifacts.assetType);\n } else if (ep.binary && type !== \"docker\") {\n // single entrypoint can keep both binary and docker\n const a = ep.binary.artifact;\n artifact = typeof a === \"string\" ? artifacts[a] : a;\n } else if (ep.conda && type !== \"docker\") {\n // single entrypoint can keep both conda and docker\n const a = ep.conda.artifact;\n artifact =\n typeof a === \"string\" ? artifacts[a] : ({ type: \"conda\", ...a } as artifacts.condaType);\n } else if (ep.environment) {\n const a = ep.environment.artifact;\n artifact =\n typeof a === \"string\"\n ? artifacts[a]\n : ({ type: \"environment\", ...a } as artifacts.environmentType);\n } else if (ep.docker) {\n const a = ep.docker.artifact;\n artifact =\n typeof a === \"string\" ? artifacts[a] : ({ type: \"docker\", ...a } as artifacts.dockerType);\n }\n }\n\n if (!artifact) {\n throw util.CLIError(\n `artifact '${id}' not found neither in 'entrypoints', nor in 'artifacts'`,\n );\n }\n\n switch (type) {\n case \"docker\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"docker\", errMsg),\n };\n }\n case \"asset\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"asset\", errMsg),\n };\n }\n case \"environment\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"environment\", errMsg),\n };\n }\n case \"binary\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"binary\", errMsg),\n };\n }\n case \"java\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"java\", errMsg),\n };\n }\n case \"python\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"python\", errMsg),\n };\n }\n case \"R\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"R\", errMsg),\n };\n }\n case \"conda\": {\n return {\n id: id,\n ...requireArtifactType(artifact, \"conda\", errMsg),\n };\n }\n case \"any\": {\n return {\n id: id,\n ...artifact,\n };\n }\n default: {\n util.assertNever(type);\n throw util.CLIError(`invalid artifact type`); // calm down the linter\n }\n }\n }\n\n public set version(v: string | undefined) {\n this._versionOverride = v;\n }\n\n public artifactName(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n if (artifact.type !== \"docker\") {\n if (artifact.name) {\n return artifact.name;\n }\n }\n\n return util.trimPrefix(this.pkgJson.name, \"@\") + \"/\" + artifact.id;\n }\n\n public artifactVersion(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n const base = this.baseArtifactVersion(artifact);\n\n if (util.isDevMode(this.buildMode) && artifact.type !== \"docker\") {\n const hash = this.devContentHash(artifact);\n if (hash) {\n return `${base}-${hash}`;\n }\n }\n\n return base;\n }\n\n private baseArtifactVersion(artifact: artifacts.withId<artifacts.anyArtifactType>): string {\n if (this._versionOverride) {\n return this._versionOverride;\n }\n\n if (process.env[envs.PL_PKG_VERSION]) {\n return process.env[envs.PL_PKG_VERSION];\n }\n\n if (artifact.type !== \"docker\" && artifact.version) {\n return artifact.version;\n }\n\n return this.pkgJson.version;\n }\n\n /**\n * Short content hash of the artifact's content root(s), used as the dev version suffix.\n */\n private readonly devContentHashCache = new Map<string, string | undefined>();\n\n private devContentHash(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string | undefined {\n // Content roots are stable for the lifetime of this builder, so hash each artifact once.\n if (this.devContentHashCache.has(artifact.id)) {\n return this.devContentHashCache.get(artifact.id);\n }\n\n const hash = this.computeDevContentHash(artifact);\n this.devContentHashCache.set(artifact.id, hash);\n return hash;\n }\n\n private computeDevContentHash(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string | undefined {\n const hasher = createHash(\"sha256\");\n let hashedAny = false;\n\n let platforms: util.PlatformType[];\n try {\n // Sorted so the hash is independent of package.json root-key order.\n platforms = this.artifactPlatforms(artifact).toSorted();\n } catch {\n return undefined; // no content roots at all — leave the version without a suffix\n }\n\n for (const platform of platforms) {\n let root: string;\n try {\n root = this.artifactContentRoot(artifact, platform);\n } catch {\n continue; // platform without a defined/present root — skip\n }\n if (!fs.existsSync(root)) {\n continue;\n }\n // Hash the platform name too, so the same files under a different platform yield a different\n // hash.\n hasher.update(platform);\n util.hashDirSync(root, hasher);\n hashedAny = true;\n }\n\n return hashedAny ? hasher.digest(\"hex\").slice(0, 12) : undefined;\n }\n\n public artifactRegistrySettings(artifact: artifacts.anyArtifactType): artifacts.registry {\n if (artifact.type === \"docker\") {\n return {\n name: artifact.registry,\n };\n }\n\n const registry = artifact.registry;\n const registries = this.binaryRegistries;\n\n const result: artifacts.registry = {\n name: \"default\",\n downloadURL: registries.default?.downloadURL,\n storageURL: registries.default?.storageURL,\n };\n\n if (registry) {\n if (typeof registry === \"string\") {\n result.name = registry;\n const regDefault = wellKnownRegistries[result.name];\n result.downloadURL = registries[result.name]?.downloadURL ?? regDefault?.downloadURL;\n result.storageURL = registries[result.name]?.storageURL ?? regDefault?.storageURL;\n } else {\n result.name = registry.name;\n const regDefault = wellKnownRegistries[result.name];\n result.downloadURL =\n registry.downloadURL ?? registries[result.name]?.downloadURL ?? regDefault?.downloadURL;\n result.storageURL =\n registry.storageURL ?? registries[result.name]?.storageURL ?? regDefault?.storageURL;\n }\n }\n\n const regNameUpper = result.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n\n const uploadTo = process.env[`PL_REGISTRY_${regNameUpper}_UPLOAD_URL`];\n if (uploadTo) {\n result.storageURL = uploadTo;\n }\n\n const downloadFrom = process.env[`PL_REGISTRY_${regNameUpper}_DOWNLOAD_URL`];\n if (downloadFrom) {\n result.downloadURL = downloadFrom;\n }\n\n // Dev channel: the embedded binary registry is the built-in `midev` uploading to its built-in\n // endpoint, flipping to `dev` and `PL_DEV_BINARY_UPLOAD_URL` when that is set.\n if (util.isDevMode(this.buildMode)) {\n const devUpload = process.env[envs.PL_DEV_BINARY_UPLOAD_URL];\n result.name = devUpload\n ? defaults.DEV_BIN_REGISTRY_NAME_OVERRIDDEN\n : defaults.DEV_BIN_REGISTRY_NAME;\n result.storageURL = devUpload ?? defaults.DEV_BINARY_UPLOAD_TARGET;\n } else {\n const releaseUpload = process.env[envs.PL_RELEASE_BINARY_UPLOAD_URL];\n if (releaseUpload) {\n result.storageURL = releaseUpload;\n }\n }\n\n if (result.downloadURL) {\n const u = new URL(result.downloadURL, \"file:/nonexistent\"); // check download URL is valid URL\n if (![\"https:\", \"http:\"].includes(u.protocol)) {\n throw util.CLIError(\n `registry ${result.name} download URL is not valid. Only 'https://' and 'http://' schemes are supported for now`,\n );\n }\n }\n\n return result;\n }\n\n public artifactContentRoot(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n ): string {\n if (\"root\" in artifact && artifact.root) {\n return path.resolve(this.packageRoot, artifact.root);\n }\n if (\"roots\" in artifact && artifact.roots[platform]) {\n return path.resolve(this.packageRoot, artifact.roots[platform]);\n }\n\n throw util.CLIError(\n `root path of software archive on ${platform} is undefined for binary package`,\n );\n }\n\n public artifactPlatforms(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): util.PlatformType[] {\n if (artifact.type === \"docker\") {\n return [util.currentPlatform()];\n }\n\n if (\"root\" in artifact && artifact.root) {\n return [util.currentPlatform()];\n }\n\n if (\"roots\" in artifact) {\n return Object.keys(artifact.roots) as util.PlatformType[];\n }\n\n throw util.CLIError(\n `no platforms are defined as supported for artifact '${artifact.id}' in binary mode ` +\n `(no 'roots' are defined)`,\n );\n }\n\n public artifactArchiveFullName(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n ): string {\n const group = artifact.type === \"asset\" ? \"assets\" : \"software\";\n const extension = artifact.type === \"asset\" ? \"zip\" : \"tgz\";\n const name = this.artifactName(artifact);\n const version = this.artifactVersion(artifact);\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n return `${group}/${name}/${version}.${extension}`;\n }\n\n const { os, arch } = util.splitPlatform(platform);\n return `${group}/${name}/${version}-${os}-${arch}.${extension}`;\n }\n\n public artifactArchiveAddressPattern(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n ): string {\n const group = artifact.type === \"asset\" ? \"assets\" : \"software\";\n const extension = artifact.type === \"asset\" ? \"zip\" : \"tgz\";\n const name = this.artifactName(artifact);\n const version = this.artifactVersion(artifact);\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n return `${group}/${name}/${version}.${extension}`;\n }\n\n return `${group}/${name}/${version}-{os}-{arch}.${extension}`;\n }\n\n private validateConfig() {\n let hasErrors: boolean = false;\n\n const blockSoftware = this.pkgJson[\"block-software\"];\n\n const as = blockSoftware.artifacts ?? {};\n const entrypoints = blockSoftware.entrypoints ?? {};\n\n for (const [epName, ep] of Object.entries(entrypoints)) {\n if (ep.binary) {\n const artifactID = typeof ep.binary.artifact === \"string\" ? ep.binary.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n\n if (!artifact) {\n this.logger.error(\n `entrypoint '${epName}' refers to artifact '${artifactID}' which is not defined in '${util.softwareConfigName}'`,\n );\n hasErrors = true;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n if (!artifacts.isBuildable(artifact.type)) {\n this.logger.error(\n `entrypoint '${epName}' artifact type '${artifact.type}' is not buildable to binary package`,\n );\n hasErrors = true;\n }\n\n if (artifact.type === \"environment\") {\n this.logger.error(\n `entrypoint '${epName}' artifact type '${artifact.type}' cannot be build into software pacakge. Use 'environment' entrypoint`,\n );\n hasErrors = true;\n }\n }\n\n if (ep.environment) {\n const artifactID =\n typeof ep.environment.artifact === \"string\" ? ep.environment.artifact : epName;\n const artifact = this.getArtifact(artifactID, \"any\");\n\n if (!artifact) {\n this.logger.error(\n `entrypoint '${epName}' refers to artifact '${artifactID}' which is not defined in '${util.softwareConfigName}'`,\n );\n hasErrors = true;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n if (artifact.type !== \"environment\") {\n this.logger.error(\n `entrypoint '${epName}' with 'environment' settings should refer to 'environment' artifact type`,\n );\n hasErrors = true;\n }\n }\n\n // TODO: add docker validation here\n // TODO(rfiskov)[MILAB-3163]: Carefully handle docker artifacts, as some (e.g., for Python) may be autogenerated dynamically rather than explicitly defined.\n }\n\n const uniquePackageNames = new Set<string>();\n\n for (const [artifactID, artifact] of Object.entries(as)) {\n if (!artifacts.isBuildable(artifact.type)) {\n continue;\n }\n\n if (!this.validateArtifact(artifactID, artifact)) {\n hasErrors = true;\n }\n\n const withId = { id: artifactID, ...artifact };\n const name = this.artifactName(withId);\n const version = this.artifactVersion(withId);\n const uniqueName = `${name}-${version}`;\n if (uniquePackageNames.has(uniqueName)) {\n this.logger.error(\n `found two packages with the same name '${name}' and version '${version}'`,\n );\n hasErrors = true;\n }\n\n uniquePackageNames.add(uniqueName);\n }\n\n if (hasErrors) {\n throw util.CLIError(\n `${util.softwareConfigName} has xconfiguration errors in 'block-software' section. See error log messages above for details`,\n );\n }\n }\n\n private validateArtifact(artifactName: string, artifact: artifacts.anyArtifactType): boolean {\n if (artifacts.isBuildable(artifact.type)) {\n // Validate that root is not equal to package root\n const resolvedRoots: string[] = [];\n const aType = artifact.type;\n switch (aType) {\n case \"asset\":\n case \"java\":\n case \"R\":\n case \"python\": {\n resolvedRoots.push(path.resolve(this.packageRoot, artifact.root));\n break;\n }\n case \"docker\": {\n resolvedRoots.push(path.resolve(this.packageRoot, artifact.context));\n break;\n }\n case \"environment\":\n case \"conda\":\n case \"binary\": {\n resolvedRoots.push(\n ...Object.values(artifact.roots).map((root) => path.resolve(this.packageRoot, root)),\n );\n break;\n }\n default:\n util.assertNever(aType);\n }\n\n for (const root of resolvedRoots) {\n if (root === this.packageRoot) {\n this.logger.error(\n `Invalid configuration: '${artifact.type}' artifact '${artifactName}' has 'root' set to the package root, which is not allowed`,\n );\n return false;\n }\n }\n }\n\n return true;\n }\n}\n\nfunction parsePackageJson(data: string): z.ZodSafeParseResult<packageJson> {\n const parsedData: unknown = JSON.parse(data);\n return packageJsonSchema.safeParse(parsedData);\n}\n\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"asset\",\n errMsg: string,\n): artifacts.withType<\"asset\", artifacts.assetType>;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"environment\",\n errMsg: string,\n): artifacts.environmentType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"java\",\n errMsg: string,\n): artifacts.javaType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"python\",\n errMsg: string,\n): artifacts.pythonType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"R\",\n errMsg: string,\n): artifacts.rType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"binary\",\n errMsg: string,\n): artifacts.binaryType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"docker\",\n errMsg: string,\n): artifacts.dockerType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: \"conda\",\n errMsg: string,\n): artifacts.condaType;\nfunction requireArtifactType(\n artifact: artifacts.anyArtifactType,\n type: artifacts.artifactType,\n errMsg: string,\n): artifacts.anyArtifactType {\n if (artifact.type === type) {\n return artifact;\n }\n\n if (errMsg) {\n errMsg = `${errMsg}: `;\n }\n\n throw util.CLIError(`${errMsg}wrong artifact type: expected '${type}', got '${artifact.type}'`);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,sBAAsBA,OAAAA,EAAE,OAAO;CACnC,aAAaA,OAAAA,EAAE,OAAO,CAAC,CAAC,SAAS;CACjC,YAAYA,OAAAA,EAAE,OAAO,CAAC,CAAC,SA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ReferenceEntrypoint
|
|
1
|
+
import { ArchType, BuildMode, PlatformType } from "./util.js";
|
|
2
|
+
import { anyArtifactType, assetType, binaryType, condaType, dockerType, environmentType, javaType, pythonType, rType, registry, withId, withType } from "./schemas/artifacts.js";
|
|
3
|
+
import { Entrypoint, ReferenceEntrypoint } from "./schemas/entrypoints.js";
|
|
4
4
|
import { z } from "zod/v4";
|
|
5
5
|
import winston from "winston";
|
|
6
|
-
//#region src/core/package-info.d.ts
|
|
7
6
|
declare const binaryRegistryPresetsSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
8
7
|
downloadURL: z.ZodOptional<z.ZodString>;
|
|
9
8
|
storageURL: z.ZodOptional<z.ZodString>;
|
|
@@ -62,5 +61,5 @@ export declare class PackageInfo {
|
|
|
62
61
|
private validateConfig;
|
|
63
62
|
private validateArtifact;
|
|
64
63
|
}
|
|
65
|
-
|
|
64
|
+
export {};
|
|
66
65
|
//# sourceMappingURL=package-info.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-info.d.ts","names":[],"sources":["../../src/core/package-info.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"package-info.d.ts","names":["util.BuildMode","entrypoints.Entrypoint","entrypoints.ReferenceEntrypoint","artifacts.anyArtifactType","artifacts.withId","util.ArchType","util.PlatformType","artifacts.assetType","artifacts.withType","artifacts.environmentType","artifacts.binaryType","artifacts.javaType","artifacts.pythonType","artifacts.rType","artifacts.dockerType","artifacts.condaType","artifacts.registry"],"sources":["../../src/core/package-info.ts"],"mappings":";;;;;cAsBM,6BAA2B,EAAA,UAAA,EAAA,WAAA,EAAA;;;GAA4C,EAAA,KAAA;KACxE,wBAAwB,EAAE,aAAa;qBAgE/B;UAWD;WAVM;WACA;mBAEC;UACT;;EAGD,WAAWA;EAElB,YACU,QAAQ,QAAQ,QACxB;IACE;IACA;;MAoCA;;MAKA;MAIA,oBAAoB;MAIpB,eAAe,YAAYC;EAuGxB,kBAAkB,eAAeA;;;;EAYjC,iBAAiB,gBAAgB,IAAIC;MAwBxC,YAAY,YAAYE,OAAiBD;EAiBtC,qBACL,eACA,wBACA,UAAUE;EAEL,qBACL,eACA,yBACA,WAAWC;UAiBL;EA2CD,YACL,YACA,gBACCF,OAAiBI,kBAA4BD;EACzC,YAAY,YAAY,sBAAsBH,OAAiBK;EAC/D,YAAY,YAAY,iBAAiBL,OAAiBM;EAC1D,YAAY,YAAY,eAAeN,OAAiBO;EACxD,YAAY,YAAY,iBAAiBP,OAAiBQ;EAC1D,YAAY,YAAY,YAAYR,OAAiBS;EACrD,YAAY,YAAY,iBAAiBT,OAAiBU;EAC1D,YAAY,YAAY,gBAAgBV,OAAiBW;EACzD,YAAY,YAAY,cAAcX,OAAiBD;MAqHnD,QAAQ;EAIZ,aAAa,UAAUC,OAAiBD;EAUxC,gBAAgB,UAAUC,OAAiBD;UAa1C;;;;mBAmBS;UAET;UAaA;EAkCD,yBAAyB,UAAUA,kBAA4Ba;EAuE/D,oBACL,UAAUZ,OAAiBD,kBAC3B,UAAUG;EAcL,kBACL,UAAUF,OAAiBD,mBAC1BG;EAmBI,wBACL,UAAUF,OAAiBD,kBAC3B,UAAUG;EAeL,8BACL,UAAUF,OAAiBD;UAcrB;UAmGA"}
|