mirror of
https://github.com/dokku/dokku.git
synced 2025-12-29 00:25:08 +01:00
Allow for test apps that should fail deployment
This commit is contained in:
@@ -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