【发布时间】:2023-02-18 12:56:47
【问题描述】:
我有一个 GitHub 操作步骤,如下所示:
- if: ${{ steps.cache-images.outputs.cache-hit == 'true' }}
name: Load saved docker images
run: |
if [[ -f docker-images-backup/apisix-images.tar ]]; then
[[ ${{ steps.test_env.outputs.type }} != first ]] && sudo ./ci/init-${{ steps.test_env.outputs.type }}-test-service.sh before
docker load --input docker-images-backup/apisix-images.tar
make ci-env-up project_compose_ci=ci/pod/docker-compose.${{ steps.test_env.outputs.type }}.yml
echo "loaded docker images"
echo test_type:
[[ ${{ steps.test_env.outputs.type }} != first ]] && sudo ./ci/init-${{ steps.test_env.outputs.type }}-test-service.sh after && echo "executed"
fi
echo "exited if"
如果我删除为调试相同错误而添加的最后一条 echo 语句,它会始终失败(退出代码为 1)。
我已经尝试使用此脚本中变量值的不同组合在本地运行脚本,但它工作得很好。
我研究了一些关于在删除/添加打印语句时发生的 c 编程中的段错误。我不认为这是一个类似的案例,但我想知道 shell 脚本是否有类似的危险。
【问题讨论】:
标签: bash shell github-actions