Geode: Updates to make builds more stable

Change-Id: Id6be87daa0a795831a83efdb4bb52975e953733e
diff --git a/jjb/geode/apache-geode-test/apache-geode-integration-test.yaml b/jjb/geode/apache-geode-test/apache-geode-integration-test.yaml
index 45b3d6b..173d71e 100644
--- a/jjb/geode/apache-geode-test/apache-geode-integration-test.yaml
+++ b/jjb/geode/apache-geode-test/apache-geode-integration-test.yaml
@@ -29,7 +29,7 @@
     java-test-version: '11'
     parallel-gradle: 'true'
     parallel-dunit: 'true'
-    dunit-parallel-forks: '12'
+    dunit-parallel-forks: '8'
 
     jobs:
       - 'apache-geode-{test-type}Test-jdk{java-test-version}'
diff --git a/jjb/geode/apache-geode-test/apache-geode-stressnew-test.yaml b/jjb/geode/apache-geode-test/apache-geode-stressnew-test.yaml
index 9be315e..77b6084 100644
--- a/jjb/geode/apache-geode-test/apache-geode-stressnew-test.yaml
+++ b/jjb/geode/apache-geode-test/apache-geode-stressnew-test.yaml
@@ -29,7 +29,7 @@
     java-test-version: '11'
     parallel-gradle: 'false'
     parallel-dunit: 'true'
-    dunit-parallel-forks: '12'
+    dunit-parallel-forks: '8'
 
     jobs:
       - 'apache-geode-{test-type}Test-jdk{java-test-version}'
diff --git a/jjb/geode/apache-geode-test/apache-geode-upgrade-test.yaml b/jjb/geode/apache-geode-test/apache-geode-upgrade-test.yaml
index f81df4b..8f9fd38 100644
--- a/jjb/geode/apache-geode-test/apache-geode-upgrade-test.yaml
+++ b/jjb/geode/apache-geode-test/apache-geode-upgrade-test.yaml
@@ -29,7 +29,7 @@
     java-test-version: '11'
     parallel-gradle: 'true'
     parallel-dunit: 'true'
-    dunit-parallel-forks: '12'
+    dunit-parallel-forks: '8'
 
     jobs:
       - 'apache-geode-{test-type}Test-jdk{java-test-version}'
diff --git a/jjb/geode/apache-geode-test/execute_stressnew.sh b/jjb/geode/apache-geode-test/execute_stressnew.sh
index 2f7b179..5b452fb 100755
--- a/jjb/geode/apache-geode-test/execute_stressnew.sh
+++ b/jjb/geode/apache-geode-test/execute_stressnew.sh
@@ -156,4 +156,9 @@
   sed -e 's/JAVA_HOME/GRADLE_JVM/g' -i.bak gradlewStrict $SEP \
   GRADLE_JVM=${JAVA_BUILD_PATH} ./gradlewStrict ${GRADLE_ARGS}'"
 echo "${EXEC_COMMAND}"
-eval "${EXEC_COMMAND}"
\ No newline at end of file
+eval "${EXEC_COMMAND}"
+
+# Cleanup
+# Make sure all test containers are stopped and removed when tests are finished
+docker stop $(docker ps -a -q)
+docker rm $(docker ps -a -q)
\ No newline at end of file
diff --git a/jjb/geode/apache-geode-test/execute_tests.sh b/jjb/geode/apache-geode-test/execute_tests.sh
index d0371d2..37231ec 100755
--- a/jjb/geode/apache-geode-test/execute_tests.sh
+++ b/jjb/geode/apache-geode-test/execute_tests.sh
@@ -90,3 +90,8 @@
   GRADLE_JVM=${JAVA_BUILD_PATH} ./gradlewStrict ${GRADLE_ARGS}'"
 echo "${EXEC_COMMAND}"
 eval "${EXEC_COMMAND}"
+
+# Cleanup
+# Make sure all test containers are stopped and removed when tests are finished
+docker stop $(docker ps -a -q)
+docker rm $(docker ps -a -q)
\ No newline at end of file
diff --git a/jjb/geode/global-template-apache-geode-test.yaml b/jjb/geode/global-template-apache-geode-test.yaml
index 1acb6cc..d84c77f 100644
--- a/jjb/geode/global-template-apache-geode-test.yaml
+++ b/jjb/geode/global-template-apache-geode-test.yaml
@@ -78,6 +78,11 @@
     builders:
       - '{build-executor}'
 
+    publishers:
+      - workspace-cleanup:
+          clean-if:
+            - failure: false
+
 #    publishers:
 #      - notify-slack:
 #          slack-channel: '#geode'