From c2149b200a3e3ad187df3324bd38ce8083a5d335 Mon Sep 17 00:00:00 2001 From: Vincent MEURISSE Date: Tue, 17 Feb 2026 13:21:24 +0100 Subject: [PATCH] feat: add mise Add support for https://github.com/jdx/mise Fix: #5935 --- .github/renovate.json | 2 + docs/custom-registries.md | 17 +++++++ src/cli/install-tool/index.ts | 3 ++ src/cli/tools/index.ts | 1 + src/cli/tools/mise.ts | 83 +++++++++++++++++++++++++++++++++++ test/Dockerfile.distro | 3 ++ test/latest/Dockerfile | 3 ++ test/latest/Dockerfile.arm64 | 3 ++ 8 files changed, 115 insertions(+) create mode 100644 src/cli/tools/mise.ts diff --git a/.github/renovate.json b/.github/renovate.json index 6ecf884ffc..e350f4ba4b 100644 --- a/.github/renovate.json +++ b/.github/renovate.json @@ -81,6 +81,7 @@ "hashin", "helm", "helmfile", + "mise", "nix", "node", "npm", @@ -130,6 +131,7 @@ "hashin", "helm", "helmfile", + "mise", "nix", "node", "npm", diff --git a/docs/custom-registries.md b/docs/custom-registries.md index 487d556cd5..581501bfa0 100644 --- a/docs/custom-registries.md +++ b/docs/custom-registries.md @@ -386,6 +386,23 @@ Samples: https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv5.3.0/kustomize_v5.3.0_linux_amd64.tar.gz ``` +## `mise` + +mise releases are downloaded from: + +- `https://github.com/jdx/mise/releases` + +When no version is specified, the url `https://mise.jdx.dev/VERSION` is used to find the latest version. + +Samples: + +```txt +https://github.com/jdx/mise/releases/download/v2026.2.13/mise-v2026.2.13-linux-x64.tar.xz +https://github.com/jdx/mise/releases/download/v2026.2.13/mise-v2026.2.13-linux-arm64.tar.xz +https://github.com/jdx/mise/releases/download/v2026.2.13/SHASUMS256.txt +https://mise.jdx.dev/VERSION +``` + ## `mono` Mono releases are downloaded from: diff --git a/src/cli/install-tool/index.ts b/src/cli/install-tool/index.ts index ab21ab1016..987537077e 100644 --- a/src/cli/install-tool/index.ts +++ b/src/cli/install-tool/index.ts @@ -48,6 +48,7 @@ import { ScalaInstallService } from '../tools/java/scala'; import { JsonnetBundlerInstallService } from '../tools/jb'; import { KubectlInstallService } from '../tools/kubectl'; import { KustomizeInstallService } from '../tools/kustomize'; +import { MiseInstallService, MiseVersionResolver } from '../tools/mise'; import { MonoInstallService } from '../tools/mono'; import { NixInstallService } from '../tools/nix'; import { NodeInstallService } from '../tools/node'; @@ -145,6 +146,7 @@ async function prepareInstallContainer(): Promise { container.bind(INSTALL_TOOL_TOKEN).to(KubectlInstallService); container.bind(INSTALL_TOOL_TOKEN).to(KustomizeInstallService); container.bind(INSTALL_TOOL_TOKEN).to(MavenInstallService); + container.bind(INSTALL_TOOL_TOKEN).to(MiseInstallService); container.bind(INSTALL_TOOL_TOKEN).to(MonoInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NixInstallService); container.bind(INSTALL_TOOL_TOKEN).to(NugetInstallService); @@ -202,6 +204,7 @@ function prepareResolveContainer(): Container { container.bind(TOOL_VERSION_RESOLVER).to(JavaJreVersionResolver); container.bind(TOOL_VERSION_RESOLVER).to(JavaJdkVersionResolver); container.bind(TOOL_VERSION_RESOLVER).to(MavenVersionResolver); + container.bind(TOOL_VERSION_RESOLVER).to(MiseVersionResolver); container.bind(TOOL_VERSION_RESOLVER).to(NodeVersionResolver); container.bind(TOOL_VERSION_RESOLVER).to(NugetVersionResolver); container.bind(TOOL_VERSION_RESOLVER).to(PhpVersionResolver); diff --git a/src/cli/tools/index.ts b/src/cli/tools/index.ts index dd7392f89f..76725c520f 100644 --- a/src/cli/tools/index.ts +++ b/src/cli/tools/index.ts @@ -27,6 +27,7 @@ export const NoPrepareTools = [ 'kustomize', 'lerna', 'maven', + 'mise', 'nix', 'nuget', 'npm', diff --git a/src/cli/tools/mise.ts b/src/cli/tools/mise.ts new file mode 100644 index 0000000000..fc67b6e93c --- /dev/null +++ b/src/cli/tools/mise.ts @@ -0,0 +1,83 @@ +import fs from 'node:fs/promises'; +import { join } from 'node:path'; +import { isNonEmptyStringAndNotWhitespace } from '@sindresorhus/is'; +import { injectFromHierarchy, injectable } from 'inversify'; +import { BaseInstallService } from '../install-tool/base-install.service'; +import { ToolVersionResolver } from '../install-tool/tool-version-resolver'; + +@injectable() +@injectFromHierarchy() +export class MiseInstallService extends BaseInstallService { + readonly name = 'mise'; + + private get arch(): string { + switch (this.envSvc.arch) { + case 'arm64': + return 'arm64'; + case 'amd64': + return 'x64'; + } + } + + override async install(version: string): Promise { + /** + * @example + * @see {@href https://github.com/jdx/mise/releases/tag/v2026.2.13} + */ + const baseUrl = `https://github.com/jdx/mise/releases/download/v${version}/`; + + const filename = `mise-v${version}-linux-${this.arch}.tar.xz`; + + const checksumFile = await this.http.download({ + url: `${baseUrl}SHASUMS256.txt`, + }); + const expectedChecksum = (await fs.readFile(checksumFile, 'utf-8')) + .split('\n') + .find((l) => l.endsWith(` ./${filename}`)) + ?.split(/\s+/)[0]; + + if (!expectedChecksum) { + throw new Error( + `Cannot find checksum for '${filename}' in SHASUMS256.txt`, + ); + } + + const file = await this.http.download({ + url: `${baseUrl}${filename}`, + checksumType: 'sha256', + expectedChecksum, + }); + + await this.pathSvc.ensureToolPath(this.name); + + const path = await this.pathSvc.createVersionedToolPath(this.name, version); + await this.compress.extract({ + file, + cwd: path, + strip: 1, + files: ['mise/bin/mise'], + }); + } + + override async link(version: string): Promise { + const src = join(this.pathSvc.versionedToolPath(this.name, version), 'bin'); + await this.shellwrapper({ srcDir: src }); + } + + override async test(_version: string): Promise { + await this._spawn(this.name, ['version']); + } +} + +@injectable() +@injectFromHierarchy() +export class MiseVersionResolver extends ToolVersionResolver { + readonly tool = 'mise'; + + async resolve(version: string | undefined): Promise { + if (!isNonEmptyStringAndNotWhitespace(version) || version === 'latest') { + return (await this.http.get('https://mise.jdx.dev/VERSION')).trim(); + } + return version; + } +} diff --git a/test/Dockerfile.distro b/test/Dockerfile.distro index 7d5846e13c..73d6e117fd 100644 --- a/test/Dockerfile.distro +++ b/test/Dockerfile.distro @@ -88,6 +88,9 @@ RUN install-tool kubectl v1.35.1 # renovate: datasource=github-releases packageName=kubernetes-sigs/kustomize RUN install-tool kustomize 5.8.1 +# renovate: datasource=github-releases packageName=jdx/mise +RUN install-tool mise 2026.2.13 + # renovate: datasource=datasource=github-releases packageName=containerbase/nix-prebuild RUN install-tool nix 2.24.10 diff --git a/test/latest/Dockerfile b/test/latest/Dockerfile index 089da2fec6..14d4084170 100644 --- a/test/latest/Dockerfile +++ b/test/latest/Dockerfile @@ -237,6 +237,9 @@ RUN install-tool gleam 1.14.0 # renovate: datasource=github-releases packageName=kubernetes/kubernetes RUN install-tool kubectl v1.35.1 +# renovate: datasource=github-releases packageName=jdx/mise +RUN install-tool mise 2026.2.13 + # renovate: datasource=github-releases packageName=containerbase/skopeo-prebuild RUN install-tool skopeo 1.22.0 diff --git a/test/latest/Dockerfile.arm64 b/test/latest/Dockerfile.arm64 index 718c69d631..ff36c6fb79 100644 --- a/test/latest/Dockerfile.arm64 +++ b/test/latest/Dockerfile.arm64 @@ -176,6 +176,9 @@ FROM base AS test-others # renovate: datasource=github-releases packageName=kubernetes/kubernetes RUN install-tool kubectl v1.35.1 +# renovate: datasource=github-releases packageName=jdx/mise +RUN install-tool mise 2026.2.13 + # renovate: datasource=github-releases packageName=containerbase/skopeo-prebuild RUN install-tool skopeo 1.22.0