Merge pull request #1144 from protonet/master
Allow git-remote with different port
This commit is contained in:
@@ -72,7 +72,7 @@ case "$1" in
|
||||
;;
|
||||
|
||||
git-*)
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g')"
|
||||
APP="$(echo $2 | perl -pe 's/(?<!\\)'\''//g' | sed 's/\\'\''/'\''/g' | sed 's/^\///g')"
|
||||
APP_PATH=$DOKKU_ROOT/$APP
|
||||
|
||||
if [[ $1 == "git-receive-pack" && ! -d "$APP_PATH/refs" ]]; then
|
||||
@@ -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"
|
||||
;;
|
||||
|
||||
|
||||
8
tests.mk
8
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..."
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user