我的 .gitlab-ci.yml 有以下内容
run python:
image: python:3.10
script:
- |
cd "src"
pip install -r ../requirements.txt
ls -l
起初我以为是图像python:3.10
指定的入口点。然而我在本地运行图像,我直接被扔进了Python REPL。它无法运行 cd
。
那么在脚本部分,使用的是哪个shell呢? sh、bash 还是 zsh?是否可以根据我的喜好指定一个 shell?
最佳答案
const BashDetectShellScript = `if [ -x /usr/local/bin/bash ]; then
exec /usr/local/bin/bash $@
elif [ -x /usr/bin/bash ]; then
exec /usr/bin/bash $@
elif [ -x /bin/bash ]; then
exec /bin/bash $@
elif [ -x /usr/local/bin/sh ]; then
exec /usr/local/bin/sh $@
elif [ -x /usr/bin/sh ]; then
exec /usr/bin/sh $@
elif [ -x /bin/sh ]; then
exec /bin/sh $@
elif [ -x /busybox/sh ]; then
exec /busybox/sh $@
else
echo shell not found
exit 1
fi
`
关于docker - gitlab CI 作业使用哪个 shell?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74917611/