fix: adapt claudeqq k3s deploy and notifications
This commit is contained in:
+27
-1
@@ -627,7 +627,7 @@ function prepareSourceScript(service: UniDeskMicroserviceConfig, desired: Deploy
|
||||
" tail -80 \"$source_log\" || true",
|
||||
" if [ -n \"$fallback_worktree\" ] && git -C \"$fallback_worktree\" rev-parse --is-inside-work-tree >/dev/null 2>&1 && git -C \"$fallback_worktree\" rev-parse --verify \"$commit^{commit}\" > /tmp/unidesk-deploy-resolved-commit 2>/dev/null; then",
|
||||
" resolved=$(cat /tmp/unidesk-deploy-resolved-commit)",
|
||||
" source_repo=\"$fallback_worktree\"",
|
||||
" source_repo=$(git -C \"$fallback_worktree\" rev-parse --show-toplevel)",
|
||||
" source_mode=\"provider-worktree\"",
|
||||
" printf 'target_source_fallback_worktree=%s\\n' \"$fallback_worktree\"",
|
||||
" else",
|
||||
@@ -647,6 +647,7 @@ function syncSourceScript(service: UniDeskMicroserviceConfig, exportDir: string)
|
||||
const workDir = sourceWorkDir(service);
|
||||
const buildContext = sourceBuildContext(service);
|
||||
const dockerfilePath = sourceDockerfilePath(service);
|
||||
const overlayCommands = service.id === "claudeqq" ? claudeqqDeployAssetOverlayCommands() : [];
|
||||
return [
|
||||
"set -euo pipefail",
|
||||
`export_dir=${shellQuote(exportDir)}`,
|
||||
@@ -664,11 +665,36 @@ function syncSourceScript(service: UniDeskMicroserviceConfig, exportDir: string)
|
||||
"\"$export_dir/\"",
|
||||
"\"$work_dir/\"",
|
||||
].join(" "),
|
||||
...overlayCommands,
|
||||
"test -f \"$build_context/$dockerfile_path\"",
|
||||
"printf 'synced deploy worktree to %s\\nbuild_context=%s\\n' \"$work_dir\" \"$build_context\"",
|
||||
].join("\n");
|
||||
}
|
||||
|
||||
function claudeqqDeployAssetOverlayCommands(): string[] {
|
||||
const assets = [
|
||||
{
|
||||
relativePath: "$build_context/$dockerfile_path",
|
||||
sourcePath: rootPath("src/components/microservices/claudeqq/Dockerfile"),
|
||||
label: "Dockerfile",
|
||||
},
|
||||
{
|
||||
relativePath: "$build_context/unidesk-adapter.cjs",
|
||||
sourcePath: rootPath("src/components/microservices/claudeqq/adapter.js"),
|
||||
label: "unidesk-adapter.cjs",
|
||||
},
|
||||
];
|
||||
return assets.flatMap((asset) => {
|
||||
if (!existsSync(asset.sourcePath)) throw new Error(`claudeqq deploy asset missing: ${asset.sourcePath}`);
|
||||
const encoded = Buffer.from(readFileSync(asset.sourcePath, "utf8"), "utf8").toString("base64");
|
||||
return [
|
||||
`mkdir -p "$(dirname "${asset.relativePath}")"`,
|
||||
`printf %s ${shellQuote(encoded)} | base64 -d > "${asset.relativePath}"`,
|
||||
`printf 'synced_claudeqq_deploy_asset=%s\\n' ${shellQuote(asset.label)}`,
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
function syncK8sControlManifestsScript(service: UniDeskMicroserviceConfig): string {
|
||||
if (service.deployment.mode !== "k3sctl-managed" || isUnideskRepo(service.repository.url)) return "";
|
||||
const manifests = [service.repository.composeFile, k8sManifestPath(service)];
|
||||
|
||||
Reference in New Issue
Block a user