From 3ab869f82cbdfa51877cdea5110f2f87a64a55cc Mon Sep 17 00:00:00 2001 From: Jim Van Fleet Date: Wed, 24 Aug 2016 16:48:48 -0400 Subject: [PATCH] Starting and stopping container as part of tests --- Jenkinsfile | 8 ++++++++ bin/ci-run.sh | 6 ++++++ bin/ci-stop.sh | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100755 bin/ci-run.sh create mode 100755 bin/ci-stop.sh diff --git a/Jenkinsfile b/Jenkinsfile index ed94faa..7586978 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -34,9 +34,17 @@ node { sh "rm -f ./debug" handleError(message) } + stage 'Start container' + + sh 'bin/ci-run.sh' + stage 'Tests' sh 'bin/test.sh' + // should build a finally construct here + stage 'Stop container' + + sh 'bin/ci-stop.sh' stage 'Push' diff --git a/bin/ci-run.sh b/bin/ci-run.sh new file mode 100755 index 0000000..70761f0 --- /dev/null +++ b/bin/ci-run.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +# This file will run a container in the background +source common.bash . + +docker run -d --name=$imagename -p 80:80 -p 443:443 $maintainer/$imagename \ No newline at end of file diff --git a/bin/ci-stop.sh b/bin/ci-stop.sh new file mode 100755 index 0000000..54ab019 --- /dev/null +++ b/bin/ci-stop.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +# This file will run a container in the background +source common.bash . + +echo "Cleaning up Docker image($maintainer/$imagename)" +docker stop $imagename >> /dev/null +docker rm $imagename