fix: update image tag default to 'latest' and improve error messages in deployment script

This commit is contained in:
2026-05-02 01:05:46 +08:00
parent 501763c0d5
commit b1032d3190
+8 -5
View File
@@ -112,7 +112,7 @@ name: Deploy NAS K3s
- "true" - "true"
- "false" - "false"
image_tag: image_tag:
description: "Docker image tag. Defaults to the pushed commit SHA first 8 chars." description: "Docker image tag. Defaults to 'latest' (deploy whatever CI most recently published)."
required: false required: false
default: "" default: ""
keep_releases: keep_releases:
@@ -446,7 +446,7 @@ jobs:
image_tag="${REQUESTED_IMAGE_TAG}" image_tag="${REQUESTED_IMAGE_TAG}"
if [ -z "${image_tag}" ]; then if [ -z "${image_tag}" ]; then
image_tag="$(git rev-parse --short=8 HEAD)" image_tag="latest"
fi fi
case "${image_tag}" in case "${image_tag}" in
@@ -494,8 +494,8 @@ jobs:
fi fi
if ! bash deploy/scripts/gitea-registry-images.sh verify; then if ! bash deploy/scripts/gitea-registry-images.sh verify; then
echo "::error::Missing image(s) for commit ${IMAGE_TAG}. CI must publish images before CD." echo "::error::Missing image(s) at tag '${IMAGE_TAG}' for: ${IMAGE_LIST}."
echo "::error::Frontend images come from Frontend CI; backend/migrate images come from Backend CI." echo "::error::Run the matching CI workflow (Frontend CI / Backend CI) to publish images first."
exit 1 exit 1
fi fi
@@ -640,9 +640,12 @@ jobs:
fi fi
} }
# k3s installs kubeconfig at /etc/rancher/k3s/k3s.yaml with mode 0600
# (root only), so any kubectl path must go through sudo unless the
# current user is already root.
kubectl_cmd() { kubectl_cmd() {
if command -v kubectl >/dev/null 2>&1; then if command -v kubectl >/dev/null 2>&1; then
kubectl "$@" sudo_cmd kubectl "$@"
elif command -v k3s >/dev/null 2>&1; then elif command -v k3s >/dev/null 2>&1; then
sudo_cmd k3s kubectl "$@" sudo_cmd k3s kubectl "$@"
else else