@@ -54,7 +54,6 @@ def call(Map config) {
5454 def repos = []
5555
5656 logger. startClocked(' orchestration-master-node' )
57-
5857 node(' master' ) {
5958 try {
6059 logger. debugClocked(' orchestration-master-node' )
@@ -99,28 +98,29 @@ def call(Map config) {
9998 } catch (Exception e) {
10099 logger. error(" Exception catched in the pipeline execution: ${ e.message} " )
101100 uploadResourcesToNexus(steps, project, logger)
102- }
103- }
104-
105- logger. resetStopwatch()
106- project. clear()
107- ServiceRegistry . removeInstance()
108- UnirestConfig . shutdown()
109- project = null
110- git = null
111- repos = null
112- steps = null
101+ throw e
102+ } finally {
103+ try {
104+ logger. resetStopwatch()
105+ project. clear()
106+ ServiceRegistry . removeInstance()
107+ UnirestConfig . shutdown()
108+ project = null
109+ git = null
110+ repos = null
111+ steps = null
113112
114- try {
115- new ClassLoaderCleaner (). clean(logger, processId)
116- // use the jenkins INTERNAL cleanupHeap method - attention NOTHING can happen after this method!
117- logger. debug(" forceClean via jenkins internals...." )
118- // Force cleanup of the heap to release memory
119- Method cleanupHeap = currentBuild. getRawBuild(). getExecution(). class. getDeclaredMethod(" cleanUpHeap" )
120- cleanupHeap. setAccessible(true )
121- cleanupHeap. invoke(currentBuild. getRawBuild(). getExecution(), null )
122- } catch (Exception e) {
123- logger. debug(" cleanupHeap err: ${ e} " )
113+ new ClassLoaderCleaner (). clean(logger, processId)
114+ // use the jenkins INTERNAL cleanupHeap method - attention NOTHING can happen after this method!
115+ logger. debug(" forceClean via jenkins internals...." )
116+ // Force cleanup of the heap to release memory
117+ Method cleanupHeap = currentBuild. getRawBuild(). getExecution(). class. getDeclaredMethod(" cleanUpHeap" )
118+ cleanupHeap. setAccessible(true )
119+ cleanupHeap. invoke(currentBuild. getRawBuild(). getExecution(), null )
120+ } catch (Exception e) {
121+ logger. debug(" cleanupHeap err: ${ e} " )
122+ }
123+ }
124124 }
125125}
126126
@@ -284,4 +284,4 @@ private NexusService getNexusService(def registry) {
284284 return nexusService
285285}
286286
287- return this
287+ return this
0 commit comments