fabric-tna: fix killing of existing stratum instances
The previous command was exiting if a stratum_bfrt container
was not running, failing to kill stratum is running as a
regular process. Also, it was using the wrong process name.
Moreover, we improve the logic to kill stratum containers by
removing the dependency on the name. Often developers run the
stratum container without a name.
Change-Id: I1c49acdd61b96e0c2031c0672a5491d8adce6099
diff --git a/jjb/pipeline/fabric-tna-hardware.groovy b/jjb/pipeline/fabric-tna-hardware.groovy
index 96c063e..4f12a49 100644
--- a/jjb/pipeline/fabric-tna-hardware.groovy
+++ b/jjb/pipeline/fabric-tna-hardware.groovy
@@ -22,7 +22,7 @@
sshagent(credentials: ['menlo-pdp-32qs-jenkins']) {
sh returnStdout: false, label: "Start Stratum on ${params.SWITCH_IP}", script: '''
. ./.env
- ssh ${SWITCH_SSH} "docker stop stratum_bfrt && sudo pkill stratum" || true
+ ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
scp ./ptf/tests/linerate/chassis_config.pb.txt ${SWITCH_SSH}:/home/jenkins/
ssh ${SWITCH_SSH} "DOCKER_IMAGE_TAGGED=$STRATUM_DOCKER_IMG SDE_VERSION=$SDE_VERSION CHASSIS_CONFIG=${CHASSIS_CONFIG} \
./start-stratum-container.sh -external_stratum_urls=0.0.0.0:${STRATUM_PORT}"
@@ -48,7 +48,7 @@
always {
sshagent(credentials: ['menlo-pdp-32qs-jenkins']) {
sh returnStdout: false, label: "Stop Stratum", script: """
- ssh ${SWITCH_SSH} "docker stop stratum_bfrt && sudo pkill stratum" || true
+ ssh ${SWITCH_SSH} "docker ps | grep stratum | cut -d' ' -f1 | xargs docker stop; pkill stratum_bf" || true
"""
}
archiveArtifacts(artifacts: 'logs/**/**', allowEmptyArchive: true, excludes: 'logs/**/int-traffic-trace-*.pcap')