Script works in bash terminal but not in Shell build step in a Jenkins job

59 views
Skip to first unread message

morty

unread,
Apr 13, 2016, 4:13:18 PM4/13/16
to Jenkins Users
I am running Jenkins on Ubuntu 15.10. I have the following bash script:

#!/bin/bash
STAGING_DIR
="staging"

rm
-Rf $STAGING_DIR
mkdir $STAGING_DIR
cd $STAGING_DIR

git clone
[path-to-my-git-repo] .

virtualenv
--no-site-packages virtual_django
source virtual_django
/bin/activate
pip install django

python manage
.py runserver 0.0.0.0:8000

When I run the above script in a shell build step the build just hangs with this in the build log:

Cloning into '.'...
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
Downloading/unpacking django
Installing collected packages: django
Successfully installed django
Cleaning up...

When I run the same script from a terminal on the Ubuntu machine (under the jenkins user) it works fine and outputs:

Installing setuptools, pip...done.
Downloading/unpacking django
  Downloading Django-1.9.5-py2.py3-none-any.whl (6.6MB): 6.6MB downloaded
Installing collected packages: django
Successfully installed django
Cleaning up...
Performing system checks...

System check identified no issues (0 silenced).

You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.

April 13, 2016 - 19:55:17
Django version 1.9.5, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.



Any ideas why the above script hangs in the Jenkins job but works fine from the terminal?
Reply all
Reply to author
Forward
0 new messages