我计划使用 jenkins 运行构建和测试用例并进行部署。我已经安装了 Jenkins 并创建了工作。
我有带有 mercurial 的 bitbucket 存储库,因此配置了 mercurial 并构建克隆存储库,并且什么也不做。现在我正在 shell 中为特定目的编写命令:
source ~/.profile # load profile and working fine
mkvirtualenv test_build # create virtual environment using virtualenv wrapper. this fails with trace provided.
cd my_project # move to project directory
pip install -r requirements.txt # install packages using pip
这是 jenkins 上构建控制台的跟踪。
[workspace] $ /usr/local/bin/bash -xe /tmp/hudson3781010986042746968.sh
+ source /usr/local/jenkins/.profile
++ PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/usr/local/jenkins/bin
++ export PATH
++ BLOCKSIZE=K
++ export BLOCKSIZE
++ EDITOR=vi
++ export EDITOR
++ PAGER=more
++ export PAGER
++ ENV=/usr/local/jenkins/.shrc
++ export ENV
++ '[' -x /usr/games/fortune ']'
++ '[' -e /usr/local/bin/virtualenvwrapper.sh ']'
++ export WORKON_HOME=/usr/local/jenkins/virtualenvs
++ WORKON_HOME=/usr/local/jenkins/virtualenvs
++ source /usr/local/bin/virtualenvwrapper.sh
+++ '[' '' = '' ']'
++++ command which python
++++ which python
+++ VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python
+++ '[' '' = '' ']'
+++ VIRTUALENVWRAPPER_VIRTUALENV=virtualenv
+++ '[' '' = '' ']'
+++ VIRTUALENVWRAPPER_VIRTUALENV_CLONE=virtualenv-clone
+++ VIRTUALENVWRAPPER_ENV_BIN_DIR=bin
+++ '[' '' = Windows_NT ']'
+++ '[' .project = '' ']'
+++ virtualenvwrapper_initialize
++++ virtualenvwrapper_derive_workon_home
++++ typeset workon_home_dir=/usr/local/jenkins/virtualenvs
++++ '[' /usr/local/jenkins/virtualenvs = '' ']'
++++ echo /usr/local/jenkins/virtualenvs
++++ unset GREP_OPTIONS
++++ command grep '^[^/~]'
++++ grep '^[^/~]'
++++ echo /usr/local/jenkins/virtualenvs
++++ unset GREP_OPTIONS
++++ command egrep '([\$~]|//)'
++++ egrep '([\$~]|//)'
++++ echo /usr/local/jenkins/virtualenvs
++++ return 0
+++ export WORKON_HOME=/usr/local/jenkins/virtualenvs
+++ WORKON_HOME=/usr/local/jenkins/virtualenvs
+++ virtualenvwrapper_verify_workon_home -q
+++ RC=0
+++ '[' '!' -d /usr/local/jenkins/virtualenvs/ ']'
+++ return 0
+++ '[' /usr/local/jenkins/virtualenvs = '' ']'
+++ '[' /usr/local/jenkins/virtualenvs = '' ']'
+++ virtualenvwrapper_run_hook initialize
+++ typeset hook_script
+++ typeset result
++++ virtualenvwrapper_tempfile initialize-hook
++++ typeset suffix=initialize-hook
++++ typeset file
+++++ virtualenvwrapper_mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+++++ command mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+++++ mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
++++ file=/tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
++++ '[' 0 -ne 0 ']'
++++ '[' -z /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1 ']'
++++ '[' '!' -f /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1 ']'
++++ echo /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
++++ return 0
+++ hook_script=/tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
+++ '[' -z /usr/local/jenkins/virtualenvs ']'
+++ /usr/local/bin/python -c 'from virtualenvwrapper.hook_loader import main; main()' --script /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1 initialize
+++ result=0
+++ '[' 0 -eq 0 ']'
+++ '[' '!' -f /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1 ']'
+++ source /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
++++ '[' -f /usr/local/jenkins/virtualenvs/initialize ']'
++++ source /usr/local/jenkins/virtualenvs/initialize
+++ command rm -f /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
+++ rm -f /tmp/virtualenvwrapper-initialize-hook-XXXXXXXXXX.jKEvY7Y1
+++ return 0
+++ virtualenvwrapper_setup_tab_completion
+++ '[' -n /usr/local/bin/bash ']'
+++ complete -o nospace -F _cdvirtualenv_complete -S/ cdvirtualenv
+++ complete -o nospace -F _cdsitepackages_complete -S/ cdsitepackages
+++ complete -o default -o nospace -F _virtualenvs workon
+++ complete -o default -o nospace -F _virtualenvs rmvirtualenv
+++ complete -o default -o nospace -F _virtualenvs cpvirtualenv
+++ complete -o default -o nospace -F _virtualenvs showvirtualenv
+++ return 0
+ mkvirtualenv test_build
+ typeset -a in_args
+ typeset -a out_args
+ typeset -i i
+ typeset tst
+ typeset a
+ typeset envname
+ typeset requirements
+ typeset packages
+ in_args=("$@")
+ '[' -n '' ']'
+ i=0
+ tst=-lt
+ '[' 0 -lt 1 ']'
+ a=test_build
+ case "$a" in
+ '[' 0 -gt 0 ']'
+ out_args=("$a")
+ i=1
+ '[' 1 -lt 1 ']'
+ set -- test_build
+ eval 'envname=$1'
++ envname=test_build
+ virtualenvwrapper_verify_workon_home
+ RC=0
+ '[' '!' -d /usr/local/jenkins/virtualenvs/ ']'
+ return 0
+ virtualenvwrapper_verify_virtualenv
+ virtualenvwrapper_verify_resource virtualenv
++ command which virtualenv
++ which virtualenv
++ unset GREP_OPTIONS
++ command grep -v 'not found'
++ grep -v 'not found'
+ typeset exe_path=/usr/local/bin/virtualenv
+ '[' /usr/local/bin/virtualenv = '' ']'
+ '[' '!' -e /usr/local/bin/virtualenv ']'
+ return 0
+ '[' -n '' ']'
+ virtualenvwrapper_cd /usr/local/jenkins/virtualenvs
+ '[' -n /usr/local/bin/bash ']'
+ builtin cd /usr/local/jenkins/virtualenvs
+ virtualenv test_build
New python executable in test_build/bin/python2.7
Also creating executable in test_build/bin/python
Installing Setuptools..............................................................................................................................................................................................................................done.
Installing Pip.....................................................................................................................................................................................................................................................................................................................................done.
+ '[' -d /usr/local/jenkins/virtualenvs/test_build ']'
+ virtualenvwrapper_run_hook pre_mkvirtualenv test_build
+ typeset hook_script
+ typeset result
++ virtualenvwrapper_tempfile pre_mkvirtualenv-hook
++ typeset suffix=pre_mkvirtualenv-hook
++ typeset file
+++ virtualenvwrapper_mktemp -t virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX
+++ command mktemp -t virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX
+++ mktemp -t virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX
++ file=/tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
++ '[' 0 -ne 0 ']'
++ '[' -z /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4 ']'
++ '[' '!' -f /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4 ']'
++ echo /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
++ return 0
+ hook_script=/tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
+ '[' -z /usr/local/jenkins/virtualenvs ']'
+ /usr/local/bin/python -c 'from virtualenvwrapper.hook_loader import main; main()' --script /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4 pre_mkvirtualenv test_build
virtualenvwrapper.user_scripts creating /usr/local/jenkins/virtualenvs/test_build/bin/predeactivate
virtualenvwrapper.user_scripts creating /usr/local/jenkins/virtualenvs/test_build/bin/postdeactivate
virtualenvwrapper.user_scripts creating /usr/local/jenkins/virtualenvs/test_build/bin/preactivate
virtualenvwrapper.user_scripts creating /usr/local/jenkins/virtualenvs/test_build/bin/postactivate
virtualenvwrapper.user_scripts creating /usr/local/jenkins/virtualenvs/test_build/bin/get_env_details
+ result=0
+ '[' 0 -eq 0 ']'
+ '[' '!' -f /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4 ']'
+ source /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
+ command rm -f /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
+ rm -f /tmp/virtualenvwrapper-pre_mkvirtualenv-hook-XXXXXXXXXX.rPgLzOe4
+ return 0
+ typeset RC=0
+ '[' 0 -ne 0 ']'
+ '[' '!' -d /usr/local/jenkins/virtualenvs/test_build ']'
+ '[' '!' -z '' ']'
+ workon test_build
+ typeset env_name=test_build
+ '[' test_build = '' ']'
+ virtualenvwrapper_verify_workon_home
+ RC=0
+ '[' '!' -d /usr/local/jenkins/virtualenvs/ ']'
+ return 0
+ virtualenvwrapper_verify_workon_environment test_build
+ typeset env_name=test_build
+ '[' '!' -d /usr/local/jenkins/virtualenvs/test_build ']'
+ return 0
+ activate=/usr/local/jenkins/virtualenvs/test_build/bin/activate
+ '[' '!' -f /usr/local/jenkins/virtualenvs/test_build/bin/activate ']'
+ type deactivate
Build step 'Execute shell' marked build as failure
Finished: FAILURE