fix: isolate d601 k3s artifact docker config

This commit is contained in:
Codex
2026-05-20 04:02:45 +00:00
parent 4bb33d0d52
commit 2dfc3575ab
+13 -2
View File
@@ -1965,9 +1965,22 @@ function d601K3sArtifactDeployScript(options: ArtifactRegistryOptions, spec: Art
`health_path=${shellQuote(k3s.healthPath)}`,
`apply_selector=${shellQuote(k3s.applySelector ?? "")}`,
`pod_selector=${shellQuote(k3s.podLabelSelector ?? `app.kubernetes.io/name=${k3s.deploymentName}`)}`,
"archive=",
"manifest=",
"deployment_specs=",
"health_tmp=",
`manifest_repo_path=${shellQuote(k3s.manifestRepoPath)}`,
`manifest_b64=${shellQuote(manifestBase64)}`,
"export DOCKER_CONFIG=$(mktemp -d /tmp/unidesk-artifact-docker-config.XXXXXX)",
"printf '{}\\n' > \"$DOCKER_CONFIG/config.json\"",
"cleanup_artifact_cd() {",
" [ -n \"${archive:-}\" ] && rm -f \"$archive\"",
" [ -n \"${manifest:-}\" ] && rm -f \"$manifest\"",
" [ -n \"${deployment_specs:-}\" ] && rm -f \"$deployment_specs\"",
" [ -n \"${health_tmp:-}\" ] && rm -f \"$health_tmp\"",
" [ -n \"${DOCKER_CONFIG:-}\" ] && rm -rf \"$DOCKER_CONFIG\"",
"}",
"trap cleanup_artifact_cd EXIT",
"export KUBECONFIG=/etc/rancher/k3s/k3s.yaml",
"command -v docker >/dev/null",
"command -v kubectl >/dev/null",
@@ -1985,7 +1998,6 @@ function d601K3sArtifactDeployScript(options: ArtifactRegistryOptions, spec: Art
"docker tag \"$registry_image\" \"$commit_image\"",
"archive=$(mktemp /tmp/unidesk-artifact-k3s-image.XXXXXX.tar)",
"manifest=$(mktemp /tmp/unidesk-artifact-k3s-manifest.XXXXXX.yaml)",
"trap 'rm -f \"$archive\" \"$manifest\" \"$health_tmp\"' EXIT",
"docker save \"$commit_image\" \"$stable_image\" -o \"$archive\"",
"root_exec ctr --address /run/k3s/containerd/containerd.sock -n k8s.io images import \"$archive\" >/dev/null",
"root_exec ctr --address /run/k3s/containerd/containerd.sock -n k8s.io images ls | grep -F \"$stable_image\" >/dev/null",
@@ -1993,7 +2005,6 @@ function d601K3sArtifactDeployScript(options: ArtifactRegistryOptions, spec: Art
"printf '%s' \"$manifest_b64\" | base64 -d > \"$manifest\"",
"deployment_specs=$(mktemp /tmp/unidesk-artifact-k3s-deployments.XXXXXX.json)",
"printf '%s' \"$deployment_specs_b64\" | base64 -d > \"$deployment_specs\"",
"trap 'rm -f \"$archive\" \"$manifest\" \"$deployment_specs\" \"$health_tmp\"' EXIT",
"python3 - \"$deployment_specs\" \"$manifest\" <<'PY'",
"import json, sys",
"specs = json.load(open(sys.argv[1], encoding='utf-8'))",