@platforma-sdk/package-builder-lib 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/archive.cjs +3 -3
- package/dist/core/archive.cjs.map +1 -1
- package/dist/core/archive.js.map +1 -1
- package/dist/core/conda/builder.cjs +9 -4
- package/dist/core/conda/builder.cjs.map +1 -1
- package/dist/core/conda/builder.js +5 -1
- package/dist/core/conda/builder.js.map +1 -1
- package/dist/core/conda/validate-spec.cjs +2 -2
- package/dist/core/conda/validate-spec.cjs.map +1 -1
- package/dist/core/conda/validate-spec.js.map +1 -1
- package/dist/core/core.cjs +29 -8
- package/dist/core/core.cjs.map +1 -1
- package/dist/core/core.d.ts +6 -1
- package/dist/core/core.d.ts.map +1 -1
- package/dist/core/core.js +27 -6
- package/dist/core/core.js.map +1 -1
- package/dist/core/docker-conda.cjs +2 -2
- package/dist/core/docker-conda.cjs.map +1 -1
- package/dist/core/docker-conda.js.map +1 -1
- package/dist/core/docker-python.cjs +3 -2
- package/dist/core/docker-python.cjs.map +1 -1
- package/dist/core/docker-python.js +1 -1
- package/dist/core/docker-python.js.map +1 -1
- package/dist/core/docker.cjs +3 -3
- package/dist/core/docker.cjs.map +1 -1
- package/dist/core/docker.js.map +1 -1
- package/dist/core/envs.cjs +34 -0
- package/dist/core/envs.cjs.map +1 -1
- package/dist/core/envs.d.ts +8 -2
- package/dist/core/envs.d.ts.map +1 -1
- package/dist/core/envs.js +13 -1
- package/dist/core/envs.js.map +1 -1
- package/dist/core/package-info.cjs +59 -5
- package/dist/core/package-info.cjs.map +1 -1
- package/dist/core/package-info.d.ts +11 -2
- package/dist/core/package-info.d.ts.map +1 -1
- package/dist/core/package-info.js +60 -6
- package/dist/core/package-info.js.map +1 -1
- package/dist/core/paths.cjs +1 -1
- package/dist/core/paths.cjs.map +1 -1
- package/dist/core/paths.js +1 -1
- package/dist/core/paths.js.map +1 -1
- package/dist/core/resolver.cjs +7 -2
- package/dist/core/resolver.cjs.map +1 -1
- package/dist/core/resolver.js +1 -1
- package/dist/core/resolver.js.map +1 -1
- package/dist/core/schemas/artifacts.cjs +7 -1
- package/dist/core/schemas/artifacts.cjs.map +1 -1
- package/dist/core/schemas/artifacts.d.ts +1 -1
- package/dist/core/schemas/artifacts.d.ts.map +1 -1
- package/dist/core/schemas/artifacts.js +1 -1
- package/dist/core/schemas/artifacts.js.map +1 -1
- package/dist/core/schemas/entrypoints.cjs +4 -1
- package/dist/core/schemas/entrypoints.cjs.map +1 -1
- package/dist/core/schemas/entrypoints.d.ts +1 -1
- package/dist/core/schemas/entrypoints.d.ts.map +1 -1
- package/dist/core/schemas/entrypoints.js +1 -1
- package/dist/core/schemas/entrypoints.js.map +1 -1
- package/dist/core/schemas/sw-json.cjs +16 -1
- package/dist/core/schemas/sw-json.cjs.map +1 -1
- package/dist/core/schemas/sw-json.js +1 -1
- package/dist/core/schemas/sw-json.js.map +1 -1
- package/dist/core/storage.cjs +6 -2
- package/dist/core/storage.cjs.map +1 -1
- package/dist/core/storage.js +4 -1
- package/dist/core/storage.js.map +1 -1
- package/dist/core/sw-json-render.cjs +38 -7
- package/dist/core/sw-json-render.cjs.map +1 -1
- package/dist/core/sw-json-render.js +37 -8
- package/dist/core/sw-json-render.js.map +1 -1
- package/dist/core/util.cjs +33 -12
- package/dist/core/util.cjs.map +1 -1
- package/dist/core/util.d.ts +12 -7
- package/dist/core/util.d.ts.map +1 -1
- package/dist/core/util.js +17 -8
- package/dist/core/util.js.map +1 -1
- package/dist/defaults.cjs +18 -1
- package/dist/defaults.cjs.map +1 -1
- package/dist/defaults.d.ts +9 -3
- package/dist/defaults.d.ts.map +1 -1
- package/dist/defaults.js +13 -2
- package/dist/defaults.js.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/core/core.test.ts +17 -0
- package/src/core/core.ts +48 -8
- package/src/core/envs.ts +8 -0
- package/src/core/package-info.test.ts +162 -3
- package/src/core/package-info.ts +88 -3
- package/src/core/schemas/test-artifacts.ts +1 -1
- package/src/core/sw-json-render.test.ts +23 -0
- package/src/core/sw-json-render.ts +30 -2
- package/src/core/util.test.ts +52 -0
- package/src/core/util.ts +27 -7
- package/src/defaults.ts +19 -1
- package/src/index.ts +4 -0
package/dist/core/core.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.cjs","names":["PackageInfo","path","fs","tmpSpecFile","fsp","micromamba","readBuiltArtifactInfo","SwJsonRenderer"],"sources":["../../src/core/core.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport yaml from \"yaml\";\nimport type winston from \"winston\";\n\nimport * as defaults from \"../defaults\";\nimport { PackageInfo } from \"./package-info\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport { micromamba } from \"./conda/builder\";\nimport { validateCondaSpec } from \"./conda/validate-spec\";\nimport { SwJsonRenderer, readBuiltArtifactInfo, writeBuiltArtifactInfo } from \"./sw-json-render\";\nimport * as util from \"./util\";\nimport * as archive from \"./archive\";\nimport * as storage from \"./storage\";\nimport * as docker from \"./docker\";\nimport { tmpSpecFile } from \"./docker-conda\";\n\nexport class Core {\n private readonly logger: winston.Logger;\n private _entrypoints: Map<string, entrypoint.Entrypoint> | undefined;\n private _renderer: SwJsonRenderer | undefined;\n\n public readonly pkgInfo: PackageInfo;\n public buildMode: util.BuildMode;\n public targetPlatform: util.PlatformType | undefined;\n public allPlatforms: boolean = false;\n public fullDirHash: boolean;\n\n constructor(\n logger: winston.Logger,\n opts?: {\n pkgInfo?: PackageInfo;\n packageRoot?: string;\n },\n ) {\n this.logger = logger;\n this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });\n\n this.buildMode = \"release\";\n\n this.fullDirHash = false;\n }\n\n public set version(v: string | undefined) {\n this.pkgInfo.version = v;\n }\n\n public get isPrivate(): boolean {\n return this.pkgInfo.isPrivate;\n }\n\n public binArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"tgz\"));\n }\n\n public assetArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"zip\"));\n }\n\n public archivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n if (artifact.type === \"asset\") {\n return this.assetArchivePath(artifact, os, arch);\n }\n\n return this.binArchivePath(artifact, os, arch);\n }\n\n public get entrypoints(): Map<string, entrypoint.Entrypoint> {\n if (!this._entrypoints) {\n this._entrypoints = this.pkgInfo.entrypoints;\n }\n\n return this._entrypoints;\n }\n\n public get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const pkgs = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const [_, ep] of this.entrypoints.entries()) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n const key =\n ep.artifact.type === \"docker\" ? docker.entrypointName(ep.artifact.id) : ep.artifact.id;\n pkgs.set(key, ep.artifact);\n }\n\n return pkgs;\n }\n\n public get packageEntrypointsIndex(): Map<string, string[]> {\n const result = new Map<string, string[]>();\n\n for (const [epName, ep] of this.entrypoints) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, []);\n }\n\n result.get(ep.artifact.id)!.push(epName);\n }\n\n return result;\n }\n\n public get buildablePackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => !docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => artifacts.isBuildable(value.type)),\n );\n }\n\n public get dockerPackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => value.type === \"docker\"),\n );\n }\n\n public packageHasType(id: string, type: artifacts.artifactType): boolean {\n const pkg = this.packages.get(id);\n if (pkg && pkg.type === type) {\n return true;\n }\n\n // check 'magic' entrypoint name with suffix\n const dockerPkg = this.packages.get(docker.entrypointName(id));\n if (dockerPkg) {\n return true;\n }\n\n return false;\n }\n\n public getArtifact(\n id: string,\n type: \"docker\",\n ): artifacts.withId<artifacts.dockerType> | undefined;\n public getArtifact(\n id: string,\n type: \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined;\n public getArtifact(\n id: string,\n type: \"docker\" | \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined {\n const artifact = this.packages.get(id);\n\n switch (type) {\n case \"docker\": {\n if (artifact?.type === \"docker\") {\n return artifact;\n }\n // Virtual entrypoint with suffix specially for docker artifacts.\n return this.packages.get(docker.entrypointName(id));\n }\n case \"archive\": {\n if (artifact?.type === \"docker\") {\n return undefined;\n }\n return artifact;\n }\n default: {\n util.assertNever(type);\n return undefined;\n }\n }\n }\n\n // Get entrypoints defined in package.json, transform them to local or release (depending on `buildMode`)\n // sw.json entrypoint descriptors, and write them to ./dist/tengo/sw.json or as.json next to the package.json.\n public buildSwJsonFiles(options?: {\n packageIds?: string[];\n entrypoints?: string[];\n sources?: util.SoftwareSource[];\n requireAllArtifacts?: boolean;\n }) {\n const index = this.packageEntrypointsIndex;\n\n const entrypointNames = options?.entrypoints ?? [];\n if (options?.packageIds) {\n for (const pkgId of options.packageIds) {\n const packageEntrypoints = index.get(pkgId);\n if (!packageEntrypoints || packageEntrypoints.length === 0) {\n throw util.CLIError(\n `cannot build descriptor for package ${pkgId}: no entrypoints found for package`,\n );\n }\n\n entrypointNames.push(...packageEntrypoints);\n }\n }\n\n let entrypoints = Array.from(this.entrypoints.entries());\n if (entrypointNames.length > 0) {\n entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));\n }\n\n const infos = this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {\n requireAllArtifacts: options?.requireAllArtifacts,\n fullDirHash: this.fullDirHash,\n });\n\n for (const swJson of infos.values()) {\n this.renderer.writeSwJson(swJson);\n }\n\n for (const [epName, ep] of entrypoints) {\n if (ep.type === \"reference\") {\n const srcPath = this.pkgInfo.resolveReference(epName, ep);\n this.renderer.copySwJson(epName, srcPath);\n }\n }\n }\n\n public async buildSoftwareArchives(options?: {\n ids?: string[];\n forceBuild?: boolean;\n\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n }) {\n this.logger.info(`Building package archives...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n if (packagesToBuild.length > 1 && options?.archivePath && !options.forceBuild) {\n this.logger.error(\n \"Attempt to build several packages targeting single package archive. This will simply overwrite the archive several times. If you know what you are doing, add '--force' flag\",\n );\n throw util.CLIError(\n \"attempt to build several packages using the same software package archive\",\n );\n }\n\n for (const artifactID of packagesToBuild) {\n const artifact = this.getArtifact(artifactID, \"archive\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${artifactID}' is not buildable into archive. Skipped.`);\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n } else if (this.targetPlatform) {\n await this.buildSoftwareArchive(artifact, this.targetPlatform, options);\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(artifact)) {\n await this.buildSoftwareArchive(artifact, platform, options);\n }\n } else {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n }\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // artifact may be uploaded to the registry in content-addressable mode, when the artifact location\n // is derived from the actual artifact (software archive, docker image, etc) content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n public async buildSoftwareArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n },\n ) {\n this.logger.info(`Building software package '${artifact.id}' for platform '${platform}'...`);\n const { os, arch } = util.splitPlatform(platform);\n\n if (!artifacts.archiveArtifactTypes.includes(artifact.type)) {\n if (options?.skipIfEmpty) {\n this.logger.info(` archive build was skipped: package '${artifact.id}' is not buildable`);\n }\n this.logger.error(\n ` not buildable: artifact '${artifact.id}' archive build is impossible for configuration inside '${util.softwareConfigName}'`,\n );\n\n throw util.CLIError(\"not a buildable artifact\");\n }\n\n const contentRoot =\n options?.contentRoot ?? this.pkgInfo.artifactContentRoot(artifact, platform);\n\n if (artifact.type === \"asset\") {\n const archivePath = options?.archivePath ?? this.assetArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"assets\", artifact, archivePath, contentRoot, os, arch);\n return;\n }\n\n const artType = artifact.type;\n switch (artType) {\n case \"conda\": {\n if (options?.condaBuild === undefined || options.condaBuild) {\n // build by default, skip if explicitly disabled\n await this.buildCondaPackage({ artifact, platform, contentRoot });\n } else {\n this.logger.debug(`Conda environment build was skipped.`);\n }\n break;\n }\n }\n\n if (util.isDevLocalMode(this.buildMode)) {\n this.logger.info(\n ` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`,\n );\n return;\n }\n\n const archivePath = options?.archivePath ?? this.binArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"software\", artifact, archivePath, contentRoot, os, arch);\n }\n\n public buildDockerImages(options?: {\n ids?: string[];\n registry?: string;\n strictPlatformMatching?: boolean; // if true, build docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Building docker images...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToBuild) {\n const artifact = this.getArtifact(pkgID, \"docker\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${pkgID}' is not buildable into docker image. Skipped.`);\n }\n continue;\n }\n\n // Docker images are always built as linux/amd64 (Platforma's K8s target);\n // on non-x64 hosts pl-pkg cross-compiles via qemu so dev iteration on\n // Macs works. In CI, strictPlatformMatching is set on the caller side\n // and we still want exactly one matrix leg (linux/x64) to do the work —\n // otherwise every arm/windows runner duplicates the build and Windows\n // runners outright fail on 'docker build --platform linux/amd64'.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image build skipped for '${artifact.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.buildDockerImage(artifact.id, artifact, options?.registry);\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // docker image is uploaded to the registry after build with unique tag that is derived from the actual image content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n private buildDockerImage(\n pkgID: string,\n artifact: artifacts.withId<artifacts.dockerType>,\n registry?: string,\n ) {\n const dockerfile = path.resolve(this.pkgInfo.packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n const context = path.resolve(this.pkgInfo.packageRoot, artifact.context ?? \".\");\n registry = registry ?? artifact.registry;\n\n if (!fs.existsSync(dockerfile)) {\n throw util.CLIError(`Dockerfile '${dockerfile}' not found`);\n }\n\n if (!fs.existsSync(context)) {\n throw util.CLIError(`Context '${context}' not found`);\n }\n\n const localTag = docker.generateLocalTagName(this.pkgInfo.packageRoot, artifact);\n\n this.logger.info(`Building docker image for '${pkgID}'...`);\n this.logger.debug(` dockerfile: '${dockerfile}'\n context: '${context}'\n localTag: '${localTag}'\n `);\n\n const name = this.pkgInfo.artifactName(artifact);\n\n docker.build(context, dockerfile, localTag, name, this.pkgInfo.version);\n\n const imageHash = docker.getImageHash(localTag);\n const dstTag = docker.generateRemoteTagName(name, imageHash, registry);\n\n this.logger.debug(`Adding destination tag to docker image:\n dstTag: \"${dstTag}\"\n `);\n docker.addTag(localTag, dstTag);\n // do not remove local tag to make 'local' builds to also work with docker.\n\n // Docker images target linux/amd64 regardless of host (see docker.build).\n const artInfoPath = this.pkgInfo.artifactInfoLocation(pkgID, \"docker\", \"x64\");\n writeBuiltArtifactInfo(artInfoPath, {\n type: \"docker\",\n platform: \"linux-x64\",\n remoteArtifactLocation: dstTag,\n entrypoint: docker.getImageEntrypoint(localTag),\n });\n\n this.logger.info(`Docker image is built:\n tag: '${dstTag}'\n location file: '${artInfoPath}'`);\n\n this.logger.debug(`Clearing context directory from temporary files...`);\n if (fs.existsSync(path.join(context, tmpSpecFile))) {\n fs.unlinkSync(path.join(context, tmpSpecFile));\n }\n }\n\n private async buildCondaPackage(opts: {\n artifact: artifacts.withId<artifacts.condaType>;\n platform: util.PlatformType;\n contentRoot: string;\n }) {\n const { artifact, platform, contentRoot } = opts;\n\n if (platform !== util.currentPlatform()) {\n this.logger.warn(\n `Conda package cannot be built cross-platform:\\n` +\n ` current platform is '${util.currentPlatform()}', requested platform is '${platform}'\\n` +\n `Conda environment automatic build was skipped`,\n );\n return;\n }\n\n this.logger.info(`Building conda environment for current platform...`);\n\n const srcSpecPath = path.resolve(this.pkgInfo.packageRoot, artifact.spec);\n if (!fs.existsSync(srcSpecPath)) {\n this.logger.error(\n `Conda environment specification file '${artifact.spec}' not found at '${srcSpecPath}'`,\n );\n throw util.CLIError(\n `Cannot build conda environment '${artifact.id}': no specification file.`,\n );\n }\n\n this.logger.debug(`Validating conda spec file for forbidden channels...`);\n try {\n validateCondaSpec(this.logger, srcSpecPath);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this.logger.error(errorMessage);\n throw util.CLIError(`Cannot build conda environment '${artifact.id}': ${errorMessage}`);\n }\n\n const micromambaRoot = path.join(contentRoot, defaults.CONDA_DATA_LOCATION);\n const micromambaBin = path.join(contentRoot, \"micromamba\");\n\n this.logger.debug(`Creating micromamba root directory: '${micromambaRoot}'`);\n await fsp.mkdir(micromambaRoot, { recursive: true });\n\n this.logger.debug(`Creating micromamba instance...`);\n const m = new micromamba(\n this.logger,\n micromambaRoot,\n artifact[\"micromamba-version\"],\n micromambaBin,\n );\n\n const resultSpecPath = path.join(contentRoot, defaults.CONDA_FROZEN_ENV_SPEC_FILE);\n\n await m.downloadBinary();\n m.createEnvironment({ specFile: srcSpecPath });\n m.exportEnvironment({ outputFile: resultSpecPath });\n m.deleteEnvironment({});\n\n this.logger.debug(`Conda environment was built at '${micromambaRoot}'.`);\n\n this.logger.debug(`Cutting prefix from conda environment file...`);\n\n const resultSpec = yaml.parse(await fsp.readFile(resultSpecPath, \"utf-8\")) as Record<\n string,\n unknown\n >;\n resultSpec.prefix = undefined; // cut original env location (with path from CI) from the resulting spec file\n\n // Fixup the structure: for empty lists export produces YAML that cannot be then read back on server side for restoration.\n if (!resultSpec.channels) {\n resultSpec.channels = [];\n }\n if (!resultSpec.dependencies) {\n resultSpec.dependencies = [];\n }\n await fsp.writeFile(resultSpecPath, yaml.stringify(resultSpec));\n\n this.logger.debug(`Conda environment file is ready: '${resultSpecPath}'`);\n }\n\n private async createPackageArchive(\n packageContentType: string,\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n archivePath: string,\n contentRoot: string,\n os: util.OSType,\n arch: util.ArchType,\n ) {\n this.logger.debug(` packing ${packageContentType} into a package`);\n if (artifacts.isCrossPlatform(artifact.type)) {\n this.logger.debug(` generating cross-platform package`);\n } else {\n this.logger.debug(` generating package for os='${os}', arch='${arch}'`);\n }\n this.logger.debug(` package content root: '${contentRoot}'`);\n this.logger.debug(` package destination archive: '${archivePath}'`);\n\n await archive.create(this.logger, contentRoot, archivePath);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(artInfoPath, {\n type: artifact.type,\n platform: util.joinPlatform(os, arch),\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, util.joinPlatform(os, arch)),\n });\n\n this.logger.info(`${packageContentType} archive is built:\n archive: '${archivePath}'\n location file: '${artInfoPath}'`);\n }\n\n public async publishPackages(options?: {\n ids?: string[];\n\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean; // do not warn if package already exists in storage, fail with error instead.\n forceReupload?: boolean; // re-upload packages even if they already exist in storage\n }) {\n this.logger.info(`Publishing packages...`);\n\n const packagesToPublish = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n const uploads: Promise<void>[] = [];\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"archive\");\n\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into archive. Cannot publish archive artifact.`,\n );\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(pkg.type)) {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n } else if (this.targetPlatform) {\n uploads.push(this.publishPackage(pkg, this.targetPlatform, options));\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(pkg)) {\n uploads.push(this.publishPackage(pkg, platform, options));\n }\n } else {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n }\n }\n\n await Promise.all(uploads);\n }\n\n private async publishPackage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n if (artifact.type === \"docker\") {\n this.publishDockerImage(artifact);\n return;\n }\n\n await this.publishArchive(artifact, platform, options);\n }\n\n private async publishArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n const { os, arch } = util.splitPlatform(platform);\n\n const artifactName = this.pkgInfo.artifactName(artifact);\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n const storageURL = options?.storageURL ?? registry.storageURL;\n\n const archivePath = options?.archivePath ?? this.archivePath(artifact, os, arch);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const dstName = artInfo.uploadPath ?? artInfo.remoteArtifactLocation;\n\n if (!storageURL) {\n const regNameUpper = registry.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n this.logger.error(`no storage URL is set for registry ${registry.name}`);\n throw util.CLIError(\n `'registry.storageURL' of package '${artifact.id}' is empty. Set it as command option, in '${util.softwareConfigName}' file or via environment variable 'PL_REGISTRY_${regNameUpper}_UPLOAD_URL'`,\n );\n }\n\n this.logger.info(\n `Publishing package '${artifactName}' for platform '${platform}' into registry '${registry.name}'`,\n );\n this.logger.debug(` registry storage URL: '${storageURL}'`);\n this.logger.debug(` archive to publish: '${archivePath}'`);\n this.logger.debug(` target package name: '${dstName}'`);\n\n const s = await storage.initByUrl(storageURL, this.pkgInfo.packageRoot);\n\n const exists = await s.exists(dstName);\n if (exists && !options?.forceReupload) {\n if (options?.failExisting) {\n throw util.CLIError(\n `software package '${dstName}' already exists in registry '${registry.name}'. To re-upload it, use 'force' flag. To not fail, remove 'fail-existing-packages' flag`,\n );\n }\n\n this.logger.warn(\n `software package '${dstName}' already exists in registry '${registry.name}'. Upload was skipped.`,\n );\n return;\n }\n\n const uploads: Promise<void>[] = [];\n\n const archive = fs.createReadStream(archivePath);\n uploads.push(\n s.putFile(dstName, archive).finally(() => {\n archive.close();\n return;\n }),\n );\n\n return Promise.all(uploads).then(() => {\n this.logger.info(`Package '${artifactName}' was published to '${registry.name}:${dstName}'`);\n return;\n });\n }\n\n public publishDockerImages(options?: {\n ids?: string[];\n pushTo?: string;\n strictPlatformMatching?: boolean; // if true, publish docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Publishing docker images...`);\n\n // Iterate only dockerPackages (matches buildDockerImages). Previously we\n // also iterated buildablePackages.keys(), but for entrypoints with a python\n // or conda binary that autogens a docker image, the binary key (e.g. \"main\")\n // and the virtual docker key (\"main:docker\") both resolve to the same\n // docker artifact via getArtifact's :docker fallback. That caused\n // publishDockerImage to run twice — first push succeeded, second saw the\n // tag in the registry and logged a misleading \"Skipping push...\" line.\n const packagesToPublish = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"docker\");\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into docker image. Cannot publish docker image.`,\n );\n }\n continue;\n }\n\n // Mirror the gate in buildDockerImages: in strict (CI) mode, only the\n // linux/x64 leg publishes so we don't race parallel pushes of the same\n // tag from arm and windows matrix legs. Dev (non-strict) mode pushes\n // unconditionally — the cross-compile produced a valid linux/amd64\n // image regardless of host.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image publish skipped for '${pkg.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.publishDockerImage(pkg, options?.pushTo);\n }\n }\n\n private publishDockerImage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n pushTo?: string,\n ) {\n if (artifact.type !== \"docker\") {\n throw util.CLIError(`package '${artifact.id}' is not a docker package`);\n }\n\n // Matches the \"x64\" write in buildDockerImage — docker artifacts are always\n // cross-compiled to linux/amd64 so we look up the x64 descriptor regardless\n // of host.\n const artInfoPath = this.pkgInfo.artifactInfoLocation(artifact.id, \"docker\", \"x64\");\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const tag = artInfo.remoteArtifactLocation;\n const pushTag = pushTo ? `${pushTo}:${tag.split(\":\").slice(-1)[0]}` : tag;\n\n // Because of turbo caching, we may face situation when no real docker build was executed on CI agent,\n // but image is already in remote registry. We should not fail in such scenarios, calmly skipping docker push step.\n const remoteImageExists = docker.remoteImageExists(pushTag);\n if (remoteImageExists) {\n this.logger.info(\n `Docker image '${tag}' not exists locally but is already in remote registry. Skipping push...`,\n );\n return;\n }\n\n const localImageExists = docker.localImageExists(tag);\n if (!localImageExists) {\n throw util.CLIError(\n `Docker image '${tag}' not exists locally and is not found in remote registry. Publication failed.`,\n );\n }\n\n if (pushTo) {\n docker.addTag(tag, pushTag);\n this.logger.info(`Publishing docker image '${tag}' using alternative tag '${pushTag}'`);\n } else {\n this.logger.info(`Publishing docker image '${tag}' with tag '${pushTag}'`);\n }\n\n docker.push(pushTag);\n }\n\n private get renderer(): SwJsonRenderer {\n if (!this._renderer) {\n this._renderer = new SwJsonRenderer(this.logger, this.pkgInfo);\n }\n\n return this._renderer;\n }\n\n private archiveOptions(\n pkg: artifacts.anyArtifactType,\n name: string,\n version: string,\n os: util.OSType,\n arch: util.ArchType,\n archiveType: archive.archiveType,\n ): archive.archiveOptions {\n return {\n packageRoot: this.pkgInfo.packageRoot,\n packageName: name,\n packageVersion: version,\n\n crossplatform: artifacts.isCrossPlatform(pkg.type),\n os: os,\n arch: arch,\n ext: archiveType,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,IAAa,OAAb,MAAkB;CAChB;CACA;CACA;CAEA;CACA;CACA;CACA,eAA+B;CAC/B;CAEA,YACE,QACA,MAIA;AACA,OAAK,SAAS;AACd,OAAK,UAAU,MAAM,WAAW,IAAIA,qBAAAA,YAAY,QAAQ,EAAE,aAAa,MAAM,aAAa,CAAC;AAE3F,OAAK,YAAY;AAEjB,OAAK,cAAc;;CAGrB,IAAW,QAAQ,GAAuB;AACxC,OAAK,QAAQ,UAAU;;CAGzB,IAAW,YAAqB;AAC9B,SAAO,KAAK,QAAQ;;CAGtB,eACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,SAAS;EAChD,MAAM,UAAU,KAAK,QAAQ,gBAAgB,SAAS;AACtD,SAAA,gBAAA,QAAuB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,MAAM,CAAC;;CAGvF,iBACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,SAAS;EAChD,MAAM,UAAU,KAAK,QAAQ,gBAAgB,SAAS;AACtD,SAAA,gBAAA,QAAuB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,MAAM,CAAC;;C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A,iBAD6C,IAAI,CAEnD,OAAA,aAAA,SACE,iBAAiB,IAAI,+EACtB;AAGH,MAAI,QAAQ;AACV,kBAAA,OAAc,KAAK,QAAQ;AAC3B,QAAK,OAAO,KAAK,4BAA4B,IAAI,2BAA2B,QAAQ,GAAG;QAEvF,MAAK,OAAO,KAAK,4BAA4B,IAAI,cAAc,QAAQ,GAAG;AAG5E,iBAAA,KAAY,QAAQ;;CAGtB,IAAY,WAA2B;AACrC,MAAI,CAAC,KAAK,UACR,MAAK,YAAY,IAAIC,uBAAAA,eAAe,KAAK,QAAQ,KAAK,QAAQ;AAGhE,SAAO,KAAK;;CAGd,eACE,KACA,MACA,SACA,IACA,MACA,aACwB;AACxB,SAAO;GACL,aAAa,KAAK,QAAQ;GAC1B,aAAa;GACb,gBAAgB;GAEhB,eAAA,kBAAA,gBAAyC,IAAI,KAAK;GAC9C;GACE;GACN,KAAK;GACN"}
|
|
1
|
+
{"version":3,"file":"core.cjs","names":["PackageInfo","path","fs","tmpSpecFile","fsp","micromamba","readBuiltArtifactInfo","SwJsonRenderer"],"sources":["../../src/core/core.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport yaml from \"yaml\";\nimport type winston from \"winston\";\n\nimport * as defaults from \"../defaults\";\nimport { PackageInfo } from \"./package-info\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport { micromamba } from \"./conda/builder\";\nimport { validateCondaSpec } from \"./conda/validate-spec\";\nimport { SwJsonRenderer, readBuiltArtifactInfo, writeBuiltArtifactInfo } from \"./sw-json-render\";\nimport * as util from \"./util\";\nimport * as archive from \"./archive\";\nimport * as storage from \"./storage\";\nimport * as docker from \"./docker\";\nimport { tmpSpecFile } from \"./docker-conda\";\n\nexport class Core {\n private readonly logger: winston.Logger;\n private _entrypoints: Map<string, entrypoint.Entrypoint> | undefined;\n private _renderer: SwJsonRenderer | undefined;\n\n public readonly pkgInfo: PackageInfo;\n public targetPlatform: util.PlatformType | undefined;\n public allPlatforms: boolean = false;\n public fullDirHash: boolean;\n\n constructor(\n logger: winston.Logger,\n opts?: {\n pkgInfo?: PackageInfo;\n packageRoot?: string;\n },\n ) {\n this.logger = logger;\n this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });\n\n this.fullDirHash = false;\n }\n\n public get buildMode(): util.BuildMode {\n return this.pkgInfo.buildMode;\n }\n\n public set buildMode(mode: util.BuildMode) {\n this.pkgInfo.buildMode = mode;\n }\n\n public set version(v: string | undefined) {\n this.pkgInfo.version = v;\n }\n\n public get isPrivate(): boolean {\n return this.pkgInfo.isPrivate;\n }\n\n public binArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"tgz\"));\n }\n\n public assetArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"zip\"));\n }\n\n public archivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n if (artifact.type === \"asset\") {\n return this.assetArchivePath(artifact, os, arch);\n }\n\n return this.binArchivePath(artifact, os, arch);\n }\n\n public get entrypoints(): Map<string, entrypoint.Entrypoint> {\n if (!this._entrypoints) {\n this._entrypoints = this.pkgInfo.entrypoints;\n }\n\n return this._entrypoints;\n }\n\n public get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const pkgs = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const [_, ep] of this.entrypoints.entries()) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n const key =\n ep.artifact.type === \"docker\" ? docker.entrypointName(ep.artifact.id) : ep.artifact.id;\n pkgs.set(key, ep.artifact);\n }\n\n return pkgs;\n }\n\n public get packageEntrypointsIndex(): Map<string, string[]> {\n const result = new Map<string, string[]>();\n\n for (const [epName, ep] of this.entrypoints) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, []);\n }\n\n result.get(ep.artifact.id)!.push(epName);\n }\n\n return result;\n }\n\n public get buildablePackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => !docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => artifacts.isBuildable(value.type)),\n );\n }\n\n public get dockerPackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => value.type === \"docker\"),\n );\n }\n\n public packageHasType(id: string, type: artifacts.artifactType): boolean {\n const pkg = this.packages.get(id);\n if (pkg && pkg.type === type) {\n return true;\n }\n\n // check 'magic' entrypoint name with suffix\n const dockerPkg = this.packages.get(docker.entrypointName(id));\n if (dockerPkg) {\n return true;\n }\n\n return false;\n }\n\n public getArtifact(\n id: string,\n type: \"docker\",\n ): artifacts.withId<artifacts.dockerType> | undefined;\n public getArtifact(\n id: string,\n type: \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined;\n public getArtifact(\n id: string,\n type: \"docker\" | \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined {\n const artifact = this.packages.get(id);\n\n switch (type) {\n case \"docker\": {\n if (artifact?.type === \"docker\") {\n return artifact;\n }\n // Virtual entrypoint with suffix specially for docker artifacts.\n return this.packages.get(docker.entrypointName(id));\n }\n case \"archive\": {\n if (artifact?.type === \"docker\") {\n return undefined;\n }\n return artifact;\n }\n default: {\n util.assertNever(type);\n return undefined;\n }\n }\n }\n\n // Get entrypoints defined in package.json, transform them to local or release (depending on `buildMode`)\n // sw.json entrypoint descriptors, and write them to ./dist/tengo/sw.json or as.json next to the package.json.\n public buildSwJsonFiles(options?: {\n packageIds?: string[];\n entrypoints?: string[];\n sources?: util.SoftwareSource[];\n requireAllArtifacts?: boolean;\n noSoftware?: boolean;\n }) {\n const index = this.packageEntrypointsIndex;\n\n const entrypointNames = options?.entrypoints ?? [];\n if (options?.packageIds) {\n for (const pkgId of options.packageIds) {\n const packageEntrypoints = index.get(pkgId);\n if (!packageEntrypoints || packageEntrypoints.length === 0) {\n throw util.CLIError(\n `cannot build descriptor for package ${pkgId}: no entrypoints found for package`,\n );\n }\n\n entrypointNames.push(...packageEntrypoints);\n }\n }\n\n let entrypoints = Array.from(this.entrypoints.entries());\n if (entrypointNames.length > 0) {\n entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));\n }\n\n const infos = options?.noSoftware\n ? this.renderer.renderPlaceholderEntrypoints(new Map(entrypoints))\n : this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {\n requireAllArtifacts: options?.requireAllArtifacts,\n fullDirHash: this.fullDirHash,\n });\n\n for (const swJson of infos.values()) {\n this.renderer.writeSwJson(swJson);\n }\n\n for (const [epName, ep] of entrypoints) {\n if (ep.type === \"reference\") {\n const srcPath = this.pkgInfo.resolveReference(epName, ep);\n this.renderer.copySwJson(epName, srcPath);\n }\n }\n }\n\n // Point artifact-info at the already-published, version-derived artifact without building or\n // uploading, so buildSwJsonFiles renders a registry descriptor for it. Release mode, binary only.\n public writePublishedArtifactInfo(options?: { ids?: string[] }) {\n const platform = util.currentPlatform();\n for (const [id, artifact] of this.buildablePackages) {\n if (options?.ids && !options.ids.includes(id)) continue;\n\n // Cross-platform archives are stored under a platform-agnostic key; this is the key\n // renderBinaryInfo reads back from.\n const locationKey = artifacts.isCrossPlatform(artifact.type) ? undefined : platform;\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(this.pkgInfo.artifactInfoLocation(id, \"archive\", locationKey), {\n type: artifact.type,\n platform,\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, platform),\n });\n }\n }\n\n public async buildSoftwareArchives(options?: {\n ids?: string[];\n forceBuild?: boolean;\n\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n }) {\n this.logger.info(`Building package archives...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n if (packagesToBuild.length > 1 && options?.archivePath && !options.forceBuild) {\n this.logger.error(\n \"Attempt to build several packages targeting single package archive. This will simply overwrite the archive several times. If you know what you are doing, add '--force' flag\",\n );\n throw util.CLIError(\n \"attempt to build several packages using the same software package archive\",\n );\n }\n\n for (const artifactID of packagesToBuild) {\n const artifact = this.getArtifact(artifactID, \"archive\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${artifactID}' is not buildable into archive. Skipped.`);\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n } else if (this.targetPlatform) {\n await this.buildSoftwareArchive(artifact, this.targetPlatform, options);\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(artifact)) {\n await this.buildSoftwareArchive(artifact, platform, options);\n }\n } else {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n }\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // artifact may be uploaded to the registry in content-addressable mode, when the artifact location\n // is derived from the actual artifact (software archive, docker image, etc) content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n public async buildSoftwareArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n },\n ) {\n this.logger.info(`Building software package '${artifact.id}' for platform '${platform}'...`);\n const { os, arch } = util.splitPlatform(platform);\n\n if (!artifacts.archiveArtifactTypes.includes(artifact.type)) {\n if (options?.skipIfEmpty) {\n this.logger.info(` archive build was skipped: package '${artifact.id}' is not buildable`);\n }\n this.logger.error(\n ` not buildable: artifact '${artifact.id}' archive build is impossible for configuration inside '${util.softwareConfigName}'`,\n );\n\n throw util.CLIError(\"not a buildable artifact\");\n }\n\n const contentRoot =\n options?.contentRoot ?? this.pkgInfo.artifactContentRoot(artifact, platform);\n\n if (artifact.type === \"asset\") {\n const archivePath = options?.archivePath ?? this.assetArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"assets\", artifact, archivePath, contentRoot, os, arch);\n return;\n }\n\n const artType = artifact.type;\n switch (artType) {\n case \"conda\": {\n if (options?.condaBuild === undefined || options.condaBuild) {\n // build by default, skip if explicitly disabled\n await this.buildCondaPackage({ artifact, platform, contentRoot });\n } else {\n this.logger.debug(`Conda environment build was skipped.`);\n }\n break;\n }\n }\n\n if (!util.producesRegistryDescriptor(this.buildMode)) {\n this.logger.info(\n ` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`,\n );\n return;\n }\n\n const archivePath = options?.archivePath ?? this.binArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"software\", artifact, archivePath, contentRoot, os, arch);\n }\n\n public buildDockerImages(options?: {\n ids?: string[];\n registry?: string;\n strictPlatformMatching?: boolean; // if true, build docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Building docker images...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToBuild) {\n const artifact = this.getArtifact(pkgID, \"docker\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${pkgID}' is not buildable into docker image. Skipped.`);\n }\n continue;\n }\n\n // Docker images are always built as linux/amd64 (Platforma's K8s target);\n // on non-x64 hosts pl-pkg cross-compiles via qemu so dev iteration on\n // Macs works. In CI, strictPlatformMatching is set on the caller side\n // and we still want exactly one matrix leg (linux/x64) to do the work —\n // otherwise every arm/windows runner duplicates the build and Windows\n // runners outright fail on 'docker build --platform linux/amd64'.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image build skipped for '${artifact.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n // Docker software is built as linux/amd64 only (Platforma's K8s target). An explicit\n // non-x64 target cannot be honored — fail clearly instead of silently emitting amd64.\n if (this.targetPlatform && util.splitPlatform(this.targetPlatform).arch !== \"x64\") {\n throw util.CLIError(\n `cannot build docker image '${artifact.id}' for target '${this.targetPlatform}': ` +\n `docker software is built as ${defaults.DOCKER_BUILD_PLATFORM} only`,\n );\n }\n\n this.buildDockerImage(artifact.id, artifact, options?.registry);\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // docker image is uploaded to the registry after build with unique tag that is derived from the actual image content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n private buildDockerImage(\n pkgID: string,\n artifact: artifacts.withId<artifacts.dockerType>,\n registry?: string,\n ) {\n const dockerfile = path.resolve(this.pkgInfo.packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n const context = path.resolve(this.pkgInfo.packageRoot, artifact.context ?? \".\");\n registry = registry ?? artifact.registry;\n\n if (!fs.existsSync(dockerfile)) {\n throw util.CLIError(`Dockerfile '${dockerfile}' not found`);\n }\n\n if (!fs.existsSync(context)) {\n throw util.CLIError(`Context '${context}' not found`);\n }\n\n const localTag = docker.generateLocalTagName(this.pkgInfo.packageRoot, artifact);\n\n this.logger.info(`Building docker image for '${pkgID}'...`);\n this.logger.debug(` dockerfile: '${dockerfile}'\n context: '${context}'\n localTag: '${localTag}'\n `);\n\n const name = this.pkgInfo.artifactName(artifact);\n\n docker.build(context, dockerfile, localTag, name, this.pkgInfo.version);\n\n const imageHash = docker.getImageHash(localTag);\n const dstTag = docker.generateRemoteTagName(name, imageHash, registry);\n\n this.logger.debug(`Adding destination tag to docker image:\n dstTag: \"${dstTag}\"\n `);\n docker.addTag(localTag, dstTag);\n // do not remove local tag to make 'local' builds to also work with docker.\n\n // Docker images target linux/amd64 regardless of host (see docker.build).\n const artInfoPath = this.pkgInfo.artifactInfoLocation(pkgID, \"docker\", \"x64\");\n writeBuiltArtifactInfo(artInfoPath, {\n type: \"docker\",\n platform: \"linux-x64\",\n remoteArtifactLocation: dstTag,\n entrypoint: docker.getImageEntrypoint(localTag),\n });\n\n this.logger.info(`Docker image is built:\n tag: '${dstTag}'\n location file: '${artInfoPath}'`);\n\n this.logger.debug(`Clearing context directory from temporary files...`);\n if (fs.existsSync(path.join(context, tmpSpecFile))) {\n fs.unlinkSync(path.join(context, tmpSpecFile));\n }\n }\n\n private async buildCondaPackage(opts: {\n artifact: artifacts.withId<artifacts.condaType>;\n platform: util.PlatformType;\n contentRoot: string;\n }) {\n const { artifact, platform, contentRoot } = opts;\n\n if (platform !== util.currentPlatform()) {\n this.logger.warn(\n `Conda package cannot be built cross-platform:\\n` +\n ` current platform is '${util.currentPlatform()}', requested platform is '${platform}'\\n` +\n `Conda environment automatic build was skipped`,\n );\n return;\n }\n\n this.logger.info(`Building conda environment for current platform...`);\n\n const srcSpecPath = path.resolve(this.pkgInfo.packageRoot, artifact.spec);\n if (!fs.existsSync(srcSpecPath)) {\n this.logger.error(\n `Conda environment specification file '${artifact.spec}' not found at '${srcSpecPath}'`,\n );\n throw util.CLIError(\n `Cannot build conda environment '${artifact.id}': no specification file.`,\n );\n }\n\n this.logger.debug(`Validating conda spec file for forbidden channels...`);\n try {\n validateCondaSpec(this.logger, srcSpecPath);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this.logger.error(errorMessage);\n throw util.CLIError(`Cannot build conda environment '${artifact.id}': ${errorMessage}`);\n }\n\n const micromambaRoot = path.join(contentRoot, defaults.CONDA_DATA_LOCATION);\n const micromambaBin = path.join(contentRoot, \"micromamba\");\n\n this.logger.debug(`Creating micromamba root directory: '${micromambaRoot}'`);\n await fsp.mkdir(micromambaRoot, { recursive: true });\n\n this.logger.debug(`Creating micromamba instance...`);\n const m = new micromamba(\n this.logger,\n micromambaRoot,\n artifact[\"micromamba-version\"],\n micromambaBin,\n );\n\n const resultSpecPath = path.join(contentRoot, defaults.CONDA_FROZEN_ENV_SPEC_FILE);\n\n await m.downloadBinary();\n m.createEnvironment({ specFile: srcSpecPath });\n m.exportEnvironment({ outputFile: resultSpecPath });\n m.deleteEnvironment({});\n\n this.logger.debug(`Conda environment was built at '${micromambaRoot}'.`);\n\n this.logger.debug(`Cutting prefix from conda environment file...`);\n\n const resultSpec = yaml.parse(await fsp.readFile(resultSpecPath, \"utf-8\")) as Record<\n string,\n unknown\n >;\n resultSpec.prefix = undefined; // cut original env location (with path from CI) from the resulting spec file\n\n // Fixup the structure: for empty lists export produces YAML that cannot be then read back on server side for restoration.\n if (!resultSpec.channels) {\n resultSpec.channels = [];\n }\n if (!resultSpec.dependencies) {\n resultSpec.dependencies = [];\n }\n await fsp.writeFile(resultSpecPath, yaml.stringify(resultSpec));\n\n this.logger.debug(`Conda environment file is ready: '${resultSpecPath}'`);\n }\n\n private async createPackageArchive(\n packageContentType: string,\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n archivePath: string,\n contentRoot: string,\n os: util.OSType,\n arch: util.ArchType,\n ) {\n this.logger.debug(` packing ${packageContentType} into a package`);\n if (artifacts.isCrossPlatform(artifact.type)) {\n this.logger.debug(` generating cross-platform package`);\n } else {\n this.logger.debug(` generating package for os='${os}', arch='${arch}'`);\n }\n this.logger.debug(` package content root: '${contentRoot}'`);\n this.logger.debug(` package destination archive: '${archivePath}'`);\n\n await archive.create(this.logger, contentRoot, archivePath);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(artInfoPath, {\n type: artifact.type,\n platform: util.joinPlatform(os, arch),\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, util.joinPlatform(os, arch)),\n });\n\n this.logger.info(`${packageContentType} archive is built:\n archive: '${archivePath}'\n location file: '${artInfoPath}'`);\n }\n\n public async publishPackages(options?: {\n ids?: string[];\n\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean; // do not warn if package already exists in storage, fail with error instead.\n forceReupload?: boolean; // re-upload packages even if they already exist in storage\n }) {\n this.logger.info(`Publishing packages...`);\n\n const packagesToPublish = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n const uploads: Promise<void>[] = [];\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"archive\");\n\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into archive. Cannot publish archive artifact.`,\n );\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(pkg.type)) {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n } else if (this.targetPlatform) {\n uploads.push(this.publishPackage(pkg, this.targetPlatform, options));\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(pkg)) {\n uploads.push(this.publishPackage(pkg, platform, options));\n }\n } else {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n }\n }\n\n await Promise.all(uploads);\n }\n\n private async publishPackage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n if (artifact.type === \"docker\") {\n this.publishDockerImage(artifact);\n return;\n }\n\n await this.publishArchive(artifact, platform, options);\n }\n\n private async publishArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n const { os, arch } = util.splitPlatform(platform);\n\n const artifactName = this.pkgInfo.artifactName(artifact);\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n const storageURL = options?.storageURL ?? registry.storageURL;\n\n const archivePath = options?.archivePath ?? this.archivePath(artifact, os, arch);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const dstName = artInfo.uploadPath ?? artInfo.remoteArtifactLocation;\n\n if (!storageURL) {\n const regNameUpper = registry.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n this.logger.error(`no storage URL is set for registry ${registry.name}`);\n throw util.CLIError(\n `'registry.storageURL' of package '${artifact.id}' is empty. Set it as command option, in '${util.softwareConfigName}' file or via environment variable 'PL_REGISTRY_${regNameUpper}_UPLOAD_URL'`,\n );\n }\n\n this.logger.info(\n `Publishing package '${artifactName}' for platform '${platform}' into registry '${registry.name}'`,\n );\n this.logger.debug(` registry storage URL: '${storageURL}'`);\n this.logger.debug(` archive to publish: '${archivePath}'`);\n this.logger.debug(` target package name: '${dstName}'`);\n\n const s = await storage.initByUrl(storageURL, this.pkgInfo.packageRoot);\n\n const exists = await s.exists(dstName);\n if (exists && !options?.forceReupload) {\n if (options?.failExisting) {\n throw util.CLIError(\n `software package '${dstName}' already exists in registry '${registry.name}'. To re-upload it, use 'force' flag. To not fail, remove 'fail-existing-packages' flag`,\n );\n }\n\n this.logger.warn(\n `software package '${dstName}' already exists in registry '${registry.name}'. Upload was skipped.`,\n );\n return;\n }\n\n const uploads: Promise<void>[] = [];\n\n const archive = fs.createReadStream(archivePath);\n uploads.push(\n s.putFile(dstName, archive).finally(() => {\n archive.close();\n return;\n }),\n );\n\n return Promise.all(uploads).then(() => {\n this.logger.info(`Package '${artifactName}' was published to '${registry.name}:${dstName}'`);\n return;\n });\n }\n\n public publishDockerImages(options?: {\n ids?: string[];\n pushTo?: string;\n strictPlatformMatching?: boolean; // if true, publish docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Publishing docker images...`);\n\n // Iterate only dockerPackages (matches buildDockerImages). Previously we\n // also iterated buildablePackages.keys(), but for entrypoints with a python\n // or conda binary that autogens a docker image, the binary key (e.g. \"main\")\n // and the virtual docker key (\"main:docker\") both resolve to the same\n // docker artifact via getArtifact's :docker fallback. That caused\n // publishDockerImage to run twice — first push succeeded, second saw the\n // tag in the registry and logged a misleading \"Skipping push...\" line.\n const packagesToPublish = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"docker\");\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into docker image. Cannot publish docker image.`,\n );\n }\n continue;\n }\n\n // Mirror the gate in buildDockerImages: in strict (CI) mode, only the\n // linux/x64 leg publishes so we don't race parallel pushes of the same\n // tag from arm and windows matrix legs. Dev (non-strict) mode pushes\n // unconditionally — the cross-compile produced a valid linux/amd64\n // image regardless of host.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image publish skipped for '${pkg.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.publishDockerImage(pkg, options?.pushTo);\n }\n }\n\n private publishDockerImage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n pushTo?: string,\n ) {\n if (artifact.type !== \"docker\") {\n throw util.CLIError(`package '${artifact.id}' is not a docker package`);\n }\n\n // Matches the \"x64\" write in buildDockerImage — docker artifacts are always\n // cross-compiled to linux/amd64 so we look up the x64 descriptor regardless\n // of host.\n const artInfoPath = this.pkgInfo.artifactInfoLocation(artifact.id, \"docker\", \"x64\");\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const tag = artInfo.remoteArtifactLocation;\n const pushTag = pushTo ? `${pushTo}:${tag.split(\":\").slice(-1)[0]}` : tag;\n\n // Because of turbo caching, we may face situation when no real docker build was executed on CI agent,\n // but image is already in remote registry. We should not fail in such scenarios, calmly skipping docker push step.\n const remoteImageExists = docker.remoteImageExists(pushTag);\n if (remoteImageExists) {\n this.logger.info(\n `Docker image '${tag}' not exists locally but is already in remote registry. Skipping push...`,\n );\n return;\n }\n\n const localImageExists = docker.localImageExists(tag);\n if (!localImageExists) {\n throw util.CLIError(\n `Docker image '${tag}' not exists locally and is not found in remote registry. Publication failed.`,\n );\n }\n\n if (pushTo) {\n docker.addTag(tag, pushTag);\n this.logger.info(`Publishing docker image '${tag}' using alternative tag '${pushTag}'`);\n } else {\n this.logger.info(`Publishing docker image '${tag}' with tag '${pushTag}'`);\n }\n\n docker.push(pushTag);\n }\n\n private get renderer(): SwJsonRenderer {\n if (!this._renderer) {\n this._renderer = new SwJsonRenderer(this.logger, this.pkgInfo);\n }\n\n return this._renderer;\n }\n\n private archiveOptions(\n pkg: artifacts.anyArtifactType,\n name: string,\n version: string,\n os: util.OSType,\n arch: util.ArchType,\n archiveType: archive.archiveType,\n ): archive.archiveOptions {\n return {\n packageRoot: this.pkgInfo.packageRoot,\n packageName: name,\n packageVersion: version,\n\n crossplatform: artifacts.isCrossPlatform(pkg.type),\n os: os,\n arch: arch,\n ext: archiveType,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmBA,IAAa,OAAb,MAAkB;CAChB;CACA;CACA;CAEA;CACA;CACA,eAA+B;CAC/B;CAEA,YACE,QACA,MAIA;EACA,KAAK,SAAS;EACd,KAAK,UAAU,MAAM,WAAW,IAAIA,qBAAAA,YAAY,QAAQ,EAAE,aAAa,MAAM,YAAY,CAAC;EAE1F,KAAK,cAAc;CACrB;CAEA,IAAW,YAA4B;EACrC,OAAO,KAAK,QAAQ;CACtB;CAEA,IAAW,UAAU,MAAsB;EACzC,KAAK,QAAQ,YAAY;CAC3B;CAEA,IAAW,QAAQ,GAAuB;EACxC,KAAK,QAAQ,UAAU;CACzB;CAEA,IAAW,YAAqB;EAC9B,OAAO,KAAK,QAAQ;CACtB;CAEA,eACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,QAAQ;EAC/C,MAAM,UAAU,KAAK,QAAQ,gBAAgB,QAAQ;EACrD,OAAA,gBAAA,QAAuB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,KAAK,CAAC;CACtF;CAEA,iBACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,QAAQ;EAC/C,MAAM,UAAU,KAAK,QAAQ,gBAAgB,QAAQ;EACrD,OAAA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;GACV,eAAA,OAAc,KAAK,OAAO;GAC1B,KAAK,OAAO,KAAK,4BAA4B,IAAI,2BAA2B,QAAQ,EAAE;EACxF,OACE,KAAK,OAAO,KAAK,4BAA4B,IAAI,cAAc,QAAQ,EAAE;EAG3E,eAAA,KAAY,OAAO;CACrB;CAEA,IAAY,WAA2B;EACrC,IAAI,CAAC,KAAK,WACR,KAAK,YAAY,IAAIC,uBAAAA,eAAe,KAAK,QAAQ,KAAK,OAAO;EAG/D,OAAO,KAAK;CACd;CAEA,eACE,KACA,MACA,SACA,IACA,MACA,aACwB;EACxB,OAAO;GACL,aAAa,KAAK,QAAQ;GAC1B,aAAa;GACb,gBAAgB;GAEhB,eAAA,kBAAA,gBAAyC,IAAI,IAAI;GAC7C;GACE;GACN,KAAK;EACP;CACF;AACF"}
|
package/dist/core/core.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ declare class Core {
|
|
|
10
10
|
private _entrypoints;
|
|
11
11
|
private _renderer;
|
|
12
12
|
readonly pkgInfo: PackageInfo;
|
|
13
|
-
buildMode: BuildMode;
|
|
14
13
|
targetPlatform: PlatformType | undefined;
|
|
15
14
|
allPlatforms: boolean;
|
|
16
15
|
fullDirHash: boolean;
|
|
@@ -18,6 +17,8 @@ declare class Core {
|
|
|
18
17
|
pkgInfo?: PackageInfo;
|
|
19
18
|
packageRoot?: string;
|
|
20
19
|
});
|
|
20
|
+
get buildMode(): BuildMode;
|
|
21
|
+
set buildMode(mode: BuildMode);
|
|
21
22
|
set version(v: string | undefined);
|
|
22
23
|
get isPrivate(): boolean;
|
|
23
24
|
binArchivePath(artifact: withId<anyArtifactType>, os: OSType, arch: ArchType): string;
|
|
@@ -36,6 +37,10 @@ declare class Core {
|
|
|
36
37
|
entrypoints?: string[];
|
|
37
38
|
sources?: SoftwareSource[];
|
|
38
39
|
requireAllArtifacts?: boolean;
|
|
40
|
+
noSoftware?: boolean;
|
|
41
|
+
}): void;
|
|
42
|
+
writePublishedArtifactInfo(options?: {
|
|
43
|
+
ids?: string[];
|
|
39
44
|
}): void;
|
|
40
45
|
buildSoftwareArchives(options?: {
|
|
41
46
|
ids?: string[];
|
package/dist/core/core.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.d.ts","names":[],"sources":["../../src/core/core.ts"],"mappings":";;;;;;;cAmBa,IAAA;EAAA,iBACM,MAAA;EAAA,QACT,YAAA;EAAA,QACA,SAAA;EAAA,SAEQ,OAAA,EAAS,WAAA;EAClB,
|
|
1
|
+
{"version":3,"file":"core.d.ts","names":[],"sources":["../../src/core/core.ts"],"mappings":";;;;;;;cAmBa,IAAA;EAAA,iBACM,MAAA;EAAA,QACT,YAAA;EAAA,QACA,SAAA;EAAA,SAEQ,OAAA,EAAS,WAAA;EAClB,cAAA,EAAgB,YAAA;EAChB,YAAA;EACA,WAAA;cAGL,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAChB,IAAA;IACE,OAAA,GAAU,WAAA;IACV,WAAA;EAAA;EAAA,IASO,SAAA,IAAa,SAAA;EAAA,IAIb,SAAA,CAAU,IAAA,EAAM,SAAA;EAAA,IAIhB,OAAA,CAAQ,CAAA;EAAA,IAIR,SAAA;EAIJ,cAAA,CACL,QAAA,EAAU,MAAA,CAAiB,eAAA,GAC3B,EAAA,EAAI,MAAA,EACJ,IAAA,EAAM,QAAA;EAOD,gBAAA,CACL,QAAA,EAAU,MAAA,CAAiB,eAAA,GAC3B,EAAA,EAAI,MAAA,EACJ,IAAA,EAAM,QAAA;EAOD,WAAA,CACL,QAAA,EAAU,MAAA,CAAiB,eAAA,GAC3B,EAAA,EAAI,MAAA,EACJ,IAAA,EAAM,QAAA;EAAA,IASG,WAAA,IAAe,GAAA,SAAY,UAAA;EAAA,IAQ3B,QAAA,IAAY,GAAA,SAAY,MAAA,CAAiB,eAAA;EAAA,IAiBzC,uBAAA,IAA2B,GAAA;EAAA,IAmB3B,iBAAA,IAAqB,GAAA,SAAY,MAAA,CAAiB,eAAA;EAAA,IAQlD,cAAA,IAAkB,GAAA,SAAY,MAAA,CAAiB,eAAA;EAQnD,cAAA,CAAe,EAAA,UAAY,IAAA,EAAM,YAAA;EAejC,WAAA,CACL,EAAA,UACA,IAAA,aACC,MAAA,CAAiB,UAAA;EACb,WAAA,CACL,EAAA,UACA,IAAA,cACC,MAAA,CAAiB,eAAA;EA8Bb,gBAAA,CAAiB,OAAA;IACtB,UAAA;IACA,WAAA;IACA,OAAA,GAAU,cAAA;IACV,mBAAA;IACA,UAAA;EAAA;EA4CK,0BAAA,CAA2B,OAAA;IAAY,GAAA;EAAA;EAqBjC,qBAAA,CAAsB,OAAA;IACjC,GAAA;IACA,UAAA;IAEA,WAAA;IACA,WAAA;IACA,WAAA;IAGA,UAAA;EAAA,IACD,OAAA;EA+CY,oBAAA,CACX,QAAA,EAAU,MAAA,CAAiB,eAAA,GAC3B,QAAA,EAAU,YAAA,EACV,OAAA;IACE,WAAA;IACA,WAAA;IACA,WAAA;IAGA,UAAA;EAAA,IACD,OAAA;EAiDI,iBAAA,CAAkB,OAAA;IACvB,GAAA;IACA,QAAA;IACA,sBAAA;EAAA;EAAA,QAoDM,gBAAA;EAAA,QAyDM,iBAAA;EAAA,QAgFA,oBAAA;EAyCD,eAAA,CAAgB,OAAA;IAC3B,GAAA;IAEA,WAAA;IACA,UAAA;IAEA,YAAA;IACA,aAAA;EAAA,IACD,OAAA;EAAA,QAoCa,cAAA;EAAA,QAmBA,cAAA;EAyEP,mBAAA,CAAoB,OAAA;IACzB,GAAA;IACA,MAAA;IACA,sBAAA;EAAA;EAAA,QA4CM,kBAAA;EAAA,YA2CI,QAAA;EAAA,QAQJ,cAAA;AAAA"}
|
package/dist/core/core.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CONDA_DATA_LOCATION, CONDA_FROZEN_ENV_SPEC_FILE } from "../defaults.js";
|
|
2
|
-
import { CLIError, assertNever, currentArch, currentOS, currentPlatform,
|
|
1
|
+
import { CONDA_DATA_LOCATION, CONDA_FROZEN_ENV_SPEC_FILE, DOCKER_BUILD_PLATFORM } from "../defaults.js";
|
|
2
|
+
import { CLIError, assertNever, currentArch, currentOS, currentPlatform, joinPlatform, producesRegistryDescriptor, softwareConfigName, splitPlatform } from "./util.js";
|
|
3
3
|
import { archiveArtifactTypes, isBuildable, isCrossPlatform } from "./schemas/artifacts.js";
|
|
4
4
|
import { addTag, build, entrypointName, generateLocalTagName, generateRemoteTagName, getImageEntrypoint, getImageHash, isVirtualDockerEntrypointName, localImageExists, push, remoteImageExists } from "./docker.js";
|
|
5
5
|
import { micromamba } from "./conda/builder.js";
|
|
@@ -19,16 +19,20 @@ var Core = class {
|
|
|
19
19
|
_entrypoints;
|
|
20
20
|
_renderer;
|
|
21
21
|
pkgInfo;
|
|
22
|
-
buildMode;
|
|
23
22
|
targetPlatform;
|
|
24
23
|
allPlatforms = false;
|
|
25
24
|
fullDirHash;
|
|
26
25
|
constructor(logger, opts) {
|
|
27
26
|
this.logger = logger;
|
|
28
27
|
this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });
|
|
29
|
-
this.buildMode = "release";
|
|
30
28
|
this.fullDirHash = false;
|
|
31
29
|
}
|
|
30
|
+
get buildMode() {
|
|
31
|
+
return this.pkgInfo.buildMode;
|
|
32
|
+
}
|
|
33
|
+
set buildMode(mode) {
|
|
34
|
+
this.pkgInfo.buildMode = mode;
|
|
35
|
+
}
|
|
32
36
|
set version(v) {
|
|
33
37
|
this.pkgInfo.version = v;
|
|
34
38
|
}
|
|
@@ -107,7 +111,7 @@ var Core = class {
|
|
|
107
111
|
}
|
|
108
112
|
let entrypoints = Array.from(this.entrypoints.entries());
|
|
109
113
|
if (entrypointNames.length > 0) entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));
|
|
110
|
-
const infos = this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {
|
|
114
|
+
const infos = options?.noSoftware ? this.renderer.renderPlaceholderEntrypoints(new Map(entrypoints)) : this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {
|
|
111
115
|
requireAllArtifacts: options?.requireAllArtifacts,
|
|
112
116
|
fullDirHash: this.fullDirHash
|
|
113
117
|
});
|
|
@@ -117,6 +121,22 @@ var Core = class {
|
|
|
117
121
|
this.renderer.copySwJson(epName, srcPath);
|
|
118
122
|
}
|
|
119
123
|
}
|
|
124
|
+
writePublishedArtifactInfo(options) {
|
|
125
|
+
const platform = currentPlatform();
|
|
126
|
+
for (const [id, artifact] of this.buildablePackages) {
|
|
127
|
+
if (options?.ids && !options.ids.includes(id)) continue;
|
|
128
|
+
const locationKey = isCrossPlatform(artifact.type) ? void 0 : platform;
|
|
129
|
+
const registry = this.pkgInfo.artifactRegistrySettings(artifact);
|
|
130
|
+
writeBuiltArtifactInfo(this.pkgInfo.artifactInfoLocation(id, "archive", locationKey), {
|
|
131
|
+
type: artifact.type,
|
|
132
|
+
platform,
|
|
133
|
+
registryURL: registry.downloadURL,
|
|
134
|
+
registryName: registry.name,
|
|
135
|
+
remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),
|
|
136
|
+
uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, platform)
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
120
140
|
async buildSoftwareArchives(options) {
|
|
121
141
|
this.logger.info(`Building package archives...`);
|
|
122
142
|
const packagesToBuild = options?.ids ?? Array.from(this.buildablePackages.keys());
|
|
@@ -162,7 +182,7 @@ var Core = class {
|
|
|
162
182
|
else this.logger.debug(`Conda environment build was skipped.`);
|
|
163
183
|
break;
|
|
164
184
|
}
|
|
165
|
-
if (
|
|
185
|
+
if (!producesRegistryDescriptor(this.buildMode)) {
|
|
166
186
|
this.logger.info(` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`);
|
|
167
187
|
return;
|
|
168
188
|
}
|
|
@@ -186,6 +206,7 @@ var Core = class {
|
|
|
186
206
|
continue;
|
|
187
207
|
}
|
|
188
208
|
}
|
|
209
|
+
if (this.targetPlatform && splitPlatform(this.targetPlatform).arch !== "x64") throw CLIError(`cannot build docker image '${artifact.id}' for target '${this.targetPlatform}': docker software is built as ${DOCKER_BUILD_PLATFORM} only`);
|
|
189
210
|
this.buildDockerImage(artifact.id, artifact, options?.registry);
|
|
190
211
|
}
|
|
191
212
|
}
|
package/dist/core/core.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core.js","names":["archive.getPath","docker.entrypointName","docker.isVirtualDockerEntrypointName","artifacts.isBuildable","util.CLIError","artifacts.isCrossPlatform","util.currentPlatform","util.splitPlatform","util.softwareConfigName","util.isDevLocalMode","util.currentOS","util.currentArch","docker.generateLocalTagName","docker.getImageHash","docker.generateRemoteTagName","docker.getImageEntrypoint","defaults.CONDA_DATA_LOCATION","defaults.CONDA_FROZEN_ENV_SPEC_FILE","archive.create","util.joinPlatform","storage.initByUrl","docker.remoteImageExists","docker.localImageExists"],"sources":["../../src/core/core.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport yaml from \"yaml\";\nimport type winston from \"winston\";\n\nimport * as defaults from \"../defaults\";\nimport { PackageInfo } from \"./package-info\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport { micromamba } from \"./conda/builder\";\nimport { validateCondaSpec } from \"./conda/validate-spec\";\nimport { SwJsonRenderer, readBuiltArtifactInfo, writeBuiltArtifactInfo } from \"./sw-json-render\";\nimport * as util from \"./util\";\nimport * as archive from \"./archive\";\nimport * as storage from \"./storage\";\nimport * as docker from \"./docker\";\nimport { tmpSpecFile } from \"./docker-conda\";\n\nexport class Core {\n private readonly logger: winston.Logger;\n private _entrypoints: Map<string, entrypoint.Entrypoint> | undefined;\n private _renderer: SwJsonRenderer | undefined;\n\n public readonly pkgInfo: PackageInfo;\n public buildMode: util.BuildMode;\n public targetPlatform: util.PlatformType | undefined;\n public allPlatforms: boolean = false;\n public fullDirHash: boolean;\n\n constructor(\n logger: winston.Logger,\n opts?: {\n pkgInfo?: PackageInfo;\n packageRoot?: string;\n },\n ) {\n this.logger = logger;\n this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });\n\n this.buildMode = \"release\";\n\n this.fullDirHash = false;\n }\n\n public set version(v: string | undefined) {\n this.pkgInfo.version = v;\n }\n\n public get isPrivate(): boolean {\n return this.pkgInfo.isPrivate;\n }\n\n public binArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"tgz\"));\n }\n\n public assetArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"zip\"));\n }\n\n public archivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n if (artifact.type === \"asset\") {\n return this.assetArchivePath(artifact, os, arch);\n }\n\n return this.binArchivePath(artifact, os, arch);\n }\n\n public get entrypoints(): Map<string, entrypoint.Entrypoint> {\n if (!this._entrypoints) {\n this._entrypoints = this.pkgInfo.entrypoints;\n }\n\n return this._entrypoints;\n }\n\n public get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const pkgs = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const [_, ep] of this.entrypoints.entries()) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n const key =\n ep.artifact.type === \"docker\" ? docker.entrypointName(ep.artifact.id) : ep.artifact.id;\n pkgs.set(key, ep.artifact);\n }\n\n return pkgs;\n }\n\n public get packageEntrypointsIndex(): Map<string, string[]> {\n const result = new Map<string, string[]>();\n\n for (const [epName, ep] of this.entrypoints) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, []);\n }\n\n result.get(ep.artifact.id)!.push(epName);\n }\n\n return result;\n }\n\n public get buildablePackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => !docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => artifacts.isBuildable(value.type)),\n );\n }\n\n public get dockerPackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => value.type === \"docker\"),\n );\n }\n\n public packageHasType(id: string, type: artifacts.artifactType): boolean {\n const pkg = this.packages.get(id);\n if (pkg && pkg.type === type) {\n return true;\n }\n\n // check 'magic' entrypoint name with suffix\n const dockerPkg = this.packages.get(docker.entrypointName(id));\n if (dockerPkg) {\n return true;\n }\n\n return false;\n }\n\n public getArtifact(\n id: string,\n type: \"docker\",\n ): artifacts.withId<artifacts.dockerType> | undefined;\n public getArtifact(\n id: string,\n type: \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined;\n public getArtifact(\n id: string,\n type: \"docker\" | \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined {\n const artifact = this.packages.get(id);\n\n switch (type) {\n case \"docker\": {\n if (artifact?.type === \"docker\") {\n return artifact;\n }\n // Virtual entrypoint with suffix specially for docker artifacts.\n return this.packages.get(docker.entrypointName(id));\n }\n case \"archive\": {\n if (artifact?.type === \"docker\") {\n return undefined;\n }\n return artifact;\n }\n default: {\n util.assertNever(type);\n return undefined;\n }\n }\n }\n\n // Get entrypoints defined in package.json, transform them to local or release (depending on `buildMode`)\n // sw.json entrypoint descriptors, and write them to ./dist/tengo/sw.json or as.json next to the package.json.\n public buildSwJsonFiles(options?: {\n packageIds?: string[];\n entrypoints?: string[];\n sources?: util.SoftwareSource[];\n requireAllArtifacts?: boolean;\n }) {\n const index = this.packageEntrypointsIndex;\n\n const entrypointNames = options?.entrypoints ?? [];\n if (options?.packageIds) {\n for (const pkgId of options.packageIds) {\n const packageEntrypoints = index.get(pkgId);\n if (!packageEntrypoints || packageEntrypoints.length === 0) {\n throw util.CLIError(\n `cannot build descriptor for package ${pkgId}: no entrypoints found for package`,\n );\n }\n\n entrypointNames.push(...packageEntrypoints);\n }\n }\n\n let entrypoints = Array.from(this.entrypoints.entries());\n if (entrypointNames.length > 0) {\n entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));\n }\n\n const infos = this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {\n requireAllArtifacts: options?.requireAllArtifacts,\n fullDirHash: this.fullDirHash,\n });\n\n for (const swJson of infos.values()) {\n this.renderer.writeSwJson(swJson);\n }\n\n for (const [epName, ep] of entrypoints) {\n if (ep.type === \"reference\") {\n const srcPath = this.pkgInfo.resolveReference(epName, ep);\n this.renderer.copySwJson(epName, srcPath);\n }\n }\n }\n\n public async buildSoftwareArchives(options?: {\n ids?: string[];\n forceBuild?: boolean;\n\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n }) {\n this.logger.info(`Building package archives...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n if (packagesToBuild.length > 1 && options?.archivePath && !options.forceBuild) {\n this.logger.error(\n \"Attempt to build several packages targeting single package archive. This will simply overwrite the archive several times. If you know what you are doing, add '--force' flag\",\n );\n throw util.CLIError(\n \"attempt to build several packages using the same software package archive\",\n );\n }\n\n for (const artifactID of packagesToBuild) {\n const artifact = this.getArtifact(artifactID, \"archive\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${artifactID}' is not buildable into archive. Skipped.`);\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n } else if (this.targetPlatform) {\n await this.buildSoftwareArchive(artifact, this.targetPlatform, options);\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(artifact)) {\n await this.buildSoftwareArchive(artifact, platform, options);\n }\n } else {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n }\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // artifact may be uploaded to the registry in content-addressable mode, when the artifact location\n // is derived from the actual artifact (software archive, docker image, etc) content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n public async buildSoftwareArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n },\n ) {\n this.logger.info(`Building software package '${artifact.id}' for platform '${platform}'...`);\n const { os, arch } = util.splitPlatform(platform);\n\n if (!artifacts.archiveArtifactTypes.includes(artifact.type)) {\n if (options?.skipIfEmpty) {\n this.logger.info(` archive build was skipped: package '${artifact.id}' is not buildable`);\n }\n this.logger.error(\n ` not buildable: artifact '${artifact.id}' archive build is impossible for configuration inside '${util.softwareConfigName}'`,\n );\n\n throw util.CLIError(\"not a buildable artifact\");\n }\n\n const contentRoot =\n options?.contentRoot ?? this.pkgInfo.artifactContentRoot(artifact, platform);\n\n if (artifact.type === \"asset\") {\n const archivePath = options?.archivePath ?? this.assetArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"assets\", artifact, archivePath, contentRoot, os, arch);\n return;\n }\n\n const artType = artifact.type;\n switch (artType) {\n case \"conda\": {\n if (options?.condaBuild === undefined || options.condaBuild) {\n // build by default, skip if explicitly disabled\n await this.buildCondaPackage({ artifact, platform, contentRoot });\n } else {\n this.logger.debug(`Conda environment build was skipped.`);\n }\n break;\n }\n }\n\n if (util.isDevLocalMode(this.buildMode)) {\n this.logger.info(\n ` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`,\n );\n return;\n }\n\n const archivePath = options?.archivePath ?? this.binArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"software\", artifact, archivePath, contentRoot, os, arch);\n }\n\n public buildDockerImages(options?: {\n ids?: string[];\n registry?: string;\n strictPlatformMatching?: boolean; // if true, build docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Building docker images...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToBuild) {\n const artifact = this.getArtifact(pkgID, \"docker\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${pkgID}' is not buildable into docker image. Skipped.`);\n }\n continue;\n }\n\n // Docker images are always built as linux/amd64 (Platforma's K8s target);\n // on non-x64 hosts pl-pkg cross-compiles via qemu so dev iteration on\n // Macs works. In CI, strictPlatformMatching is set on the caller side\n // and we still want exactly one matrix leg (linux/x64) to do the work —\n // otherwise every arm/windows runner duplicates the build and Windows\n // runners outright fail on 'docker build --platform linux/amd64'.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image build skipped for '${artifact.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.buildDockerImage(artifact.id, artifact, options?.registry);\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // docker image is uploaded to the registry after build with unique tag that is derived from the actual image content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n private buildDockerImage(\n pkgID: string,\n artifact: artifacts.withId<artifacts.dockerType>,\n registry?: string,\n ) {\n const dockerfile = path.resolve(this.pkgInfo.packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n const context = path.resolve(this.pkgInfo.packageRoot, artifact.context ?? \".\");\n registry = registry ?? artifact.registry;\n\n if (!fs.existsSync(dockerfile)) {\n throw util.CLIError(`Dockerfile '${dockerfile}' not found`);\n }\n\n if (!fs.existsSync(context)) {\n throw util.CLIError(`Context '${context}' not found`);\n }\n\n const localTag = docker.generateLocalTagName(this.pkgInfo.packageRoot, artifact);\n\n this.logger.info(`Building docker image for '${pkgID}'...`);\n this.logger.debug(` dockerfile: '${dockerfile}'\n context: '${context}'\n localTag: '${localTag}'\n `);\n\n const name = this.pkgInfo.artifactName(artifact);\n\n docker.build(context, dockerfile, localTag, name, this.pkgInfo.version);\n\n const imageHash = docker.getImageHash(localTag);\n const dstTag = docker.generateRemoteTagName(name, imageHash, registry);\n\n this.logger.debug(`Adding destination tag to docker image:\n dstTag: \"${dstTag}\"\n `);\n docker.addTag(localTag, dstTag);\n // do not remove local tag to make 'local' builds to also work with docker.\n\n // Docker images target linux/amd64 regardless of host (see docker.build).\n const artInfoPath = this.pkgInfo.artifactInfoLocation(pkgID, \"docker\", \"x64\");\n writeBuiltArtifactInfo(artInfoPath, {\n type: \"docker\",\n platform: \"linux-x64\",\n remoteArtifactLocation: dstTag,\n entrypoint: docker.getImageEntrypoint(localTag),\n });\n\n this.logger.info(`Docker image is built:\n tag: '${dstTag}'\n location file: '${artInfoPath}'`);\n\n this.logger.debug(`Clearing context directory from temporary files...`);\n if (fs.existsSync(path.join(context, tmpSpecFile))) {\n fs.unlinkSync(path.join(context, tmpSpecFile));\n }\n }\n\n private async buildCondaPackage(opts: {\n artifact: artifacts.withId<artifacts.condaType>;\n platform: util.PlatformType;\n contentRoot: string;\n }) {\n const { artifact, platform, contentRoot } = opts;\n\n if (platform !== util.currentPlatform()) {\n this.logger.warn(\n `Conda package cannot be built cross-platform:\\n` +\n ` current platform is '${util.currentPlatform()}', requested platform is '${platform}'\\n` +\n `Conda environment automatic build was skipped`,\n );\n return;\n }\n\n this.logger.info(`Building conda environment for current platform...`);\n\n const srcSpecPath = path.resolve(this.pkgInfo.packageRoot, artifact.spec);\n if (!fs.existsSync(srcSpecPath)) {\n this.logger.error(\n `Conda environment specification file '${artifact.spec}' not found at '${srcSpecPath}'`,\n );\n throw util.CLIError(\n `Cannot build conda environment '${artifact.id}': no specification file.`,\n );\n }\n\n this.logger.debug(`Validating conda spec file for forbidden channels...`);\n try {\n validateCondaSpec(this.logger, srcSpecPath);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this.logger.error(errorMessage);\n throw util.CLIError(`Cannot build conda environment '${artifact.id}': ${errorMessage}`);\n }\n\n const micromambaRoot = path.join(contentRoot, defaults.CONDA_DATA_LOCATION);\n const micromambaBin = path.join(contentRoot, \"micromamba\");\n\n this.logger.debug(`Creating micromamba root directory: '${micromambaRoot}'`);\n await fsp.mkdir(micromambaRoot, { recursive: true });\n\n this.logger.debug(`Creating micromamba instance...`);\n const m = new micromamba(\n this.logger,\n micromambaRoot,\n artifact[\"micromamba-version\"],\n micromambaBin,\n );\n\n const resultSpecPath = path.join(contentRoot, defaults.CONDA_FROZEN_ENV_SPEC_FILE);\n\n await m.downloadBinary();\n m.createEnvironment({ specFile: srcSpecPath });\n m.exportEnvironment({ outputFile: resultSpecPath });\n m.deleteEnvironment({});\n\n this.logger.debug(`Conda environment was built at '${micromambaRoot}'.`);\n\n this.logger.debug(`Cutting prefix from conda environment file...`);\n\n const resultSpec = yaml.parse(await fsp.readFile(resultSpecPath, \"utf-8\")) as Record<\n string,\n unknown\n >;\n resultSpec.prefix = undefined; // cut original env location (with path from CI) from the resulting spec file\n\n // Fixup the structure: for empty lists export produces YAML that cannot be then read back on server side for restoration.\n if (!resultSpec.channels) {\n resultSpec.channels = [];\n }\n if (!resultSpec.dependencies) {\n resultSpec.dependencies = [];\n }\n await fsp.writeFile(resultSpecPath, yaml.stringify(resultSpec));\n\n this.logger.debug(`Conda environment file is ready: '${resultSpecPath}'`);\n }\n\n private async createPackageArchive(\n packageContentType: string,\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n archivePath: string,\n contentRoot: string,\n os: util.OSType,\n arch: util.ArchType,\n ) {\n this.logger.debug(` packing ${packageContentType} into a package`);\n if (artifacts.isCrossPlatform(artifact.type)) {\n this.logger.debug(` generating cross-platform package`);\n } else {\n this.logger.debug(` generating package for os='${os}', arch='${arch}'`);\n }\n this.logger.debug(` package content root: '${contentRoot}'`);\n this.logger.debug(` package destination archive: '${archivePath}'`);\n\n await archive.create(this.logger, contentRoot, archivePath);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(artInfoPath, {\n type: artifact.type,\n platform: util.joinPlatform(os, arch),\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, util.joinPlatform(os, arch)),\n });\n\n this.logger.info(`${packageContentType} archive is built:\n archive: '${archivePath}'\n location file: '${artInfoPath}'`);\n }\n\n public async publishPackages(options?: {\n ids?: string[];\n\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean; // do not warn if package already exists in storage, fail with error instead.\n forceReupload?: boolean; // re-upload packages even if they already exist in storage\n }) {\n this.logger.info(`Publishing packages...`);\n\n const packagesToPublish = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n const uploads: Promise<void>[] = [];\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"archive\");\n\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into archive. Cannot publish archive artifact.`,\n );\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(pkg.type)) {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n } else if (this.targetPlatform) {\n uploads.push(this.publishPackage(pkg, this.targetPlatform, options));\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(pkg)) {\n uploads.push(this.publishPackage(pkg, platform, options));\n }\n } else {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n }\n }\n\n await Promise.all(uploads);\n }\n\n private async publishPackage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n if (artifact.type === \"docker\") {\n this.publishDockerImage(artifact);\n return;\n }\n\n await this.publishArchive(artifact, platform, options);\n }\n\n private async publishArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n const { os, arch } = util.splitPlatform(platform);\n\n const artifactName = this.pkgInfo.artifactName(artifact);\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n const storageURL = options?.storageURL ?? registry.storageURL;\n\n const archivePath = options?.archivePath ?? this.archivePath(artifact, os, arch);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const dstName = artInfo.uploadPath ?? artInfo.remoteArtifactLocation;\n\n if (!storageURL) {\n const regNameUpper = registry.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n this.logger.error(`no storage URL is set for registry ${registry.name}`);\n throw util.CLIError(\n `'registry.storageURL' of package '${artifact.id}' is empty. Set it as command option, in '${util.softwareConfigName}' file or via environment variable 'PL_REGISTRY_${regNameUpper}_UPLOAD_URL'`,\n );\n }\n\n this.logger.info(\n `Publishing package '${artifactName}' for platform '${platform}' into registry '${registry.name}'`,\n );\n this.logger.debug(` registry storage URL: '${storageURL}'`);\n this.logger.debug(` archive to publish: '${archivePath}'`);\n this.logger.debug(` target package name: '${dstName}'`);\n\n const s = await storage.initByUrl(storageURL, this.pkgInfo.packageRoot);\n\n const exists = await s.exists(dstName);\n if (exists && !options?.forceReupload) {\n if (options?.failExisting) {\n throw util.CLIError(\n `software package '${dstName}' already exists in registry '${registry.name}'. To re-upload it, use 'force' flag. To not fail, remove 'fail-existing-packages' flag`,\n );\n }\n\n this.logger.warn(\n `software package '${dstName}' already exists in registry '${registry.name}'. Upload was skipped.`,\n );\n return;\n }\n\n const uploads: Promise<void>[] = [];\n\n const archive = fs.createReadStream(archivePath);\n uploads.push(\n s.putFile(dstName, archive).finally(() => {\n archive.close();\n return;\n }),\n );\n\n return Promise.all(uploads).then(() => {\n this.logger.info(`Package '${artifactName}' was published to '${registry.name}:${dstName}'`);\n return;\n });\n }\n\n public publishDockerImages(options?: {\n ids?: string[];\n pushTo?: string;\n strictPlatformMatching?: boolean; // if true, publish docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Publishing docker images...`);\n\n // Iterate only dockerPackages (matches buildDockerImages). Previously we\n // also iterated buildablePackages.keys(), but for entrypoints with a python\n // or conda binary that autogens a docker image, the binary key (e.g. \"main\")\n // and the virtual docker key (\"main:docker\") both resolve to the same\n // docker artifact via getArtifact's :docker fallback. That caused\n // publishDockerImage to run twice — first push succeeded, second saw the\n // tag in the registry and logged a misleading \"Skipping push...\" line.\n const packagesToPublish = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"docker\");\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into docker image. Cannot publish docker image.`,\n );\n }\n continue;\n }\n\n // Mirror the gate in buildDockerImages: in strict (CI) mode, only the\n // linux/x64 leg publishes so we don't race parallel pushes of the same\n // tag from arm and windows matrix legs. Dev (non-strict) mode pushes\n // unconditionally — the cross-compile produced a valid linux/amd64\n // image regardless of host.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image publish skipped for '${pkg.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.publishDockerImage(pkg, options?.pushTo);\n }\n }\n\n private publishDockerImage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n pushTo?: string,\n ) {\n if (artifact.type !== \"docker\") {\n throw util.CLIError(`package '${artifact.id}' is not a docker package`);\n }\n\n // Matches the \"x64\" write in buildDockerImage — docker artifacts are always\n // cross-compiled to linux/amd64 so we look up the x64 descriptor regardless\n // of host.\n const artInfoPath = this.pkgInfo.artifactInfoLocation(artifact.id, \"docker\", \"x64\");\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const tag = artInfo.remoteArtifactLocation;\n const pushTag = pushTo ? `${pushTo}:${tag.split(\":\").slice(-1)[0]}` : tag;\n\n // Because of turbo caching, we may face situation when no real docker build was executed on CI agent,\n // but image is already in remote registry. We should not fail in such scenarios, calmly skipping docker push step.\n const remoteImageExists = docker.remoteImageExists(pushTag);\n if (remoteImageExists) {\n this.logger.info(\n `Docker image '${tag}' not exists locally but is already in remote registry. Skipping push...`,\n );\n return;\n }\n\n const localImageExists = docker.localImageExists(tag);\n if (!localImageExists) {\n throw util.CLIError(\n `Docker image '${tag}' not exists locally and is not found in remote registry. Publication failed.`,\n );\n }\n\n if (pushTo) {\n docker.addTag(tag, pushTag);\n this.logger.info(`Publishing docker image '${tag}' using alternative tag '${pushTag}'`);\n } else {\n this.logger.info(`Publishing docker image '${tag}' with tag '${pushTag}'`);\n }\n\n docker.push(pushTag);\n }\n\n private get renderer(): SwJsonRenderer {\n if (!this._renderer) {\n this._renderer = new SwJsonRenderer(this.logger, this.pkgInfo);\n }\n\n return this._renderer;\n }\n\n private archiveOptions(\n pkg: artifacts.anyArtifactType,\n name: string,\n version: string,\n os: util.OSType,\n arch: util.ArchType,\n archiveType: archive.archiveType,\n ): archive.archiveOptions {\n return {\n packageRoot: this.pkgInfo.packageRoot,\n packageName: name,\n packageVersion: version,\n\n crossplatform: artifacts.isCrossPlatform(pkg.type),\n os: os,\n arch: arch,\n ext: archiveType,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAa,OAAb,MAAkB;CAChB;CACA;CACA;CAEA;CACA;CACA;CACA,eAA+B;CAC/B;CAEA,YACE,QACA,MAIA;AACA,OAAK,SAAS;AACd,OAAK,UAAU,MAAM,WAAW,IAAI,YAAY,QAAQ,EAAE,aAAa,MAAM,aAAa,CAAC;AAE3F,OAAK,YAAY;AAEjB,OAAK,cAAc;;CAGrB,IAAW,QAAQ,GAAuB;AACxC,OAAK,QAAQ,UAAU;;CAGzB,IAAW,YAAqB;AAC9B,SAAO,KAAK,QAAQ;;CAGtB,eACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,SAAS;EAChD,MAAM,UAAU,KAAK,QAAQ,gBAAgB,SAAS;AACtD,SAAOA,QAAgB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,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AC,KAAK,UACR,MAAK,YAAY,IAAI,eAAe,KAAK,QAAQ,KAAK,QAAQ;AAGhE,SAAO,KAAK;;CAGd,eACE,KACA,MACA,SACA,IACA,MACA,aACwB;AACxB,SAAO;GACL,aAAa,KAAK,QAAQ;GAC1B,aAAa;GACb,gBAAgB;GAEhB,eAAeC,gBAA0B,IAAI,KAAK;GAC9C;GACE;GACN,KAAK;GACN"}
|
|
1
|
+
{"version":3,"file":"core.js","names":["archive.getPath","docker.entrypointName","docker.isVirtualDockerEntrypointName","artifacts.isBuildable","util.CLIError","util.currentPlatform","artifacts.isCrossPlatform","util.splitPlatform","util.softwareConfigName","util.producesRegistryDescriptor","util.currentOS","util.currentArch","defaults.DOCKER_BUILD_PLATFORM","docker.generateLocalTagName","docker.getImageHash","docker.generateRemoteTagName","docker.getImageEntrypoint","defaults.CONDA_DATA_LOCATION","defaults.CONDA_FROZEN_ENV_SPEC_FILE","archive.create","util.joinPlatform","storage.initByUrl","docker.remoteImageExists","docker.localImageExists"],"sources":["../../src/core/core.ts"],"sourcesContent":["import fs from \"node:fs\";\nimport fsp from \"node:fs/promises\";\nimport path from \"node:path\";\nimport yaml from \"yaml\";\nimport type winston from \"winston\";\n\nimport * as defaults from \"../defaults\";\nimport { PackageInfo } from \"./package-info\";\nimport * as artifacts from \"./schemas/artifacts\";\nimport type * as entrypoint from \"./schemas/entrypoints\";\nimport { micromamba } from \"./conda/builder\";\nimport { validateCondaSpec } from \"./conda/validate-spec\";\nimport { SwJsonRenderer, readBuiltArtifactInfo, writeBuiltArtifactInfo } from \"./sw-json-render\";\nimport * as util from \"./util\";\nimport * as archive from \"./archive\";\nimport * as storage from \"./storage\";\nimport * as docker from \"./docker\";\nimport { tmpSpecFile } from \"./docker-conda\";\n\nexport class Core {\n private readonly logger: winston.Logger;\n private _entrypoints: Map<string, entrypoint.Entrypoint> | undefined;\n private _renderer: SwJsonRenderer | undefined;\n\n public readonly pkgInfo: PackageInfo;\n public targetPlatform: util.PlatformType | undefined;\n public allPlatforms: boolean = false;\n public fullDirHash: boolean;\n\n constructor(\n logger: winston.Logger,\n opts?: {\n pkgInfo?: PackageInfo;\n packageRoot?: string;\n },\n ) {\n this.logger = logger;\n this.pkgInfo = opts?.pkgInfo ?? new PackageInfo(logger, { packageRoot: opts?.packageRoot });\n\n this.fullDirHash = false;\n }\n\n public get buildMode(): util.BuildMode {\n return this.pkgInfo.buildMode;\n }\n\n public set buildMode(mode: util.BuildMode) {\n this.pkgInfo.buildMode = mode;\n }\n\n public set version(v: string | undefined) {\n this.pkgInfo.version = v;\n }\n\n public get isPrivate(): boolean {\n return this.pkgInfo.isPrivate;\n }\n\n public binArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"tgz\"));\n }\n\n public assetArchivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n const name = this.pkgInfo.artifactName(artifact);\n const version = this.pkgInfo.artifactVersion(artifact);\n return archive.getPath(this.archiveOptions(artifact, name, version, os, arch, \"zip\"));\n }\n\n public archivePath(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n os: util.OSType,\n arch: util.ArchType,\n ): string {\n if (artifact.type === \"asset\") {\n return this.assetArchivePath(artifact, os, arch);\n }\n\n return this.binArchivePath(artifact, os, arch);\n }\n\n public get entrypoints(): Map<string, entrypoint.Entrypoint> {\n if (!this._entrypoints) {\n this._entrypoints = this.pkgInfo.entrypoints;\n }\n\n return this._entrypoints;\n }\n\n public get packages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n const pkgs = new Map<string, artifacts.withId<artifacts.anyArtifactType>>();\n\n for (const [_, ep] of this.entrypoints.entries()) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n const key =\n ep.artifact.type === \"docker\" ? docker.entrypointName(ep.artifact.id) : ep.artifact.id;\n pkgs.set(key, ep.artifact);\n }\n\n return pkgs;\n }\n\n public get packageEntrypointsIndex(): Map<string, string[]> {\n const result = new Map<string, string[]>();\n\n for (const [epName, ep] of this.entrypoints) {\n if (ep.type === \"reference\") {\n // References have no pacakge definitions inside\n continue;\n }\n\n if (!result.has(ep.artifact.id)) {\n result.set(ep.artifact.id, []);\n }\n\n result.get(ep.artifact.id)!.push(epName);\n }\n\n return result;\n }\n\n public get buildablePackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => !docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => artifacts.isBuildable(value.type)),\n );\n }\n\n public get dockerPackages(): Map<string, artifacts.withId<artifacts.anyArtifactType>> {\n return new Map(\n Array.from(this.packages.entries())\n .filter(([id, _]) => docker.isVirtualDockerEntrypointName(id)) // do not show virtual docker entrypoints\n .filter(([, value]) => value.type === \"docker\"),\n );\n }\n\n public packageHasType(id: string, type: artifacts.artifactType): boolean {\n const pkg = this.packages.get(id);\n if (pkg && pkg.type === type) {\n return true;\n }\n\n // check 'magic' entrypoint name with suffix\n const dockerPkg = this.packages.get(docker.entrypointName(id));\n if (dockerPkg) {\n return true;\n }\n\n return false;\n }\n\n public getArtifact(\n id: string,\n type: \"docker\",\n ): artifacts.withId<artifacts.dockerType> | undefined;\n public getArtifact(\n id: string,\n type: \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined;\n public getArtifact(\n id: string,\n type: \"docker\" | \"archive\",\n ): artifacts.withId<artifacts.anyArtifactType> | undefined {\n const artifact = this.packages.get(id);\n\n switch (type) {\n case \"docker\": {\n if (artifact?.type === \"docker\") {\n return artifact;\n }\n // Virtual entrypoint with suffix specially for docker artifacts.\n return this.packages.get(docker.entrypointName(id));\n }\n case \"archive\": {\n if (artifact?.type === \"docker\") {\n return undefined;\n }\n return artifact;\n }\n default: {\n util.assertNever(type);\n return undefined;\n }\n }\n }\n\n // Get entrypoints defined in package.json, transform them to local or release (depending on `buildMode`)\n // sw.json entrypoint descriptors, and write them to ./dist/tengo/sw.json or as.json next to the package.json.\n public buildSwJsonFiles(options?: {\n packageIds?: string[];\n entrypoints?: string[];\n sources?: util.SoftwareSource[];\n requireAllArtifacts?: boolean;\n noSoftware?: boolean;\n }) {\n const index = this.packageEntrypointsIndex;\n\n const entrypointNames = options?.entrypoints ?? [];\n if (options?.packageIds) {\n for (const pkgId of options.packageIds) {\n const packageEntrypoints = index.get(pkgId);\n if (!packageEntrypoints || packageEntrypoints.length === 0) {\n throw util.CLIError(\n `cannot build descriptor for package ${pkgId}: no entrypoints found for package`,\n );\n }\n\n entrypointNames.push(...packageEntrypoints);\n }\n }\n\n let entrypoints = Array.from(this.entrypoints.entries());\n if (entrypointNames.length > 0) {\n entrypoints = entrypoints.filter(([epName, _]) => entrypointNames.includes(epName));\n }\n\n const infos = options?.noSoftware\n ? this.renderer.renderPlaceholderEntrypoints(new Map(entrypoints))\n : this.renderer.renderSoftwareEntrypoints(this.buildMode, new Map(entrypoints), {\n requireAllArtifacts: options?.requireAllArtifacts,\n fullDirHash: this.fullDirHash,\n });\n\n for (const swJson of infos.values()) {\n this.renderer.writeSwJson(swJson);\n }\n\n for (const [epName, ep] of entrypoints) {\n if (ep.type === \"reference\") {\n const srcPath = this.pkgInfo.resolveReference(epName, ep);\n this.renderer.copySwJson(epName, srcPath);\n }\n }\n }\n\n // Point artifact-info at the already-published, version-derived artifact without building or\n // uploading, so buildSwJsonFiles renders a registry descriptor for it. Release mode, binary only.\n public writePublishedArtifactInfo(options?: { ids?: string[] }) {\n const platform = util.currentPlatform();\n for (const [id, artifact] of this.buildablePackages) {\n if (options?.ids && !options.ids.includes(id)) continue;\n\n // Cross-platform archives are stored under a platform-agnostic key; this is the key\n // renderBinaryInfo reads back from.\n const locationKey = artifacts.isCrossPlatform(artifact.type) ? undefined : platform;\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(this.pkgInfo.artifactInfoLocation(id, \"archive\", locationKey), {\n type: artifact.type,\n platform,\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, platform),\n });\n }\n }\n\n public async buildSoftwareArchives(options?: {\n ids?: string[];\n forceBuild?: boolean;\n\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n }) {\n this.logger.info(`Building package archives...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n if (packagesToBuild.length > 1 && options?.archivePath && !options.forceBuild) {\n this.logger.error(\n \"Attempt to build several packages targeting single package archive. This will simply overwrite the archive several times. If you know what you are doing, add '--force' flag\",\n );\n throw util.CLIError(\n \"attempt to build several packages using the same software package archive\",\n );\n }\n\n for (const artifactID of packagesToBuild) {\n const artifact = this.getArtifact(artifactID, \"archive\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${artifactID}' is not buildable into archive. Skipped.`);\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(artifact.type)) {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n } else if (this.targetPlatform) {\n await this.buildSoftwareArchive(artifact, this.targetPlatform, options);\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(artifact)) {\n await this.buildSoftwareArchive(artifact, platform, options);\n }\n } else {\n await this.buildSoftwareArchive(artifact, util.currentPlatform(), options);\n }\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // artifact may be uploaded to the registry in content-addressable mode, when the artifact location\n // is derived from the actual artifact (software archive, docker image, etc) content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n public async buildSoftwareArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n contentRoot?: string;\n skipIfEmpty?: boolean;\n\n // Automated builds settings\n condaBuild?: boolean;\n },\n ) {\n this.logger.info(`Building software package '${artifact.id}' for platform '${platform}'...`);\n const { os, arch } = util.splitPlatform(platform);\n\n if (!artifacts.archiveArtifactTypes.includes(artifact.type)) {\n if (options?.skipIfEmpty) {\n this.logger.info(` archive build was skipped: package '${artifact.id}' is not buildable`);\n }\n this.logger.error(\n ` not buildable: artifact '${artifact.id}' archive build is impossible for configuration inside '${util.softwareConfigName}'`,\n );\n\n throw util.CLIError(\"not a buildable artifact\");\n }\n\n const contentRoot =\n options?.contentRoot ?? this.pkgInfo.artifactContentRoot(artifact, platform);\n\n if (artifact.type === \"asset\") {\n const archivePath = options?.archivePath ?? this.assetArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"assets\", artifact, archivePath, contentRoot, os, arch);\n return;\n }\n\n const artType = artifact.type;\n switch (artType) {\n case \"conda\": {\n if (options?.condaBuild === undefined || options.condaBuild) {\n // build by default, skip if explicitly disabled\n await this.buildCondaPackage({ artifact, platform, contentRoot });\n } else {\n this.logger.debug(`Conda environment build was skipped.`);\n }\n break;\n }\n }\n\n if (!util.producesRegistryDescriptor(this.buildMode)) {\n this.logger.info(\n ` no need to build software archive in '${this.buildMode}' mode: archive build was skipped`,\n );\n return;\n }\n\n const archivePath = options?.archivePath ?? this.binArchivePath(artifact, os, arch);\n await this.createPackageArchive(\"software\", artifact, archivePath, contentRoot, os, arch);\n }\n\n public buildDockerImages(options?: {\n ids?: string[];\n registry?: string;\n strictPlatformMatching?: boolean; // if true, build docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Building docker images...`);\n\n const packagesToBuild = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToBuild.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToBuild) {\n const artifact = this.getArtifact(pkgID, \"docker\");\n\n if (!artifact) {\n if (options?.ids) {\n this.logger.warn(`Package '${pkgID}' is not buildable into docker image. Skipped.`);\n }\n continue;\n }\n\n // Docker images are always built as linux/amd64 (Platforma's K8s target);\n // on non-x64 hosts pl-pkg cross-compiles via qemu so dev iteration on\n // Macs works. In CI, strictPlatformMatching is set on the caller side\n // and we still want exactly one matrix leg (linux/x64) to do the work —\n // otherwise every arm/windows runner duplicates the build and Windows\n // runners outright fail on 'docker build --platform linux/amd64'.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image build skipped for '${artifact.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n // Docker software is built as linux/amd64 only (Platforma's K8s target). An explicit\n // non-x64 target cannot be honored — fail clearly instead of silently emitting amd64.\n if (this.targetPlatform && util.splitPlatform(this.targetPlatform).arch !== \"x64\") {\n throw util.CLIError(\n `cannot build docker image '${artifact.id}' for target '${this.targetPlatform}': ` +\n `docker software is built as ${defaults.DOCKER_BUILD_PLATFORM} only`,\n );\n }\n\n this.buildDockerImage(artifact.id, artifact, options?.registry);\n }\n }\n\n // NOTE: each artifact build consists of 2 components:\n // - built artifact in any shape (archive, docker image, etc)\n // - artifact location file, that contains address of the artifact in registry (docker tag, archive path and so on)\n //\n // docker image is uploaded to the registry after build with unique tag that is derived from the actual image content.\n // artifact location files are used to build sw.json entrypoint descriptor with correct artifact address.\n private buildDockerImage(\n pkgID: string,\n artifact: artifacts.withId<artifacts.dockerType>,\n registry?: string,\n ) {\n const dockerfile = path.resolve(this.pkgInfo.packageRoot, artifact.dockerfile ?? \"Dockerfile\");\n const context = path.resolve(this.pkgInfo.packageRoot, artifact.context ?? \".\");\n registry = registry ?? artifact.registry;\n\n if (!fs.existsSync(dockerfile)) {\n throw util.CLIError(`Dockerfile '${dockerfile}' not found`);\n }\n\n if (!fs.existsSync(context)) {\n throw util.CLIError(`Context '${context}' not found`);\n }\n\n const localTag = docker.generateLocalTagName(this.pkgInfo.packageRoot, artifact);\n\n this.logger.info(`Building docker image for '${pkgID}'...`);\n this.logger.debug(` dockerfile: '${dockerfile}'\n context: '${context}'\n localTag: '${localTag}'\n `);\n\n const name = this.pkgInfo.artifactName(artifact);\n\n docker.build(context, dockerfile, localTag, name, this.pkgInfo.version);\n\n const imageHash = docker.getImageHash(localTag);\n const dstTag = docker.generateRemoteTagName(name, imageHash, registry);\n\n this.logger.debug(`Adding destination tag to docker image:\n dstTag: \"${dstTag}\"\n `);\n docker.addTag(localTag, dstTag);\n // do not remove local tag to make 'local' builds to also work with docker.\n\n // Docker images target linux/amd64 regardless of host (see docker.build).\n const artInfoPath = this.pkgInfo.artifactInfoLocation(pkgID, \"docker\", \"x64\");\n writeBuiltArtifactInfo(artInfoPath, {\n type: \"docker\",\n platform: \"linux-x64\",\n remoteArtifactLocation: dstTag,\n entrypoint: docker.getImageEntrypoint(localTag),\n });\n\n this.logger.info(`Docker image is built:\n tag: '${dstTag}'\n location file: '${artInfoPath}'`);\n\n this.logger.debug(`Clearing context directory from temporary files...`);\n if (fs.existsSync(path.join(context, tmpSpecFile))) {\n fs.unlinkSync(path.join(context, tmpSpecFile));\n }\n }\n\n private async buildCondaPackage(opts: {\n artifact: artifacts.withId<artifacts.condaType>;\n platform: util.PlatformType;\n contentRoot: string;\n }) {\n const { artifact, platform, contentRoot } = opts;\n\n if (platform !== util.currentPlatform()) {\n this.logger.warn(\n `Conda package cannot be built cross-platform:\\n` +\n ` current platform is '${util.currentPlatform()}', requested platform is '${platform}'\\n` +\n `Conda environment automatic build was skipped`,\n );\n return;\n }\n\n this.logger.info(`Building conda environment for current platform...`);\n\n const srcSpecPath = path.resolve(this.pkgInfo.packageRoot, artifact.spec);\n if (!fs.existsSync(srcSpecPath)) {\n this.logger.error(\n `Conda environment specification file '${artifact.spec}' not found at '${srcSpecPath}'`,\n );\n throw util.CLIError(\n `Cannot build conda environment '${artifact.id}': no specification file.`,\n );\n }\n\n this.logger.debug(`Validating conda spec file for forbidden channels...`);\n try {\n validateCondaSpec(this.logger, srcSpecPath);\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : String(error);\n this.logger.error(errorMessage);\n throw util.CLIError(`Cannot build conda environment '${artifact.id}': ${errorMessage}`);\n }\n\n const micromambaRoot = path.join(contentRoot, defaults.CONDA_DATA_LOCATION);\n const micromambaBin = path.join(contentRoot, \"micromamba\");\n\n this.logger.debug(`Creating micromamba root directory: '${micromambaRoot}'`);\n await fsp.mkdir(micromambaRoot, { recursive: true });\n\n this.logger.debug(`Creating micromamba instance...`);\n const m = new micromamba(\n this.logger,\n micromambaRoot,\n artifact[\"micromamba-version\"],\n micromambaBin,\n );\n\n const resultSpecPath = path.join(contentRoot, defaults.CONDA_FROZEN_ENV_SPEC_FILE);\n\n await m.downloadBinary();\n m.createEnvironment({ specFile: srcSpecPath });\n m.exportEnvironment({ outputFile: resultSpecPath });\n m.deleteEnvironment({});\n\n this.logger.debug(`Conda environment was built at '${micromambaRoot}'.`);\n\n this.logger.debug(`Cutting prefix from conda environment file...`);\n\n const resultSpec = yaml.parse(await fsp.readFile(resultSpecPath, \"utf-8\")) as Record<\n string,\n unknown\n >;\n resultSpec.prefix = undefined; // cut original env location (with path from CI) from the resulting spec file\n\n // Fixup the structure: for empty lists export produces YAML that cannot be then read back on server side for restoration.\n if (!resultSpec.channels) {\n resultSpec.channels = [];\n }\n if (!resultSpec.dependencies) {\n resultSpec.dependencies = [];\n }\n await fsp.writeFile(resultSpecPath, yaml.stringify(resultSpec));\n\n this.logger.debug(`Conda environment file is ready: '${resultSpecPath}'`);\n }\n\n private async createPackageArchive(\n packageContentType: string,\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n archivePath: string,\n contentRoot: string,\n os: util.OSType,\n arch: util.ArchType,\n ) {\n this.logger.debug(` packing ${packageContentType} into a package`);\n if (artifacts.isCrossPlatform(artifact.type)) {\n this.logger.debug(` generating cross-platform package`);\n } else {\n this.logger.debug(` generating package for os='${os}', arch='${arch}'`);\n }\n this.logger.debug(` package content root: '${contentRoot}'`);\n this.logger.debug(` package destination archive: '${archivePath}'`);\n\n await archive.create(this.logger, contentRoot, archivePath);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n\n writeBuiltArtifactInfo(artInfoPath, {\n type: artifact.type,\n platform: util.joinPlatform(os, arch),\n registryURL: registry.downloadURL,\n registryName: registry.name,\n remoteArtifactLocation: this.pkgInfo.artifactArchiveAddressPattern(artifact),\n uploadPath: this.pkgInfo.artifactArchiveFullName(artifact, util.joinPlatform(os, arch)),\n });\n\n this.logger.info(`${packageContentType} archive is built:\n archive: '${archivePath}'\n location file: '${artInfoPath}'`);\n }\n\n public async publishPackages(options?: {\n ids?: string[];\n\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean; // do not warn if package already exists in storage, fail with error instead.\n forceReupload?: boolean; // re-upload packages even if they already exist in storage\n }) {\n this.logger.info(`Publishing packages...`);\n\n const packagesToPublish = options?.ids ?? Array.from(this.buildablePackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n const uploads: Promise<void>[] = [];\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"archive\");\n\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into archive. Cannot publish archive artifact.`,\n );\n }\n continue;\n }\n\n if (artifacts.isCrossPlatform(pkg.type)) {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n } else if (this.targetPlatform) {\n uploads.push(this.publishPackage(pkg, this.targetPlatform, options));\n } else if (this.allPlatforms) {\n for (const platform of this.pkgInfo.artifactPlatforms(pkg)) {\n uploads.push(this.publishPackage(pkg, platform, options));\n }\n } else {\n uploads.push(this.publishPackage(pkg, util.currentPlatform(), options));\n }\n }\n\n await Promise.all(uploads);\n }\n\n private async publishPackage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n if (artifact.type === \"docker\") {\n this.publishDockerImage(artifact);\n return;\n }\n\n await this.publishArchive(artifact, platform, options);\n }\n\n private async publishArchive(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n platform: util.PlatformType,\n options?: {\n archivePath?: string;\n storageURL?: string;\n failExisting?: boolean;\n forceReupload?: boolean;\n },\n ) {\n const { os, arch } = util.splitPlatform(platform);\n\n const artifactName = this.pkgInfo.artifactName(artifact);\n const registry = this.pkgInfo.artifactRegistrySettings(artifact);\n const storageURL = options?.storageURL ?? registry.storageURL;\n\n const archivePath = options?.archivePath ?? this.archivePath(artifact, os, arch);\n\n const artInfoPath = this.pkgInfo.artifactInfoLocation(\n artifact.id,\n \"archive\",\n artifacts.isCrossPlatform(artifact.type) ? undefined : util.joinPlatform(os, arch),\n );\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const dstName = artInfo.uploadPath ?? artInfo.remoteArtifactLocation;\n\n if (!storageURL) {\n const regNameUpper = registry.name.toUpperCase().replaceAll(/[^A-Z0-9_]/g, \"_\");\n this.logger.error(`no storage URL is set for registry ${registry.name}`);\n throw util.CLIError(\n `'registry.storageURL' of package '${artifact.id}' is empty. Set it as command option, in '${util.softwareConfigName}' file or via environment variable 'PL_REGISTRY_${regNameUpper}_UPLOAD_URL'`,\n );\n }\n\n this.logger.info(\n `Publishing package '${artifactName}' for platform '${platform}' into registry '${registry.name}'`,\n );\n this.logger.debug(` registry storage URL: '${storageURL}'`);\n this.logger.debug(` archive to publish: '${archivePath}'`);\n this.logger.debug(` target package name: '${dstName}'`);\n\n const s = await storage.initByUrl(storageURL, this.pkgInfo.packageRoot);\n\n const exists = await s.exists(dstName);\n if (exists && !options?.forceReupload) {\n if (options?.failExisting) {\n throw util.CLIError(\n `software package '${dstName}' already exists in registry '${registry.name}'. To re-upload it, use 'force' flag. To not fail, remove 'fail-existing-packages' flag`,\n );\n }\n\n this.logger.warn(\n `software package '${dstName}' already exists in registry '${registry.name}'. Upload was skipped.`,\n );\n return;\n }\n\n const uploads: Promise<void>[] = [];\n\n const archive = fs.createReadStream(archivePath);\n uploads.push(\n s.putFile(dstName, archive).finally(() => {\n archive.close();\n return;\n }),\n );\n\n return Promise.all(uploads).then(() => {\n this.logger.info(`Package '${artifactName}' was published to '${registry.name}:${dstName}'`);\n return;\n });\n }\n\n public publishDockerImages(options?: {\n ids?: string[];\n pushTo?: string;\n strictPlatformMatching?: boolean; // if true, publish docker images only on linux OS and only for supported architectures. Used in CI.\n }) {\n this.logger.info(`Publishing docker images...`);\n\n // Iterate only dockerPackages (matches buildDockerImages). Previously we\n // also iterated buildablePackages.keys(), but for entrypoints with a python\n // or conda binary that autogens a docker image, the binary key (e.g. \"main\")\n // and the virtual docker key (\"main:docker\") both resolve to the same\n // docker artifact via getArtifact's :docker fallback. That caused\n // publishDockerImage to run twice — first push succeeded, second saw the\n // tag in the registry and logged a misleading \"Skipping push...\" line.\n const packagesToPublish = options?.ids ?? Array.from(this.dockerPackages.keys());\n this.logger.debug(`Selected packages:\\n ${packagesToPublish.join(\"\\n \")}`);\n this.logger.debug(`All known packages:\\n ${Array.from(this.packages.keys()).join(\"\\n \")}`);\n\n for (const pkgID of packagesToPublish) {\n const pkg = this.getArtifact(pkgID, \"docker\");\n if (!pkg) {\n if (options?.ids) {\n this.logger.warn(\n `Package '${pkgID}' is not buildable into docker image. Cannot publish docker image.`,\n );\n }\n continue;\n }\n\n // Mirror the gate in buildDockerImages: in strict (CI) mode, only the\n // linux/x64 leg publishes so we don't race parallel pushes of the same\n // tag from arm and windows matrix legs. Dev (non-strict) mode pushes\n // unconditionally — the cross-compile produced a valid linux/amd64\n // image regardless of host.\n if (options?.strictPlatformMatching) {\n if (util.currentOS() !== \"linux\" || util.currentArch() !== \"x64\") {\n this.logger.debug(\n `Docker image publish skipped for '${pkg.id}': strict-platform mode requires linux/x64 host`,\n );\n continue;\n }\n }\n\n this.publishDockerImage(pkg, options?.pushTo);\n }\n }\n\n private publishDockerImage(\n artifact: artifacts.withId<artifacts.anyArtifactType>,\n pushTo?: string,\n ) {\n if (artifact.type !== \"docker\") {\n throw util.CLIError(`package '${artifact.id}' is not a docker package`);\n }\n\n // Matches the \"x64\" write in buildDockerImage — docker artifacts are always\n // cross-compiled to linux/amd64 so we look up the x64 descriptor regardless\n // of host.\n const artInfoPath = this.pkgInfo.artifactInfoLocation(artifact.id, \"docker\", \"x64\");\n const artInfo = readBuiltArtifactInfo(artInfoPath);\n const tag = artInfo.remoteArtifactLocation;\n const pushTag = pushTo ? `${pushTo}:${tag.split(\":\").slice(-1)[0]}` : tag;\n\n // Because of turbo caching, we may face situation when no real docker build was executed on CI agent,\n // but image is already in remote registry. We should not fail in such scenarios, calmly skipping docker push step.\n const remoteImageExists = docker.remoteImageExists(pushTag);\n if (remoteImageExists) {\n this.logger.info(\n `Docker image '${tag}' not exists locally but is already in remote registry. Skipping push...`,\n );\n return;\n }\n\n const localImageExists = docker.localImageExists(tag);\n if (!localImageExists) {\n throw util.CLIError(\n `Docker image '${tag}' not exists locally and is not found in remote registry. Publication failed.`,\n );\n }\n\n if (pushTo) {\n docker.addTag(tag, pushTag);\n this.logger.info(`Publishing docker image '${tag}' using alternative tag '${pushTag}'`);\n } else {\n this.logger.info(`Publishing docker image '${tag}' with tag '${pushTag}'`);\n }\n\n docker.push(pushTag);\n }\n\n private get renderer(): SwJsonRenderer {\n if (!this._renderer) {\n this._renderer = new SwJsonRenderer(this.logger, this.pkgInfo);\n }\n\n return this._renderer;\n }\n\n private archiveOptions(\n pkg: artifacts.anyArtifactType,\n name: string,\n version: string,\n os: util.OSType,\n arch: util.ArchType,\n archiveType: archive.archiveType,\n ): archive.archiveOptions {\n return {\n packageRoot: this.pkgInfo.packageRoot,\n packageName: name,\n packageVersion: version,\n\n crossplatform: artifacts.isCrossPlatform(pkg.type),\n os: os,\n arch: arch,\n ext: archiveType,\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,IAAa,OAAb,MAAkB;CAChB;CACA;CACA;CAEA;CACA;CACA,eAA+B;CAC/B;CAEA,YACE,QACA,MAIA;EACA,KAAK,SAAS;EACd,KAAK,UAAU,MAAM,WAAW,IAAI,YAAY,QAAQ,EAAE,aAAa,MAAM,YAAY,CAAC;EAE1F,KAAK,cAAc;CACrB;CAEA,IAAW,YAA4B;EACrC,OAAO,KAAK,QAAQ;CACtB;CAEA,IAAW,UAAU,MAAsB;EACzC,KAAK,QAAQ,YAAY;CAC3B;CAEA,IAAW,QAAQ,GAAuB;EACxC,KAAK,QAAQ,UAAU;CACzB;CAEA,IAAW,YAAqB;EAC9B,OAAO,KAAK,QAAQ;CACtB;CAEA,eACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,QAAQ;EAC/C,MAAM,UAAU,KAAK,QAAQ,gBAAgB,QAAQ;EACrD,OAAOA,QAAgB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,KAAK,CAAC;CACtF;CAEA,iBACE,UACA,IACA,MACQ;EACR,MAAM,OAAO,KAAK,QAAQ,aAAa,QAAQ;EAC/C,MAAM,UAAU,KAAK,QAAQ,gBAAgB,QAAQ;EACrD,OAAOA,QAAgB,KAAK,eAAe,UAAU,MAAM,SAAS,IAAI,MAAM,KAAK,CAAC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OA,IAAI,SAAS;QACPM,UAAe,MAAM,WAAWC,YAAiB,MAAM,OAAO;KAChE,KAAK,OAAO,MACV,qCAAqC,IAAI,GAAG,gDAC9C;KACA;IACF;;GAGF,KAAK,mBAAmB,KAAK,SAAS,MAAM;EAC9C;CACF;CAEA,mBACE,UACA,QACA;EACA,IAAI,SAAS,SAAS,UACpB,MAAMP,SAAc,YAAY,SAAS,GAAG,0BAA0B;EAQxE,MAAM,MADU,sBADI,KAAK,QAAQ,qBAAqB,SAAS,IAAI,UAAU,KAC7B,CAC9B,CAAC,CAAC;EACpB,MAAM,UAAU,SAAS,GAAG,OAAO,GAAG,IAAI,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO;EAKtE,IAD0BkB,kBAAyB,OAC/B,GAAG;GACrB,KAAK,OAAO,KACV,iBAAiB,IAAI,yEACvB;GACA;EACF;EAGA,IAAI,CADqBC,iBAAwB,GAC7B,GAClB,MAAMnB,SACJ,iBAAiB,IAAI,8EACvB;EAGF,IAAI,QAAQ;GACV,OAAc,KAAK,OAAO;GAC1B,KAAK,OAAO,KAAK,4BAA4B,IAAI,2BAA2B,QAAQ,EAAE;EACxF,OACE,KAAK,OAAO,KAAK,4BAA4B,IAAI,cAAc,QAAQ,EAAE;EAG3E,KAAY,OAAO;CACrB;CAEA,IAAY,WAA2B;EACrC,IAAI,CAAC,KAAK,WACR,KAAK,YAAY,IAAI,eAAe,KAAK,QAAQ,KAAK,OAAO;EAG/D,OAAO,KAAK;CACd;CAEA,eACE,KACA,MACA,SACA,IACA,MACA,aACwB;EACxB,OAAO;GACL,aAAa,KAAK,QAAQ;GAC1B,aAAa;GACb,gBAAgB;GAEhB,eAAeE,gBAA0B,IAAI,IAAI;GAC7C;GACE;GACN,KAAK;EACP;CACF;AACF"}
|
|
@@ -6,9 +6,9 @@ const require_paths = require("./paths.cjs");
|
|
|
6
6
|
const require_builder = require("./conda/builder.cjs");
|
|
7
7
|
const require_validate_spec = require("./conda/validate-spec.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
|
-
node_fs = require_runtime.__toESM(node_fs);
|
|
9
|
+
node_fs = require_runtime.__toESM(node_fs, 1);
|
|
10
10
|
let node_path = require("node:path");
|
|
11
|
-
node_path = require_runtime.__toESM(node_path);
|
|
11
|
+
node_path = require_runtime.__toESM(node_path, 1);
|
|
12
12
|
//#region src/core/docker-conda.ts
|
|
13
13
|
const tmpSpecFile = "tmp-env-spec-88344b62d74b9307.yaml";
|
|
14
14
|
function generateCondaDockerfileContent(options, arch) {
|