From e20739a0f24661c455fc971a785ad1fb5808cf48 Mon Sep 17 00:00:00 2001 From: Codex Date: Fri, 3 Jul 2026 15:25:45 +0000 Subject: [PATCH] fix: share native cicd script loader --- scripts/src/cicd-native-bundle.ts | 8 ++------ scripts/src/cicd.ts | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/scripts/src/cicd-native-bundle.ts b/scripts/src/cicd-native-bundle.ts index 3c34ec8d..f9e61d4d 100644 --- a/scripts/src/cicd-native-bundle.ts +++ b/scripts/src/cicd-native-bundle.ts @@ -35,7 +35,7 @@ export function readNativeObjectBundle(registry: BranchFollowerRegistry, followe "tmpdir=$(mktemp -d)", "cleanup() { rm -rf \"$tmpdir\"; }", "trap cleanup EXIT INT TERM", - nativeBundleScriptLoadShell(), + nativeCicdScriptLoadShell(NATIVE_BUNDLE_SCRIPT_NAMES), `REPO_PATH=${shQuote(source.repoPath)}`, `SOURCE_BRANCH=${shQuote(follower.source.branch)}`, `REPOSITORY=${shQuote(follower.source.repository)}`, @@ -80,11 +80,7 @@ export function readNativeObjectBundle(registry: BranchFollowerRegistry, followe }; } -function nativeBundleScriptLoadShell(): string { - return nativeScriptLoadShell(NATIVE_BUNDLE_SCRIPT_NAMES); -} - -function nativeScriptLoadShell(names: readonly string[]): string { +export function nativeCicdScriptLoadShell(names: readonly string[]): string { return names.map((name) => { const encoded = Buffer.from(readFileSync(rootPath("scripts/native/cicd", name), "utf8"), "utf8").toString("base64"); return [ diff --git a/scripts/src/cicd.ts b/scripts/src/cicd.ts index 59b9097f..0cecd318 100644 --- a/scripts/src/cicd.ts +++ b/scripts/src/cicd.ts @@ -22,7 +22,7 @@ import { transPath } from "./hwlab-node/runtime-common"; import { configRefGraph, resolveConfigRefString } from "./ops/config-refs"; import { renderControllerManifests, renderControllerReconcileJob, waitForJobShell } from "./cicd-controller-render"; import { runNativeHwlabControlPlaneRefresh } from "./cicd-hwlab-refresh"; -import { readNativeObjectBundle } from "./cicd-native-bundle"; +import { nativeCicdScriptLoadShell, readNativeObjectBundle } from "./cicd-native-bundle"; import { runNativeK8sJob, runNativeTektonPipelineRun } from "./cicd-native"; import type { AdapterSummary, BranchFollowerPhase, BranchFollowerRegistry, ControllerSpec, FollowerSpec, FollowerState, K8sFollowerStateRead, K8sStateRead, NativeCloseoutWaitResult, NativeK8sJobResult, NativeStatusSpec, NativeWorkloadSpec, OutputMode, ParsedOptions, StageTiming, TriggerResult } from "./cicd-types"; import { @@ -1860,7 +1860,7 @@ function kubeConfigMapFollowerState(registry: BranchFollowerRegistry, options: P "tmpdir=$(mktemp -d)", "cleanup() { rm -rf \"$tmpdir\"; }", "trap cleanup EXIT INT TERM", - nativeScriptLoadShell(["read-state-summary.mjs"]), + nativeCicdScriptLoadShell(["read-state-summary.mjs"]), `NAMESPACE=${shQuote(registry.controller.namespace)}`, `CONFIGMAP=${shQuote(registry.controller.stateConfigMapName)}`, `FOLLOWERS_JSON=${shQuote(JSON.stringify(registry.followers.map((follower) => follower.id)))}`,