fix: share native cicd script loader
This commit is contained in:
@@ -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 [
|
||||
|
||||
+2
-2
@@ -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)))}`,
|
||||
|
||||
Reference in New Issue
Block a user