Commit f78c49dd authored by Florian Heder's avatar Florian Heder

[FEATURE] Add Running Test

parent 54ea6d74
Pipeline #1351 passed with stages
in 14 seconds
...@@ -2,6 +2,7 @@ stages: ...@@ -2,6 +2,7 @@ stages:
- clone - clone
- pull - pull
- restart - restart
- test
cloneTest: cloneTest:
...@@ -37,6 +38,20 @@ restartTest: ...@@ -37,6 +38,20 @@ restartTest:
- cd ~/$CI_PROJECT_NAME - cd ~/$CI_PROJECT_NAME
script: script:
- docker-compose restart - docker-compose restart
- docker-compose up -d
only:
- develop
tags:
- play4-runner
testTest:
stage: test
before_script:
- cd ~/$CI_PROJECT_NAME
script:
- sleep 1
- /bin/bash testIfRunning.sh play4.hebotek.at
only: only:
- develop - develop
tags: tags:
...@@ -100,6 +115,7 @@ restartProduction: ...@@ -100,6 +115,7 @@ restartProduction:
- cd ~/$CI_PROJECT_NAME - cd ~/$CI_PROJECT_NAME
script: script:
- docker-compose restart - docker-compose restart
- docker-compose up -d
only: only:
- master - master
tags: tags:
......
#!/bin/bash
# add website with protocol
#monitorWebsites=(
# https://play4.hebotek.at/
# https://staging.jeunesse.at/
# https://www.oevs.or.at/
#)
monitorWebsites=( "$@" )
# add email addresses
email_to="florian.heder@hebotek.at,alexander.bohn@hebotek.at"
##
tempCheckFile=/tmp/checkOnlineFile.log
monitor() {
/usr/bin/curl -sI $1 &> $tempCheckFile
return $(head -n 1 $tempCheckFile | grep 200 | wc -l)
}
mailto() {
email_subject="Fatal Error reaching $f"
mailInfo+="[!] $f is not reachable any more"
mailInfo+="[!] Fatal Error occurred on $(date)!"
# echo -e "$mailInfo" | mail -s "$email_subject" "$email_to"
echo $mailInfo
exit 1
}
for f in ${monitorWebsites[*]}; do
monitor $f
if [ $? -eq 0 ];then
mailto;
else
echo $f works!
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment