Reconnect to new slave after docker.client state

Docker.client state can possibly change jenkins
master or jenkins slave images on cid nodes
which leads to jenkins restart. But slave
connection did not change during pipeline run,
so we need to force it for re-establishment.

PROD-34129

Change-Id: Ia42283e1a898ebbdeb0022bf96dac3de1be5b0d6
diff --git a/upgrade-mcp-release.groovy b/upgrade-mcp-release.groovy
index ea28568..9e65fca 100644
--- a/upgrade-mcp-release.groovy
+++ b/upgrade-mcp-release.groovy
@@ -22,6 +22,8 @@
 def pipelineTimeout = 12
 venvPepper = "venvPepper"
 workspace = ""
+def saltMastURL = ''
+def saltMastCreds = ''
 
 def triggerMirrorJob(String jobName, String reclassSystemBranch) {
     params = jenkinsUtils.getJobParameters(jobName)
@@ -387,8 +389,6 @@
                 gitTargetMcpVersion = "release/${targetMcpVersion}"
             }
             common.warningMsg("gitTargetMcpVersion has been changed to:${gitTargetMcpVersion}")
-            def saltMastURL = ''
-            def saltMastCreds = ''
             def upgradeSaltStack = ''
             def updateClusterModel = ''
             def updatePipelines = ''
@@ -681,7 +681,21 @@
                 salt.cmdRun(venvPepper, 'I@gerrit:client', "test -f ${wrongPluginJarName} && rm ${wrongPluginJarName} || true")
 
                 salt.cmdRun(venvPepper, "I@salt:master", "salt -C 'I@jenkins:client and I@docker:client and not I@salt:master' state.sls docker.client --async")
-                sleep(180)
+            }
+        }
+        catch (Throwable e) {
+            // If there was an error or exception thrown, the build failed
+            currentBuild.result = "FAILURE"
+            throw e
+        }
+    }
+    // docker.client state may trigger change of jenkins master or jenkins slave services,
+    // so we need wait for slave to reconnect and continue pipeline
+    sleep(180)
+    node('python') {
+        try {
+            stage('Update Drivetrain: Phase 2') {
+                python.setupPepperVirtualenv(venvPepper, saltMastURL, saltMastCreds)
                 common.infoMsg('Perform: Checking if Docker containers are up')
                 try {
                     common.retry(20, 30) {