Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save christian-oudard/313619 to your computer and use it in GitHub Desktop.
Save christian-oudard/313619 to your computer and use it in GitHub Desktop.
#!/bin/bash
SSHAGENT=/usr/bin/ssh-agent
SSHAGENTARGS="-s"
PARENT_JOB=pstat_master_unittest
KEY_PATH=$HOME/policystat/fabric/pstat_dev.key
PROJECT_ROOT=/var/www/pstattest.com/
if [ ! -z "$WORKSPACE" ]; then
WORKSPACE=/vol/fs/var/lib/hudson/home/jobs/pstat_master_deploy/workspace
fi
set -e
set -v
set -x
# Start the ssh-agent
if [ -z "$SSH_AUTH_SOCK" ]; then
eval `$SSHAGENT $SSHAGENTARGS`
trap "kill $SSH_AGENT_PID" 0
fi
echo $SSH_AGENT_PID
/usr/bin/ssh-add $KEY_PATH
. $WORKSPACE/../../../virtualenvs/$PARENT_JOB/bin/activate
cd $WORKSPACE/../../$PARENT_JOB/workspace/pstat
fab test update deploy &> $WORKSPACE/fabric.out
# Load initial fixtures
cd $PROJECT_ROOT/pstat/
./manage.py reset_db --noinput && ./manage.py syncdb --noinput --migrate
python $PROJECT_ROOT/scripts/load_testing_fixtures.py
set +x
# Kill ssh-agent
ssh-add -D
set +e
ssh-agent -k > /dev/null 2>&1
unset SSH_AGENT_PID
unset SSH_AUTH_SOCK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment