【发布时间】:2021-02-20 00:13:45
【问题描述】:
以下命令在终端上完美运行,但相同的命令在 GitLab CI 中失败。
echo Hello >> foo.txt; cat foo.txt | grep "test"; [[ $? -eq 0 ]] && echo fail || echo success
返回是success
但 GitLab CI 中的命令相同
$ echo Hello >> foo.txt; cat foo.txt | grep "test"; [[ $? -eq 0 ]] && echo fail || echo success
Cleaning up file based variables
ERROR: Job failed: command terminated with exit code 1
只是失败了。我不知道为什么。
echo $SHELL 在两者中都返回 /bin/bash。
【问题讨论】:
-
你在 GitLab 工作中使用的是哪个 shell?
-
@GlenThomas
/bin/bash
标签: bash shell gitlab-ci gitlab-ci-runner