fix: isolate d601 k3s artifact docker config
This commit is contained in:
@@ -1965,9 +1965,22 @@ function d601K3sArtifactDeployScript(options: ArtifactRegistryOptions, spec: Art
|
|||||||
`health_path=${shellQuote(k3s.healthPath)}`,
|
`health_path=${shellQuote(k3s.healthPath)}`,
|
||||||
`apply_selector=${shellQuote(k3s.applySelector ?? "")}`,
|
`apply_selector=${shellQuote(k3s.applySelector ?? "")}`,
|
||||||
`pod_selector=${shellQuote(k3s.podLabelSelector ?? `app.kubernetes.io/name=${k3s.deploymentName}`)}`,
|
`pod_selector=${shellQuote(k3s.podLabelSelector ?? `app.kubernetes.io/name=${k3s.deploymentName}`)}`,
|
||||||
|
"archive=",
|
||||||
|
"manifest=",
|
||||||
|
"deployment_specs=",
|
||||||
"health_tmp=",
|
"health_tmp=",
|
||||||
`manifest_repo_path=${shellQuote(k3s.manifestRepoPath)}`,
|
`manifest_repo_path=${shellQuote(k3s.manifestRepoPath)}`,
|
||||||
`manifest_b64=${shellQuote(manifestBase64)}`,
|
`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",
|
"export KUBECONFIG=/etc/rancher/k3s/k3s.yaml",
|
||||||
"command -v docker >/dev/null",
|
"command -v docker >/dev/null",
|
||||||
"command -v kubectl >/dev/null",
|
"command -v kubectl >/dev/null",
|
||||||
@@ -1985,7 +1998,6 @@ function d601K3sArtifactDeployScript(options: ArtifactRegistryOptions, spec: Art
|
|||||||
"docker tag \"$registry_image\" \"$commit_image\"",
|
"docker tag \"$registry_image\" \"$commit_image\"",
|
||||||
"archive=$(mktemp /tmp/unidesk-artifact-k3s-image.XXXXXX.tar)",
|
"archive=$(mktemp /tmp/unidesk-artifact-k3s-image.XXXXXX.tar)",
|
||||||
"manifest=$(mktemp /tmp/unidesk-artifact-k3s-manifest.XXXXXX.yaml)",
|
"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\"",
|
"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 import \"$archive\" >/dev/null",
|
||||||
"root_exec ctr --address /run/k3s/containerd/containerd.sock -n k8s.io images ls | grep -F \"$stable_image\" >/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\"",
|
"printf '%s' \"$manifest_b64\" | base64 -d > \"$manifest\"",
|
||||||
"deployment_specs=$(mktemp /tmp/unidesk-artifact-k3s-deployments.XXXXXX.json)",
|
"deployment_specs=$(mktemp /tmp/unidesk-artifact-k3s-deployments.XXXXXX.json)",
|
||||||
"printf '%s' \"$deployment_specs_b64\" | base64 -d > \"$deployment_specs\"",
|
"printf '%s' \"$deployment_specs_b64\" | base64 -d > \"$deployment_specs\"",
|
||||||
"trap 'rm -f \"$archive\" \"$manifest\" \"$deployment_specs\" \"$health_tmp\"' EXIT",
|
|
||||||
"python3 - \"$deployment_specs\" \"$manifest\" <<'PY'",
|
"python3 - \"$deployment_specs\" \"$manifest\" <<'PY'",
|
||||||
"import json, sys",
|
"import json, sys",
|
||||||
"specs = json.load(open(sys.argv[1], encoding='utf-8'))",
|
"specs = json.load(open(sys.argv[1], encoding='utf-8'))",
|
||||||
|
|||||||
Reference in New Issue
Block a user