我对 Gitlab 和 Gitlab CI 比较陌生(实际上是整个 CI 的事情),我已经在同一台机器上成功地设置了我的 Gitlab 服务器和 Gitlab CI 服务器(由于缺少备用服务器,而且几乎是因为我们的团队是在整个 CI 方面仍处于“测试”阶段)。
我们现在有两个项目正在进行中,一个 Angular 项目(作为 Web 客户端)和一个烧瓶项目(作为 Web 服务)。我已经在 Gitlab 和 Gitlab CI 中成功设置了我们的 Angular 项目(效果很好,它运行我们的测试并构建脚本非常好)。
但是现在我也想设置我们的烧瓶项目,所以我们也可以对其应用持续集成,并为此将tox
用于运行我们的测试脚本等(gulp
用于我们的角度项目)。
这是我们非常基本的 tox.ini:
[tox]
skipsdist = True
envlist = py27
[flake8]
max-line-length = 79
exclude = venv, .tox
max-complexity = 10
[testenv]
deps=-rrequirements/testing.txt
changedir=tests
commands=py.test
在我们的 Gitlab CI Jobs 中,我只是把它放在tox
那里,因为这就是我在我的开发服务器上执行的所有内容(这个设置在我的开发机器上运行良好,tox
即使我不在 virtualenv 上也可以运行),但我继续拥有这个运行此命令时,我的 Gitlab CI 上出现权限被拒绝错误(见下文)
gitlab-ci-multi-runner 0.3.3 (dbaf96f)
Using Shell executor...
Running on hikari...
Fetching changes...
Removing .tox/
Checkouting 8325a2a2 as master...
tox
py27 create: /home/gitlab_ci_multi_runner/tmp/builds/runner-b0fcd933- project-5-concurrent-0/gitlab.amici.com.ph/hris/xi-flask-starter-kit/.tox/py27
py27 installdeps: -rrequirements/testing.txt
ERROR: invocation failed (errno 13), args: [local('/home /gitlab_ci_multi_runner/tmp/builds/runner-b0fcd933-project-5-concurrent- 0/gitlab.amici.com.ph/hris/xi-flask-starter-kit/.tox/py27/bin/pip'), 'install', '-rrequirements/testing.txt'], cwd: /home/gitlab_ci_multi_runner /tmp/builds/runner-b0fcd933-project-5-concurrent-0/gitlab.amici.com.ph /hris/xi-flask-starter-kit
Traceback (most recent call last):
File "/usr/local/bin/tox", line 11, in <module>
sys.exit(cmdline())
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 39, in main
retcode = Session(config).runcommand()
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 367, in runcommand
return self.subcommand_test()
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 518, in subcommand_test
if self.setupenv(venv):
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 423, in setupenv
status = venv.update(action=action)
File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 139, in update
self.install_deps(action)
File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 249, in install_deps
self._install(deps, action=action)
File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 317, in _install
action=action, extraenv=extraenv)
File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 283, in run_install_command
extraenv=extraenv, action=action)
File "/usr/local/lib/python2.7/dist-packages/tox/venv.py", line 384, in _pcall
return action.popen(args, cwd=cwd, env=env, redirect=redirect, ignore_ret=ignore_ret)
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 130, in popen
stdout=stdout, stderr=STDOUT)
File "/usr/local/lib/python2.7/dist-packages/tox/session.py", line 218, in _popen
stdout=stdout, stderr=stderr, env=env)
File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
errread, errwrite)
File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
顺便说一句,我正在使用新gitlab-ci-multi-runner
的,并且我几乎回收了我在我的角度项目中使用的跑步者(我尝试在同一台机器上为我们的烧瓶项目注册一个新的,但是当我尝试测试时它没有响应它)
另外我已经tox
使用全局安装了sudo pip install tox
,因为这几乎是我刚刚对我们的 Angular 项目所做的,sudo npm install -g bower gulp
并且sudo npm install npm -g
,
然后我只是把
npm install
bower install
gulp build
在我们的 Angular 项目 CI Job 上