我使用gitlab,gitab-ci,我对Continuous Integration来说很新.我尝试在代码推送上测试和部署bash脚本.
这就是我的.gitlab-ci.yml在部署中的样子我试图改变用户但不起作用
before_script:
- composer install --prefer-dist > /dev/null
stages:
- build
- test
- deploy
unitTesting:
stage: test
script:
- echo "Running PHPUnit Tests"
- PHP vendor/bin/PHPunit --colors --debug --coverage-text
job_deploy_master:
stage: deploy
only:
- master
script:
- /bin/su - myuser -c "deploy.sh" //here I try to change linux user to be able to checkout code but fails with **su: must be run from a terminal**
tags:
- PHP
#!/bin/bash
echo "Starting Deploy"
printf '%s\n' "${SUDO_USER:-$USER}" //I'm interested to see which user try to run this script outputs gitlab-runner
cd /home/builds/gpx-convertor
git pull
composer install --prefer-dist > /dev/null
我试图谷歌找到一些与PHP相关的例子,但没有成功.有人可以说明应该如何运作
解决方法:
尝试用sudo -Hu替换su -c
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。