Commit 2d92ddb6 authored by Olav's avatar Olav

Added script files and no errors in html

parent 96815cd5
#!/bin/bash -x
# all scripts start with the above line. "-x" makes the script print out what it is doing in addition to doing it.
# a shellscript is simply a list of normal shell-commands.
# Everything you can do in a shell, can be done in the script and vice versa.
# running the command ls
# ls
#GIT_SSH_COMMAND='ssh -i /var/jenkins_home/starfleet_key -o IdentitiesOnly=yes'
# 1- clone the git repo
git clone https://git.cs.hioa.no/s306386/starfleet.git
# 2- enter the git repo and build container
docker build -t starfleet:v1 ./starfleet/
# 3- start container
docker run -p 10080:80 --name starfleet-temp -d starfleet:v1
# 4- check the website
if curl -s http://10.0.45.30:10080/hello_world.html | grep "Hello World" ;then
# If helle world excist
echo " Hello world excist"
# clean up
docker stop starfleet-temp
docker rm starfleet-temp
rm -r starfleet
# change production server
exit 0
else
echo " Hello world doesnt excist"
# clean up
docker stop starfleet-temp
docker rm starfleet-temp
rm -r starfleet
exit 1
fi
\ No newline at end of file
......@@ -2,12 +2,12 @@
<html>
<head>
<title>
Hell World!
Hello World!
</title>
</head>
<body>
<h1>Hell StarFleet!</h1>
<p>This is StarFleets test site</p>
<p>This is v4</p>
<h1>Hello World!</h1>
<p>This is StarFleet's test site</p>
<p>This is v5</p>
</body>
</html>
\ No newline at end of file
#! /bin/bash
test_successCode=-1
if curl -s http://10.0.45.30:10080/hello_world.html | grep "Hello World" ;then
# If helle world excist
echo " Hello world excist"
# clean up
# docker stop starfleet-temp
# docker rm starfleet-temp
# rm -rf /jenkins-temp/starfleet/
# change production server
test_successCode=0
else
echo " Hello world doesnt excist"
# clean up
# docker stop starfleet-temp
# docker rm starfleet-temp
# rm -rf /jenkins-temp/starfleet/
test_successCode=1
fi
exit $test_successCode
\ No newline at end of file
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