Skip to content

Commit 141daff

Browse files
committed
Merge pull request #168 from rambo/docker_fixes
Improved helper scripts Start works, test_pull_request requires upstream to contain this branch (or something along those lines).
2 parents ce53249 + 2c5cc39 commit 141daff

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

docker/start.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash -e
2+
SCRIPTDIR=$(python -c 'import os,sys;print os.path.dirname(os.path.realpath(sys.argv[1]))' "$0")
3+
4+
# Make sure we're in the correct place relative to Dockerfile no matter where we were called from
5+
cd `dirname "$SCRIPTDIR"`
6+
7+
docker build -t asylum_test .
8+
echo "Starting test server."
9+
echo "To connect to shell in this instance run: docker exec -it $(docker ps | grep asylum_test | awk '{print $1}') /bin/bash"
10+
echo "Then in that shell run: source ../asylum-venv/bin/activate"
11+
docker run --rm --name asylum_test -it -p 8000:8000 -p 1080:1080 asylum_test

docker/test_pull_request.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
#!/bin/bash
2+
SCRIPTDIR=$(python -c 'import os,sys;print os.path.dirname(os.path.realpath(sys.argv[1]))' "$0")
23
# Make sure the id is here
34
if [ "$1" == "" ]
45
then
56
echo "Usage:\n test_pull_request.sh ID\n"
67
exit 1
78
fi
89
ID=$1
10+
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
11+
12+
# Make sure we're in the correct place to run git commands no matter where we were called from
13+
cd `dirname "$SCRIPTDIR"`
914

1015
# Make sure we have upstream
1116
git remote | grep -q upstream
@@ -15,16 +20,30 @@ then
1520
fi
1621

1722
git fetch upstream master
23+
24+
# Local branch exists, remove it
25+
git rev-parse --verify test-$ID
26+
if [ "$?" == "0" ]
27+
then
28+
git branch -D test-$ID
29+
fi
30+
1831
git fetch upstream pull/$ID/head:test-$ID
1932
if [ "$?" != "0" ]
2033
then
2134
exit 1
2235
fi
36+
37+
# Store current branch
38+
BRANCH=`git rev-parse --abbrev-ref HEAD`
39+
2340
set -e
2441
git checkout test-$ID
2542
git rebase upstream/master
2643

27-
docker build -t asylum_test .
28-
echo "Starting test server."
29-
echo "To gain shell, run: docker exec -it asylum_test bash"
30-
docker run --rm --name asylum_test -it -p 8000:8000 -p 1080:1080 asylum_test
44+
# Call the generic start script
45+
$SCRIPTDIR/start.sh
46+
47+
git checkout $BRANCH
48+
git branch -D test-$ID
49+
echo "Temporary branch test-$ID was removed, to check it out again run: git fetch upstream pull/$ID/head:test-$ID"

0 commit comments

Comments
 (0)