u12*_*123 5 python command-line bash jenkins
我已经在 ubuntu 15.10 上安装了 Jenkins。在 shell 构建步骤中,我试图创建一个 Python 虚拟环境并激活它:

但是当我运行作业时出现以下错误:
/tmp/hudson4515625893361069094.sh: 9: /tmp/hudson4515625893361069094.sh: source: not found
Run Code Online (Sandbox Code Playgroud)
更多来自日志:
[django-demo] $ /bin/sh -xe /tmp/hudson4515625893361069094.sh
+ virtualenv --no-site-packages virtual_django
New python executable in virtual_django/bin/python2
Also creating executable in virtual_django/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python2
+ cd virtual_django/bin
+ pwd
/var/lib/jenkins/workspace/django-demo/virtual_django/bin
+ dir
activate activate.fish easy_install pip pip2.7 python2
activate.csh activate_this.py easy_install-2.7 pip2 python python2.7
+ source activate
/tmp/hudson4515625893361069094.sh: 9: /tmp/hudson4515625893361069094.sh: source: not found
Build step 'Execute shell' marked build as failure
Run Code Online (Sandbox Code Playgroud)
所以虚拟环境创建成功,但是无法激活,因为找不到source命令。
我确实验证了我确实可以 在相应工作区中以 jenkins 用户身份从机器上的终端运行source activate命令:
jenkins@vmi63860 ~/workspace/django-demo/virtual_django/bin ((HEAD detached at 290c6a4)) $ source activate
(virtual_django)jenkins@vmi63860 ~/workspace/django-demo/virtual_django/bin ((HEAD detached at 290c6a4)) $ exit
Run Code Online (Sandbox Code Playgroud)
那么为什么我在 Jenkins 作业下运行它会失败呢?
| 归档时间: |
|
| 查看次数: |
17012 次 |
| 最近记录: |