Files
renovate/lib/modules/manager/mise/schema.ts
Pieter Willekens 141e136869 feat(manager/mise): support gitlab backend (#44116)
* feat(manager/mise): support gitlab backend

Maps the mise `gitlab` backend (e.g. `gitlab:gitlab-org/cli`) to the gitlab-releases datasource, mirroring the github backend including version_prefix support.

* refactor(manager/mise): use optional instead of Nullish for tool options

TOML has no null type, so MiseToolOptions values are only ever a string or absent. .optional() models that exactly; Nullish only adds value for sources that can emit explicit null.

* fix(manager/mise): use RegExp.escape in gitlab backend

Main switched `createGithubToolConfig` from the `escapeRegExp` util to
`RegExp.escape` and dropped the import, which left the newly added
`createGitlabToolConfig` referencing an undefined symbol after the merge.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Michael Kriese <michael.kriese@mend.io>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-11 10:04:37 +00:00

65 lines
1.5 KiB
TypeScript

import { z } from 'zod/v4';
import { Toml } from '../../../util/schema-utils/index.ts';
export const MiseRegistryJson = z.object({
meta: z.object({
version: z.string(),
}),
tools: z.record(z.string(), z.record(z.string(), z.string())),
});
const MiseToolOptions = z.object({
// ubi backend only
tag_regex: z.string().optional(),
// github and gitlab backends
version_prefix: z.string().optional(),
});
export type MiseToolOptions = z.infer<typeof MiseToolOptions>;
const MiseTool = z.union([
z.string(),
MiseToolOptions.extend({
version: z.string().optional(),
}),
z.array(z.string()),
]);
export type MiseTool = z.infer<typeof MiseTool>;
const MiseTask = z
.object({
tools: z.record(z.string(), MiseTool).optional(),
})
.passthrough()
.catch({});
export const MiseFile = Toml.pipe(
z.object({
tools: z.record(z.string(), MiseTool).default({}),
tasks: z.record(z.string(), MiseTask).default({}),
}),
);
export type MiseFile = z.infer<typeof MiseFile>;
const MiseLockTool = z.object({
version: z.string(),
backend: z.string().optional(),
options: z.record(z.string(), z.string()).optional(),
platforms: z
.record(
z.string(),
z.object({
checksum: z.string().optional(),
size: z.number().optional(),
url: z.string().optional(),
}),
)
.optional(),
});
export const MiseLockFile = Toml.pipe(
z.object({
tools: z.record(z.string(), z.array(MiseLockTool)),
}),
);
export type MiseLockFile = z.infer<typeof MiseLockFile>;