mirror of
https://github.com/dokku/dokku.git
synced 2025-12-28 16:06:40 +01:00
Merge pull request #1298 from SonicHedgehog/fix-check-root
Fix check-deploy skipping the root path
This commit is contained in:
@@ -142,7 +142,7 @@ do
|
||||
[[ -z "$CHECK_URL" || "$CHECK_URL" =~ ^\# ]] && continue
|
||||
# Ignore if it's not a URL in a supported format
|
||||
# shellcheck disable=SC1001
|
||||
! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.+ ]] && continue
|
||||
! [[ "$CHECK_URL" =~ ^(http(s)?:)?\/.* ]] && continue
|
||||
|
||||
if [[ "$CHECK_URL" =~ ^https?: ]] ; then
|
||||
URL_PROTOCOL=${CHECK_URL%:*}
|
||||
|
||||
5
tests.mk
5
tests.mk
@@ -75,6 +75,10 @@ else
|
||||
@$(QUIET) ./tests/ci/unit_test_runner.sh $$UNIT_TEST_BATCH
|
||||
endif
|
||||
|
||||
deploy-test-checks-root:
|
||||
@echo deploying checks-root app...
|
||||
cd tests && ./test_deploy ./apps/checks-root dokku.me '' true
|
||||
|
||||
deploy-test-clojure:
|
||||
@echo deploying config app...
|
||||
cd tests && ./test_deploy ./apps/clojure dokku.me
|
||||
@@ -137,6 +141,7 @@ deploy-test-static:
|
||||
|
||||
deploy-tests:
|
||||
@echo running deploy tests...
|
||||
@$(QUIET) $(MAKE) deploy-test-checks-root
|
||||
@$(QUIET) $(MAKE) deploy-test-config
|
||||
@$(QUIET) $(MAKE) deploy-test-clojure
|
||||
@$(QUIET) $(MAKE) deploy-test-dockerfile
|
||||
|
||||
2
tests/apps/checks-root/CHECKS
Normal file
2
tests/apps/checks-root/CHECKS
Normal file
@@ -0,0 +1,2 @@
|
||||
ATTEMPTS=2
|
||||
/
|
||||
11
tests/apps/checks-root/index.js
Normal file
11
tests/apps/checks-root/index.js
Normal file
@@ -0,0 +1,11 @@
|
||||
var express = require('express');
|
||||
var app = express();
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
res.sendStatus(404);
|
||||
});
|
||||
|
||||
var port = process.env.PORT || 5000;
|
||||
app.listen(port, function() {
|
||||
console.log('Listening on port ' + port);
|
||||
});
|
||||
14
tests/apps/checks-root/package.json
Normal file
14
tests/apps/checks-root/package.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "node-example",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"express": "4.x"
|
||||
},
|
||||
"engines": {
|
||||
"node": "0.12.x",
|
||||
"npm": "2.x"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "node index.js"
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -xeo pipefail
|
||||
|
||||
SELF=$(which $0); APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"
|
||||
SELF=$(which $0); APP="$1"; TARGET="$2"; FORWARDED_PORT="$3"; SHOULD_FAIL="$4"
|
||||
REMOTE="dokku@$TARGET"
|
||||
REPO="test-$(basename $APP)-$RANDOM"
|
||||
|
||||
@@ -15,6 +15,12 @@ failed(){
|
||||
exit 1
|
||||
}
|
||||
|
||||
succeeded(){
|
||||
echo "************ $1 succeeded but should have failed ************"
|
||||
destroy_app
|
||||
exit 1
|
||||
}
|
||||
|
||||
TMP=$(mktemp -d -t "$TARGET.XXXXX")
|
||||
rmdir $TMP && cp -r "$(dirname "$SELF")"/$APP $TMP
|
||||
cd $TMP
|
||||
@@ -28,11 +34,21 @@ git add .
|
||||
|
||||
[[ -x pre-commit ]] && ./pre-commit $REMOTE $REPO
|
||||
git commit -m 'initial commit'
|
||||
git push target master || failed git-push
|
||||
if [[ "$SHOULD_FAIL" == true ]]; then
|
||||
git push target master && succeeded git-push
|
||||
else
|
||||
git push target master || failed git-push
|
||||
fi
|
||||
if [[ -x post-deploy ]]; then
|
||||
./post-deploy $REMOTE $REPO || failed post-deploy
|
||||
fi
|
||||
|
||||
if [[ "$SHOULD_FAIL" == true ]]; then
|
||||
echo "-----> Deploy failed (as it should have)!"
|
||||
destroy_app
|
||||
exit 0
|
||||
fi
|
||||
|
||||
URL=$(dokku url $REPO)$FORWARDED_PORT
|
||||
sleep 2
|
||||
if (./check_deploy $URL); then
|
||||
|
||||
Reference in New Issue
Block a user