From 3aa5231f7ee789899a33e2939f92f8fb003c3179 Mon Sep 17 00:00:00 2001 From: Andreas Litt Date: Thu, 23 Apr 2015 15:04:42 +0200 Subject: [PATCH 1/7] remove leading '/' from APP-Name. --- plugins/git/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/commands b/plugins/git/commands index 47934f493..beb967289 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -72,7 +72,7 @@ case "$1" in ;; git-*) - APP="$(echo $2 | perl -pe 's/(? Date: Thu, 23 Apr 2015 15:17:25 +0200 Subject: [PATCH 2/7] exec git-receive-pack with correct path --- plugins/git/commands | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/git/commands b/plugins/git/commands index beb967289..993ab6e16 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -87,7 +87,11 @@ EOF chmod +x $PRERECEIVE_HOOK fi - args=$* + if [[ $1 == "git-receive-pack" ]]; then + args="$1 '$APP_PATH'" + else + args=$* + fi git-shell -c "$args" ;; From 9fdff116872a7a128c4736e75146475f23019f37 Mon Sep 17 00:00:00 2001 From: Andreas Litt Date: Thu, 23 Apr 2015 15:04:42 +0200 Subject: [PATCH 3/7] remove leading '/' from APP-Name. --- plugins/git/commands | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/git/commands b/plugins/git/commands index 47934f493..beb967289 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -72,7 +72,7 @@ case "$1" in ;; git-*) - APP="$(echo $2 | perl -pe 's/(? Date: Thu, 23 Apr 2015 15:17:25 +0200 Subject: [PATCH 4/7] exec git-receive-pack with correct path --- plugins/git/commands | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/git/commands b/plugins/git/commands index beb967289..993ab6e16 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -87,7 +87,11 @@ EOF chmod +x $PRERECEIVE_HOOK fi - args=$* + if [[ $1 == "git-receive-pack" ]]; then + args="$1 '$APP_PATH'" + else + args=$* + fi git-shell -c "$args" ;; From c8c4a6a0c651b397cd5ae4d25248591f1a8d2504 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 25 Apr 2015 09:54:40 -0700 Subject: [PATCH 5/7] pass through return code when calling destroy_app. allow custom git remote --- tests/unit/test_helper.bash | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tests/unit/test_helper.bash b/tests/unit/test_helper.bash index 08d16f8ae..ec7f359ff 100644 --- a/tests/unit/test_helper.bash +++ b/tests/unit/test_helper.bash @@ -89,7 +89,9 @@ create_app() { } destroy_app() { + RC="$1"; RC=${RC:=0} echo $TEST_APP | dokku apps:destroy $TEST_APP + return $RC } add_domain() { @@ -98,18 +100,20 @@ add_domain() { deploy_app() { APP_TYPE="$1"; APP_TYPE=${APP_TYPE:="nodejs-express"} + GIT_REMOTE="$2"; GIT_REMOTE=${GIT_REMOTE:="dokku@dokku.me:$TEST_APP"} TMP=$(mktemp -d -t "$TARGET.XXXXX") rmdir $TMP && cp -r ./tests/apps/$APP_TYPE $TMP cd $TMP git init git config user.email "robot@example.com" git config user.name "Test Robot" - git remote add target dokku@dokku.me:$TEST_APP + echo "setting up remote: $GIT_REMOTE" + git remote add target $GIT_REMOTE [[ -f gitignore ]] && mv gitignore .gitignore git add . git commit -m 'initial commit' - git push target master || destroy_app + git push target master || destroy_app $? } setup_client_repo() { From 981e857ab162dab9164cb3d2169dcc473cf140f5 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 25 Apr 2015 09:54:49 -0700 Subject: [PATCH 6/7] add sshd config for off-port testing --- tests.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests.mk b/tests.mk index c4d126bbb..68f3e32fc 100644 --- a/tests.mk +++ b/tests.mk @@ -28,8 +28,15 @@ endif @echo "-----> Setting up ssh config..." ifneq ($(shell ls /root/.ssh/config > /dev/null 2>&1 ; echo $$?),0) echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config + echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config else ifeq ($(shell grep dokku.me /root/.ssh/config),) echo "Host dokku.me \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config + echo "Host 127.0.0.1 \\r\\n Port 22333 \\r\\n RequestTTY yes \\r\\n IdentityFile /root/.ssh/dokku_test_rsa" >> /root/.ssh/config +endif + +ifeq ($(shell grep 22333 /etc/ssh/sshd_config),) + sed --in-place "s:^Port 22:Port 22 \\nPort 22333:g" /etc/ssh/sshd_config + restart ssh endif @echo "-----> Installing SSH public key..." @@ -38,6 +45,7 @@ endif @echo "-----> Intitial SSH connection to populate known_hosts..." ssh -o StrictHostKeyChecking=no dokku@dokku.me help > /dev/null + ssh -o StrictHostKeyChecking=no dokku@127.0.0.1 help > /dev/null ifeq ($(shell grep dokku.me /home/dokku/VHOST 2>/dev/null),) @echo "-----> Setting default VHOST to dokku.me..." From a6c7cc50cef4637ba198cea1450a6b8ed34984bb Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Sat, 25 Apr 2015 09:54:57 -0700 Subject: [PATCH 7/7] test off port git remote --- tests/unit/core.bats | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/unit/core.bats b/tests/unit/core.bats index 76d5702e2..99c545a99 100644 --- a/tests/unit/core.bats +++ b/tests/unit/core.bats @@ -115,3 +115,9 @@ build_nginx_config() { assert_urls "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://dokku.example.com" } +@test "(core) git-remote (off-port)" { + run deploy_app nodejs-express ssh://dokku@127.0.0.1:22333/$TEST_APP + echo "output: "$output + echo "status: "$status + assert_success +}