fix: 修复构建脚本末尾grep导致set -e失败 #304
Reference in New Issue
Block a user
Delete Branch "fix/build-script-grep-set-e"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
问题
Build & Push Staging构建实际成功(镜像都推上去了),但脚本最后一行
docker images | grep "xiaoxia-saas.*:$VERSION"导致整个Job失败。根因:
set -e+grep经典陷阱:grep无匹配时返回exit 1docker images输出中REPOSITORY和TAG是两列(中间空格,没有冒号),xiaoxia-saas.*:$VERSION永远匹配不到修复
改为两段式grep +
|| true安全网,只做展示用,不影响构建结果。