通过jenkins用户运行的脚本被杀死

时间:2019-04-21 06:37:40

标签: bash shell jenkins

在我们的jenkins构建配置中,作为构建过程的最后一步,我们具有以下shell命令(Execute shell)。

echo "$USER"
echo "Script executed from: ${PWD}"
git submodule update --init --recursive
if [ -f composer.json ]; then
    /usr/local/bin/composer install
fi
sed -i 's/phpunit --bootstrap/\/usr\/local\/bin\/phpunit \-\-bootstrap/g' runtest
./runtest --config unittest/configure.conf --coverage /var/lib/jenkins/workspace/coverage/

在我们的硬盘驱动器装满并且詹金斯停止构建之前,一切都可以正常工作。在我们清理了硬盘并尝试通过jenkins重新构建之后,最后一步(Execute shell)未能构建,并出现以下错误:

[project] $ /bin/sh -xe /tmp/hudson815776538860444797.sh
+ echo jenkins
jenkins
+ echo 'Script executed from: /var/lib/jenkins/workspace/project'
Script executed from: /var/lib/jenkins/workspace/project
+ git submodule update --init --recursive
error: git-submodule died of signal 9
Build step 'Execute shell' marked build as failure

我们尝试以root用户身份运行shell命令,并且一切正常。但是,一旦我们以詹金斯用户身份运行它,该过程将在几秒钟内被杀死。

[root@localhost project]# su -c "/bin/bash -x /tmp/hudson5288327457846724302.sh" -s /bin/sh jenkins
+ echo jenkins
jenkins
+ echo 'Script executed from: /var/lib/jenkins/workspace/project'
Script executed from: /var/lib/jenkins/workspace/project
+ '[' -f composer.json ']'
+ /usr/local/bin/composer install
Killed

我检查了系统日志/var/log/messages,但是没有发现任何线索。是什么原因导致该问题,以及我们如何解决该问题?

0 个答案:

没有答案