diff --git a/plugins/git/commands b/plugins/git/commands index 47934f493..993ab6e16 100755 --- a/plugins/git/commands +++ b/plugins/git/commands @@ -72,7 +72,7 @@ case "$1" in ;; git-*) - APP="$(echo $2 | perl -pe 's/(? 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..." 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 +} 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() {