summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJamo Luhrsen <jluhrsen@redhat.com>2016-05-11 16:26:43 -0700
committerFatih Degirmenci <fatih.degirmenci@ericsson.com>2016-05-12 07:31:13 +0000
commit65ec784f20e532caf34f5391684caa0e86742c4d (patch)
tree7a735949da7e0a87d9004171f7a38e7b3268460b
parentbae70e5012d14c4cc415c21e279ea8f3d81e4480 (diff)
add docker cleanup step
basically just a copy/paste from what looks good in the functest job. Change-Id: I56aca8835b2102bf3559f6653ea2d52947d5040b Signed-off-by: Jamo Luhrsen <jluhrsen@redhat.com>
-rw-r--r--jjb/cperf/cperf-ci-jobs.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/jjb/cperf/cperf-ci-jobs.yml b/jjb/cperf/cperf-ci-jobs.yml
index b824f78bd..884352419 100644
--- a/jjb/cperf/cperf-ci-jobs.yml
+++ b/jjb/cperf/cperf-ci-jobs.yml
@@ -105,6 +105,12 @@
- builder:
name: cperf-daily-builder
builders:
+ - 'cperf-cleanup'
+ - 'cperf-robot-cbench'
+
+- builder:
+ name: cperf-robot-cbench
+ builders:
- shell: |
#!/bin/bash
set +e
@@ -114,3 +120,28 @@
-v TOOLS_SYSTEM_IP:localhost -v duration_in_seconds:60"
robot_suite="/home/opnfv/repos/test/csit/suites/openflowplugin/Performance/010_Cbench.robot"
sudo docker run opnfv/cperf:$DOCKER_TAG ${robot_cmd} ${robot_suite}
+
+- builder:
+ name: cperf-cleanup
+ builders:
+ - shell: |
+ #!/bin/bash
+ [[ $CI_DEBUG == true ]] && redirect="/dev/stdout" || redirect="/dev/null"
+
+ echo "Cleaning up docker containers/images..."
+ # Remove previous running containers if exist
+ if [[ ! -z $(docker ps -a | grep opnfv/cperf) ]]; then
+ echo "Removing existing opnfv/cperf containers..."
+ docker ps -a | grep opnfv/cperf | awk '{print $1}' | xargs docker rm -f >${redirect}
+ fi
+
+ # Remove existing images if exist
+ if [[ ! -z $(docker images | grep opnfv/cperf) ]]; then
+ echo "Docker images to remove:"
+ docker images | head -1 && docker images | grep opnfv/cperf >${redirect}
+ image_tags=($(docker images | grep opnfv/cperf | awk '{print $2}'))
+ for tag in "${image_tags[@]}"; do
+ echo "Removing docker image opnfv/cperf:$tag..."
+ docker rmi opnfv/cperf:$tag >/dev/null
+ done
+ fi