fix: check all source workspace host deps
This commit is contained in:
@@ -363,7 +363,7 @@ function sourceWorkspaceStatusFromFields(fields: Record<string, string>, exitCod
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sourceWorkspaceHostDependenciesStatusScript(hostDependencies: HwlabRuntimeSourceWorkspaceHostDependenciesSpec): string {
|
function sourceWorkspaceHostDependenciesStatusScript(hostDependencies: HwlabRuntimeSourceWorkspaceHostDependenciesSpec): string {
|
||||||
const checkCommands = hostDependencies.checkCommands.join("\n");
|
const checkCommands = shellLinesText(hostDependencies.checkCommands);
|
||||||
return [
|
return [
|
||||||
"set +e",
|
"set +e",
|
||||||
`state_dir=${shellQuote(hostDependencies.stateDir)}`,
|
`state_dir=${shellQuote(hostDependencies.stateDir)}`,
|
||||||
@@ -403,7 +403,7 @@ function sourceWorkspaceHostDependenciesSubmitScript(
|
|||||||
sourceWorkspace: HwlabRuntimeSourceWorkspaceSpec,
|
sourceWorkspace: HwlabRuntimeSourceWorkspaceSpec,
|
||||||
hostDependencies: HwlabRuntimeSourceWorkspaceHostDependenciesSpec,
|
hostDependencies: HwlabRuntimeSourceWorkspaceHostDependenciesSpec,
|
||||||
): string {
|
): string {
|
||||||
const checkCommands = hostDependencies.checkCommands.join("\n");
|
const checkCommands = shellLinesText(hostDependencies.checkCommands);
|
||||||
const noProxy = spec.networkProfile.proxy.noProxy.join(",");
|
const noProxy = spec.networkProfile.proxy.noProxy.join(",");
|
||||||
const commandSha = createHash("sha256").update(hostDependencies.install.command).digest("hex");
|
const commandSha = createHash("sha256").update(hostDependencies.install.command).digest("hex");
|
||||||
const requiredCommandsSha = createHash("sha256").update(sourceWorkspace.requiredCommands.join("\n")).digest("hex");
|
const requiredCommandsSha = createHash("sha256").update(sourceWorkspace.requiredCommands.join("\n")).digest("hex");
|
||||||
@@ -473,9 +473,9 @@ function sourceWorkspaceHostDependenciesSubmitScript(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function sourceWorkspaceStatusScript(spec: HwlabRuntimeLaneSpec, sourceWorkspace: HwlabRuntimeSourceWorkspaceSpec): string {
|
function sourceWorkspaceStatusScript(spec: HwlabRuntimeLaneSpec, sourceWorkspace: HwlabRuntimeSourceWorkspaceSpec): string {
|
||||||
const requiredCommands = sourceWorkspace.requiredCommands.join("\n");
|
const requiredCommands = shellLinesText(sourceWorkspace.requiredCommands);
|
||||||
const requiredFiles = sourceWorkspace.requiredFiles.join("\n");
|
const requiredFiles = shellLinesText(sourceWorkspace.requiredFiles);
|
||||||
const remoteUrls = [spec.gitUrl, spec.gitReadUrl, spec.gitWriteUrl].join("\n");
|
const remoteUrls = shellLinesText([spec.gitUrl, spec.gitReadUrl, spec.gitWriteUrl]);
|
||||||
return [
|
return [
|
||||||
"set +e",
|
"set +e",
|
||||||
`workspace=${shellQuote(spec.workspace)}`,
|
`workspace=${shellQuote(spec.workspace)}`,
|
||||||
@@ -746,8 +746,8 @@ function sourceWorkspaceJobContainerScript(
|
|||||||
controlPlane: ReturnType<typeof hwlabNodeControlPlaneSourceWorkspaceBootstrap>,
|
controlPlane: ReturnType<typeof hwlabNodeControlPlaneSourceWorkspaceBootstrap>,
|
||||||
workspaceInContainer: string,
|
workspaceInContainer: string,
|
||||||
): string {
|
): string {
|
||||||
const requiredCommands = sourceWorkspace.requiredCommands.join("\n");
|
const requiredCommands = shellLinesText(sourceWorkspace.requiredCommands);
|
||||||
const requiredFiles = sourceWorkspace.requiredFiles.join("\n");
|
const requiredFiles = shellLinesText(sourceWorkspace.requiredFiles);
|
||||||
return [
|
return [
|
||||||
"set -eu",
|
"set -eu",
|
||||||
`workspace=${shellQuote(workspaceInContainer)}`,
|
`workspace=${shellQuote(workspaceInContainer)}`,
|
||||||
@@ -813,6 +813,10 @@ function sourceWorkspaceJobContainerScript(
|
|||||||
].join("\n");
|
].join("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function shellLinesText(values: readonly string[]): string {
|
||||||
|
return values.length === 0 ? "" : `${values.join("\n")}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
function sourceWorkspaceJobName(spec: HwlabRuntimeLaneSpec): string {
|
function sourceWorkspaceJobName(spec: HwlabRuntimeLaneSpec): string {
|
||||||
return `hwlab-${spec.nodeId.toLowerCase()}-${spec.lane}-source-workspace`.slice(0, 63).replace(/-$/u, "");
|
return `hwlab-${spec.nodeId.toLowerCase()}-${spec.lane}-source-workspace`.slice(0, 63).replace(/-$/u, "");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user