持续集成 请教 jenkins 在构建时激活 venv 失败

几厘米 · 2020年02月27日 · 1502 次阅读

在本地 pycharm 中可以使用. venv/bin/activate 直接激活虚拟环境,用 docker 搭了 jenkins,在上面构建的时候提示虚拟环境没有激活成功,一开始以为 docker 环境的问题,进入 dokcer 内部找到 workspace,直接执行. venv/bin/activate 能激活成功,然后就没有头绪了,问了一下度娘也似乎没有找到合适的答案,恳请各位大佬能帮忙看下问题出在哪里?

pycharm 截图:

docker 截图:

jenkins 截图:
Started by user jeremy
Running as SYSTEM
Building on master in workspace /var/jenkins_home/workspace/xueqiu_test
using credential 0fc2244d-1609-4664-9b49-dcaf67ad2210

git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repository
git config remote.origin.url https://github.com/jeremy8250/Appium-Hogwarts.git # timeout=10
Fetching upstream changes from https://github.com/jeremy8250/Appium-Hogwarts.git
git --version # timeout=10
using GIT_ASKPASS to set credentials github account
git fetch --tags --progress -- https://github.com/jeremy8250/Appium-Hogwarts.git +refs/heads/:refs/remotes/origin/ # timeout=10
git rev-parse refs/remotes/origin/master{commit} # timeout=10
git rev-parse refs/remotes/origin/origin/master{commit} # timeout=10
Checking out Revision da900d10f0bcfa906afb34a946908c3ed2352134 (refs/remotes/origin/master)
git config core.sparsecheckout # timeout=10
git checkout -f da900d10f0bcfa906afb34a946908c3ed2352134 # timeout=10
Commit message: "移动 data.yaml 到项目根目录下"
git rev-list --no-walk da900d10f0bcfa906afb34a946908c3ed2352134 # timeout=10
[xueqiu_test] $ /bin/sh -xe /tmp/jenkins4564481353202604200.sh
+ . venv/bin/activate
+ deactivate nondestructive

  • [ -n ]
  • [ -n ]
  • [ -n -o -n ]
  • [ -n ]
  • unset VIRTUAL_ENV
  • [ ! nondestructive = nondestructive ]
  • VIRTUAL_ENV=/Users/ouchou/Projects/Appium-Hogwarts/venv
  • export VIRTUAL_ENV
  • _OLD_VIRTUAL_PATH=/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • PATH=/Users/ouchou/Projects/Appium-Hogwarts/venv/bin:/usr/local/openjdk-8/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
  • export PATH
  • [ -n ]
  • [ -z ]
  • _OLD_VIRTUAL_PS1=$
  • [ x(venv) != x ]
  • PS1=(venv) $
  • export PS1
  • [ -n -o -n ] + which python /usr/bin/python Finished: SUCCESS
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册