refactor: variableize yaml lane node naming

This commit is contained in:
Codex
2026-07-09 10:46:55 +02:00
parent e9457ace4a
commit 37a6b70793
123 changed files with 1572 additions and 1571 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { ArtifactSummary, ArtifactSummaryContext } from "./types";
+1 -1
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiCleanupFailedPodsOptions, CiCleanupRunsOptions, CiTarget } from "./types";
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiDevE2EOptions, DeployDevManifestSummary, DispatchResult } from "./types";
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { ArtifactSummary, ArtifactSummaryContext, CiPublishUserServiceArtifactOptions } from "./types";
+1 -1
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import { cleanupFailedPods, cleanupRuns, status } from "./cleanup";
+1 -1
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import { g14CiPipelineManifest, tektonPipelineReleaseUrl, tektonPipelineVersion, tektonTriggersInterceptorsUrl, tektonTriggersReleaseUrl, tektonTriggersVersion } from "./types";
+1 -1
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiInstallOptions } from "./types";
+1 -1
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiLogsOptions, CiTarget } from "./types";
+9 -9
View File
@@ -18,11 +18,11 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiCleanupFailedPodsOptions, CiCleanupRunsOptions, CiLogsOptions, CiPublishTransport, CiTarget } from "./types";
import { ciTarget, d601ProviderId, providerIdOption } from "./types";
import { ciTarget, defaultCiProviderId, providerIdOption } from "./types";
export function stringOption(args: string[], name: string): string | null {
const index = args.indexOf(name);
@@ -171,8 +171,8 @@ export function shellQuote(value: string): string {
}
export function ciTargetGuardShellLines(target: CiTarget, options: { passOutput?: "stdout" | "stderr" | "quiet" } = {}): string[] {
if (target.providerId === d601ProviderId) {
return d601K3sGuardShellLines(target.kubeconfig, options);
if (target.providerId === defaultCiProviderId) {
return k3sGuardShellLines(target.kubeconfig, options);
}
const passOutput = options.passOutput ?? "stdout";
const labelSelector = target.requiredNodeLabel === undefined ? "" : `${target.requiredNodeLabel.key}=${target.requiredNodeLabel.value}`;
@@ -320,11 +320,11 @@ export function userServicePublishBoundaryBlock(
): Record<string, unknown> | null {
const configService = config.microservices.find((item) => item.id === serviceId);
if (configService === undefined) return null;
const isD601K3sService = configService.providerId === d601ProviderId
&& configService.development.providerId === d601ProviderId
const isTargetK3sService = configService.providerId === defaultCiProviderId
&& configService.development.providerId === defaultCiProviderId
&& configService.deployment.mode === "k3sctl-managed";
const isD601DirectService = configService.providerId === d601ProviderId
&& configService.development.providerId === d601ProviderId
const isTargetDirectService = configService.providerId === defaultCiProviderId
&& configService.development.providerId === defaultCiProviderId
&& configService.deployment.mode === "unidesk-direct";
const isMainServerDirectService = configService.providerId === "main-server"
&& configService.development.providerId === "main-server"
@@ -332,7 +332,7 @@ export function userServicePublishBoundaryBlock(
const isMainServerInternalSidecar = configService.providerId === "main-server"
&& configService.development.providerId === "main-server"
&& configService.deployment.mode === "internal-sidecar";
if (isD601K3sService || isD601DirectService || isMainServerDirectService || isMainServerInternalSidecar) return null;
if (isTargetK3sService || isTargetDirectService || isMainServerDirectService || isMainServerInternalSidecar) return null;
return {
ok: false,
status: "blocked",
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { DispatchResult, PipelineRunCondition } from "./types";
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiOptions, CiPublishBackendCoreOptions, CiPublishUserServiceArtifactOptions } from "./types";
+3 -3
View File
@@ -18,12 +18,12 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { DispatchResult, PublishPreflight, PublishPreflightChannelProbe, PublishPreflightControlChannel, PublishPreflightControlChannelProbe, PublishPreflightDetailedChannel, PublishPreflightFailureClassification, PublishPreflightTransport } from "./types";
import { status } from "./cleanup";
import { d601ProviderId } from "./types";
import { defaultCiProviderId } from "./types";
export function chunks(value: string, size: number): string[] {
const result: string[] = [];
@@ -170,7 +170,7 @@ export function publishPreflightControlPlane(
fallbackRunnerPath: "main-server-local-docker",
remoteCommandShape,
providerTunnel: {
providerId: d601ProviderId,
providerId: defaultCiProviderId,
command: "host.ssh",
requiredFor: ["provider-host-ssh", "artifact-registry"],
},
+5 -5
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { ArtifactSummary, ArtifactSummaryContext, CiPublishBackendCoreOptions, CiPublishUserServiceArtifactOptions, PublishPreflight, PublishPreflightChannelProbe, PublishPreflightTransport } from "./types";
@@ -29,7 +29,7 @@ import { shellQuote } from "./options";
import { asRecord, asString, backendCoreUnavailable, channelProbe, classifyPublishPreflightFailure, coreBody, publishPreflightControlPlane, recommendedPublishPreflightAction, responseOk, summarizePublishControlChannels } from "./preflight";
import { runRemoteKubectlRaw } from "./remote";
import { backendCoreCiRunnerReady, backendCoreRemoteCommandShape, ciRunnerPreflightScript, commandResultFromDispatch, dispatchPreflightFailure } from "./runner-preflight";
import { ciTarget, d601Kubeconfig, d601ProviderId } from "./types";
import { ciTarget, defaultCiKubeconfig, defaultCiProviderId } from "./types";
export function assertArtifactSummaryComplete(artifact: ArtifactSummary, pipelineRun: string): void {
const missing = missingArtifactSummaryFields(artifact);
@@ -44,7 +44,7 @@ export async function publishUserServicePreflight(
plannedArtifact: ArtifactSummary,
transport: PublishPreflightTransport,
): Promise<PublishPreflight> {
const providerId = d601ProviderId;
const providerId = defaultCiProviderId;
const channels: PublishPreflightChannelProbe[] = [];
const overview = await transport.coreFetch("/api/overview", { maxResponseBytes: 500_000 });
const overviewBody = coreBody(overview);
@@ -66,7 +66,7 @@ export async function publishUserServicePreflight(
const probeScript = [
"set -euo pipefail",
...d601K3sGuardShellLines(d601Kubeconfig),
...k3sGuardShellLines(defaultCiKubeconfig),
"printf 'provider_host_ssh=ok\\n'",
"command -v bash >/dev/null",
"command -v docker >/dev/null",
@@ -144,7 +144,7 @@ export async function publishBackendCorePreflight(
plannedArtifact: ArtifactSummary,
transport: PublishPreflightTransport,
): Promise<PublishPreflight> {
const providerId = d601ProviderId;
const providerId = defaultCiProviderId;
const channels: PublishPreflightChannelProbe[] = [];
const overview = await transport.coreFetch("/api/overview", { maxResponseBytes: 500_000 });
const overviewBody = coreBody(overview);
+8 -8
View File
@@ -19,7 +19,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { ArtifactSummaryContext, CiOptions, CiPublishBackendCoreOptions, CiPublishUserServiceArtifactOptions, PublishPreflightTransport } from "./types";
@@ -33,7 +33,7 @@ import { assertArtifactSummaryComplete, publishBackendCorePreflight, publishUser
import { localPublishPreflightTransport } from "./remote";
import { backendCoreArtifactRequirements, backendCoreDevApplyPath } from "./runner-preflight";
import { prepareBackendCoreArtifactSource, prepareClaudeqqArtifactSource, prepareUserServiceArtifactSource } from "./source-prepare";
import { d601ProviderId, providerGatewayWsEgressProxyUrl } from "./types";
import { defaultCiProviderId, providerGatewayWsEgressProxyUrl } from "./types";
export async function run(options: CiOptions): Promise<Record<string, unknown>> {
const name = await remoteCreatePipelineRun(pipelineRunManifest(options), options.target);
@@ -152,7 +152,7 @@ export async function publishUserServiceArtifact(config: UniDeskConfig, options:
source: {
ok: preflight.ok,
mode: "planned-only",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl: plannedRepoFetchUrl,
repoProbeUrl: repoConnectivityProbeUrl(plannedRepoFetchUrl),
@@ -286,7 +286,7 @@ export async function runCiPublishUserServiceDryRunPreflight(
source: {
ok: preflight.ok,
mode: "planned-only",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl: plannedRepoFetchUrl,
repoProbeUrl: repoConnectivityProbeUrl(plannedRepoFetchUrl),
@@ -357,9 +357,9 @@ export async function runCiPublishBackendCoreDryRunPreflight(
targetCommit: options.commit,
sourceRepo: options.repoUrl,
serviceId: "backend-core",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
ciRunner: {
providerId: d601ProviderId,
providerId: defaultCiProviderId,
environment: "D601",
namespace: "unidesk-ci",
pipeline: "unidesk-backend-core-artifact-publish",
@@ -386,7 +386,7 @@ export async function runCiPublishBackendCoreDryRunPreflight(
source: {
ok: preflight.ok,
mode: "planned-only",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl: plannedRepoFetchUrl,
repoProbeUrl: repoConnectivityProbeUrl(plannedRepoFetchUrl),
@@ -403,7 +403,7 @@ export async function runCiPublishBackendCoreDryRunPreflight(
identityRequired: repoNeedsGithubSshIdentity(plannedRepoFetchUrl),
},
d601Ci: {
providerId: d601ProviderId,
providerId: defaultCiProviderId,
namespace: "unidesk-ci",
pipeline: "unidesk-backend-core-artifact-publish",
wouldBuildOnD601: true,
+1 -1
View File
@@ -18,7 +18,7 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { DispatchResult, PublishPreflightTransport } from "./types";
+3 -3
View File
@@ -18,19 +18,19 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { ArtifactSummary, CiPublishBackendCoreOptions, DispatchResult } from "./types";
import { shellQuote } from "./options";
import { backendCoreUnavailable } from "./preflight";
import { dispatchSsh } from "./remote";
import { d601Kubeconfig } from "./types";
import { defaultCiKubeconfig } from "./types";
export function ciRunnerPreflightScript(sourceHostPath: string): string {
return [
"set -eu",
...d601K3sGuardShellLines(d601Kubeconfig),
...k3sGuardShellLines(defaultCiKubeconfig),
"printf 'provider_host_ssh=ok\\n'",
"printf 'kubectl='",
"command -v kubectl >/dev/null && printf 'ok\\n' || { printf 'missing\\n'; exit 127; }",
+7 -7
View File
@@ -18,20 +18,20 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import type { CiPublishBackendCoreOptions, CiPublishUserServiceArtifactOptions } from "./types";
import { repoConnectivityProbeUrl, repoNeedsGithubSshIdentity, repoSshUrl, requireRepoRelativePath, safePathToken, shellQuote } from "./options";
import { runRemoteBackground } from "./remote";
import { d601ProviderId, providerGatewayWsEgressProxyUrl } from "./types";
import { defaultCiProviderId, providerGatewayWsEgressProxyUrl } from "./types";
export async function prepareBackendCoreArtifactSource(config: UniDeskConfig, options: CiPublishBackendCoreOptions): Promise<Record<string, unknown>> {
const sourceRoot = "/home/ubuntu/.unidesk/ci/backend-core-artifacts";
const sourceHostPath = options.sourceHostPath;
const repoCache = "/home/ubuntu/.unidesk/ci/git/unidesk.git";
const repoFetchUrl = repoSshUrl(options.repoUrl);
const sshIdentity = repoNeedsGithubSshIdentity(repoFetchUrl) ? await ensureGithubSshIdentityForProvider(config, d601ProviderId) : null;
const sshIdentity = repoNeedsGithubSshIdentity(repoFetchUrl) ? await ensureGithubSshIdentityForProvider(config, defaultCiProviderId) : null;
if (sshIdentity !== null && !sshIdentity.ok) throw new Error(sshIdentity.detail);
const proxyPython = gitSshHttpConnectProxySource();
const dockerfile = requireRepoRelativePath(options.dockerfile, "CI.json.artifacts.backend-core.source.dockerfile");
@@ -82,7 +82,7 @@ export async function prepareBackendCoreArtifactSource(config: UniDeskConfig, op
return {
ok: true,
mode: repoNeedsGithubSshIdentity(repoFetchUrl) ? "d601-host-git-ssh-export" : "d601-host-git-https-export",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl,
commit: options.commit,
@@ -102,7 +102,7 @@ export async function prepareUserServiceArtifactSource(config: UniDeskConfig, op
const repoCache = `/home/ubuntu/.unidesk/ci/git/${safePathToken(options.serviceId)}.git`;
const repoFetchUrl = repoSshUrl(options.repoUrl);
const repoProbeUrl = repoConnectivityProbeUrl(repoFetchUrl);
const sshIdentity = repoNeedsGithubSshIdentity(repoFetchUrl) ? await ensureGithubSshIdentityForProvider(config, d601ProviderId) : null;
const sshIdentity = repoNeedsGithubSshIdentity(repoFetchUrl) ? await ensureGithubSshIdentityForProvider(config, defaultCiProviderId) : null;
if (sshIdentity !== null && !sshIdentity.ok) throw new Error(sshIdentity.detail);
const proxyPython = gitSshHttpConnectProxySource();
const script = [
@@ -156,7 +156,7 @@ export async function prepareUserServiceArtifactSource(config: UniDeskConfig, op
return {
ok: true,
mode: repoNeedsGithubSshIdentity(repoFetchUrl) ? "d601-host-git-ssh-export" : "d601-host-git-https-export",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl,
repoProbeUrl,
@@ -246,7 +246,7 @@ export async function prepareClaudeqqArtifactSource(config: UniDeskConfig, optio
return {
ok: true,
mode: "d601-host-gitee-https-export-with-unidesk-overlay",
providerId: d601ProviderId,
providerId: defaultCiProviderId,
repoUrl: options.repoUrl,
repoFetchUrl,
commit: options.commit,
+5 -5
View File
@@ -19,19 +19,19 @@ import {
parseArtifactRegistryOptions,
type ArtifactRegistryReadonlyProbe,
} from "../artifact-registry";
import { d601K3sGuardShellLines, d601NativeKubeconfig } from "../d601-k3s-guard";
import { k3sGuardShellLines, defaultNativeKubeconfig } from "../k3s-target-guard";
import { runSshCommandCapture } from "../ssh";
import { cicdTargetSummary, resolveCicdTarget, type TargetConfigSource } from "../ops/targets";
import { status } from "./cleanup";
import { stringOption } from "./options";
const d601YamlTarget = resolveCicdTarget("D601");
const defaultCicdTarget = resolveCicdTarget(null);
const g14YamlTarget = resolveCicdTarget("G14");
export const d601ProviderId = d601YamlTarget.providerId;
export const defaultCiProviderId = defaultCicdTarget.providerId;
export const d601Kubeconfig = d601YamlTarget.kubeconfig;
export const defaultCiKubeconfig = defaultCicdTarget.kubeconfig;
export const tektonPipelineVersion = "v1.12.0";
@@ -51,7 +51,7 @@ export const codeQueueDirectDockerBaseImage = "unidesk-code-queue:d601";
export const providerDispatchCompletionLagMs = 45_000;
export const defaultCiPipelineManifest = d601YamlTarget.pipelineManifest;
export const defaultCiPipelineManifest = defaultCicdTarget.pipelineManifest;
export const g14CiPipelineManifest = g14YamlTarget.pipelineManifest;