Skip to content

Commit

Permalink
improves docker cleanup routine
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Kononykhin <[email protected]>
  • Loading branch information
andkononykhin committed Dec 5, 2018
1 parent 92a60aa commit 7f8efc1
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions Jenkinsfile.cd
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,8 @@ def systemTests = { component ->
}

stage("Run pool") {
sh './pool_start.sh 25'

echo "System Tests ($component): Running nodes..."
sh './pool_start.sh 25'
pool_nodes = sh(script: 'docker ps', returnStdout: true)
echo "System Tests ($component): pool_nodes"
}
Expand All @@ -92,7 +91,7 @@ def systemTests = { component ->
./client_for_pool_start.sh
'''
}
} //end dir
}

stage("Prepare tests") {
testHelpers.getSystemTests(targetDir: './system_tests')
Expand All @@ -112,7 +111,6 @@ def systemTests = { component ->
}
}
} finally {

stage("Upload test teports") {
sh "mkdir -p system_tests/reports"

Expand All @@ -130,16 +128,25 @@ def systemTests = { component ->
echo "{exc.getStackTrace()}"
} finally {
stage('Cleanup') {
wsCleanup()

// TODO harden
try {
sh '''
docker stop $(docker ps -a -q)
docker network rm pool-network
'''
sh "./client_stop.sh"
} catch (Exception ex) {
// pass
echo "System Tests ($component): client container stop error: ${exc.getMessage()}"
}

wsCleanup()
try {
sh "./pool_stop.sh"
} catch (Exception ex) {
echo "System Tests ($component): client container stop error: ${exc.getMessage()}"
}

sh """
docker container prune -f
docker network prune -f
"""
}
}
}
Expand Down

0 comments on commit 7f8efc1

Please sign in to comment.