Skip to content

Commit

Permalink
Reparse CpsFlowExecution.loadedScripts in original order
Browse files Browse the repository at this point in the history
  • Loading branch information
jglick committed Mar 6, 2024
1 parent bef4b5c commit 564eea4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
Expand Down Expand Up @@ -254,7 +253,7 @@ public class CpsFlowExecution extends FlowExecution implements BlockableResume {
* Any additional scripts {@linkplain CpsGroovyShell#parse(GroovyCodeSource) parsed} afterward, keyed by
* their FQCN.
*/
/*package*/ /*final*/ Map<String,String> loadedScripts = new HashMap<>();
/*package*/ /*final*/ Map<String,String> loadedScripts = new LinkedHashMap<>();

private final boolean sandbox;
private transient /*almost final*/ FlowExecutionOwner owner;
Expand Down Expand Up @@ -644,12 +643,6 @@ private CpsScript parseScript() throws IOException {
}

s.execution = this;
if (false) {
System.out.println("scriptName="+s.getClass().getName());
System.out.println(List.of(s.getClass().getInterfaces()));
System.out.println(List.of(s.getClass().getDeclaredFields()));
System.out.println(List.of(s.getClass().getDeclaredMethods()));
}
return s;
}

Expand Down Expand Up @@ -1877,7 +1870,7 @@ public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingCont
}

if (result.loadedScripts == null) {
result.loadedScripts = new HashMap<>(); // field added later
result.loadedScripts = new LinkedHashMap<>(); // field added later
}
result.liveTimings = result.timings == null ?
new ConcurrentHashMap<>() :
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ public boolean isAllowed(String groovyResourceUrl) {
sessions.then(r -> {
WorkflowJob p = r.jenkins.getItemByFullName("p", WorkflowJob.class);
WorkflowRun b = p.getLastBuild();
FileUtils.copyFile(new File(b.getRootDir(), "build.xml"), System.out);
SemaphoreStep.success("wait/1", null);
r.assertLogContains("received really OK", r.assertBuildStatus(Result.SUCCESS, r.waitForCompletion(b)));
});
Expand Down

0 comments on commit 564eea4

Please sign in to comment.