Skip to content
Permalink
Browse files

[FIXED JENKINS-14027]

  • Loading branch information...
ndeloof committed Nov 22, 2012
1 parent f8a524e commit ef1dab2cdc87fc021b97a8aae758a3c1ba9ee312
Showing with 11 additions and 4 deletions.
  1. +11 −4 src/main/groovy/com/cloudbees/plugins/flow/FlowDSL.groovy
@@ -35,6 +35,8 @@ import java.util.concurrent.Callable
import static hudson.model.Result.FAILURE
import java.util.concurrent.ExecutionException
import java.util.concurrent.CopyOnWriteArrayList
import hudson.security.ACL
import org.acegisecurity.context.SecurityContextHolder

public class FlowDSL {

@@ -267,10 +269,15 @@ public class FlowDelegate {

closures.each {closure ->
Closure<FlowState> track_closure = {
flowRun.state = new FlowState(SUCCESS, upstream)
closure()
lastCompleted.addAll(flowRun.state.lastCompleted)
return flowRun.state
def ctx = ACL.impersonate(ACL.SYSTEM)
try {
flowRun.state = new FlowState(SUCCESS, upstream)
closure()
lastCompleted.addAll(flowRun.state.lastCompleted)
return flowRun.state
} finally {
SecurityContextHolder.setContext(ctx)
}
}

tasks.add(pool.submit(track_closure as Callable))

0 comments on commit ef1dab2

Please sign in to comment.
You can’t perform that action at this time.