部署(HEL-235): 修复构建后回读校验的远端模板引号
Co-authored-by: multica-agent <github@multica.ai>
This commit is contained in:
@@ -74,15 +74,14 @@ git archive --format=tar "$FULL_SHA" \
|
||||
-
|
||||
|
||||
echo "==> 回读校验镜像内记录的提交号"
|
||||
GOT="$(ssh -o BatchMode=yes "$HOST" docker image inspect "${REPO_NAME}:${TAG}" \
|
||||
--format '{{index .Config.Labels "org.opencontainers.image.revision"}}')"
|
||||
GOT="$(ssh -o BatchMode=yes "$HOST" "docker image inspect ${REPO_NAME}:${TAG} --format '{{index .Config.Labels \"org.opencontainers.image.revision\"}}'" 2>/dev/null || true)"
|
||||
if [ "$GOT" != "$FULL_SHA" ]; then
|
||||
echo "校验失败:镜像 revision=${GOT},期望 ${FULL_SHA}。删除不可信镜像,中止。" >&2
|
||||
echo "校验失败:镜像 revision='${GOT:-<空>}',期望 ${FULL_SHA}。删除不可信镜像,中止。" >&2
|
||||
ssh -o BatchMode=yes "$HOST" docker rmi "${REPO_NAME}:${TAG}" >/dev/null 2>&1 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
IMAGE_ID="$(ssh -o BatchMode=yes "$HOST" docker image inspect "${REPO_NAME}:${TAG}" --format '{{.Id}}')"
|
||||
IMAGE_ID="$(ssh -o BatchMode=yes "$HOST" "docker image inspect ${REPO_NAME}:${TAG} --format '{{.Id}}'")"
|
||||
SHORT_ID="${IMAGE_ID##*:}"
|
||||
|
||||
ssh -o BatchMode=yes "$HOST" \
|
||||
|
||||
Reference in New Issue
Block a user