Skip to content

Instantly share code, notes, and snippets.

@porty
Last active January 5, 2016 04:35
Show Gist options
  • Save porty/2b8f9c0a9b8906cd9401 to your computer and use it in GitHub Desktop.
Save porty/2b8f9c0a9b8906cd9401 to your computer and use it in GitHub Desktop.
Buildkite interactive shell
#!/bin/bash
set -e
if [[ $(whoami) != "buildkite-agent" ]]; then
cp $(basename $0) /tmp/shell.sh
sudo su buildkite-agent -s /tmp/shell.sh
exit $?
fi
PS1='\u@\h:\w$ '
export DATABASE_URL=mysql2://root:@localhost
export RAILS_ENV=test
. /etc/buildkite-agent/hooks/environment
export DISPLAY=:1
Xvfb $DISPLAY -screen 0 1024x768x24+32 > /dev/null 2>&1 &
XVFB_PID=$!
echo
echo Xvfb running under PID $XVFB_PID '(will be cleaned up upon exit)'
echo
cd /mnt/buildkite/builds/payments-$(hostname)-1/99designs/payments/
bash || true
kill $XVFB_PID
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment