feat: v2
This commit is contained in:
@@ -6,11 +6,6 @@ import { IMAGE_REGISTRY } from "../const";
|
||||
const DEFAULT_CONFIG_FILE = ".kuberrc.ts";
|
||||
|
||||
export const DEFAULT_REGISTRY = IMAGE_REGISTRY;
|
||||
export const DEFAULT_BUILDERS = {
|
||||
amd64: "kuber@astral-th",
|
||||
arm64: "kuber@astral",
|
||||
remoteRoot: "kuber-build",
|
||||
} as const;
|
||||
export const DEFAULT_ROLLOUT_TIMEOUT_MS = 300_000;
|
||||
|
||||
type Hooks = Pick<
|
||||
@@ -23,11 +18,6 @@ export type ResolvedKuberConfig = Hooks & {
|
||||
projectConfigured: boolean;
|
||||
composeFile?: string;
|
||||
registry: string;
|
||||
builders: {
|
||||
amd64: string;
|
||||
arm64: string;
|
||||
remoteRoot: string;
|
||||
};
|
||||
rolloutTimeoutMs: number;
|
||||
configFile?: string;
|
||||
};
|
||||
@@ -64,22 +54,6 @@ function validateConfig(config: unknown, file: string): KuberConfig {
|
||||
if (value.registry !== undefined)
|
||||
requireNonEmptyString(value.registry, "registry");
|
||||
|
||||
if (value.builders !== undefined) {
|
||||
if (
|
||||
!value.builders ||
|
||||
typeof value.builders !== "object" ||
|
||||
Array.isArray(value.builders)
|
||||
) {
|
||||
throw new Error(`builders in ${file} must be an object`);
|
||||
}
|
||||
const builders = value.builders as Record<string, unknown>;
|
||||
for (const field of ["amd64", "arm64", "remoteRoot"]) {
|
||||
if (builders[field] !== undefined) {
|
||||
requireNonEmptyString(builders[field], `builders.${field}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
value.rolloutTimeoutMs !== undefined &&
|
||||
(typeof value.rolloutTimeoutMs !== "number" ||
|
||||
@@ -148,7 +122,6 @@ export async function loadConfig(
|
||||
configFile,
|
||||
)
|
||||
: {};
|
||||
const builders = raw.builders ?? {};
|
||||
const composeFile = raw.composeFile?.trim();
|
||||
const registry = (raw.registry?.trim() ?? DEFAULT_REGISTRY).replace(
|
||||
/\/+$/,
|
||||
@@ -165,11 +138,6 @@ export async function loadConfig(
|
||||
: resolve(cwd, composeFile)
|
||||
: undefined,
|
||||
registry,
|
||||
builders: {
|
||||
amd64: builders.amd64?.trim() ?? DEFAULT_BUILDERS.amd64,
|
||||
arm64: builders.arm64?.trim() ?? DEFAULT_BUILDERS.arm64,
|
||||
remoteRoot: builders.remoteRoot?.trim() ?? DEFAULT_BUILDERS.remoteRoot,
|
||||
},
|
||||
rolloutTimeoutMs: raw.rolloutTimeoutMs ?? DEFAULT_ROLLOUT_TIMEOUT_MS,
|
||||
configFile: exists ? configFile : undefined,
|
||||
compose: raw.compose,
|
||||
|
||||
Reference in New Issue
Block a user