4747public class PipelineGraphPublisherEdgeProvider implements EdgeProvider {
4848
4949 private final Jenkins jenkins ;
50- private final GlobalPipelineMavenConfig globalPMConfig ;
5150 private final boolean isPluginInstalled ;
5251 private final static Logger LOGGER = Logger .getLogger (PipelineGraphPublisherEdgeProvider .class .getName ());
5352
5453 @ Inject
5554 public PipelineGraphPublisherEdgeProvider (Jenkins jenkins ) {
5655 this .jenkins = jenkins ;
57- this .globalPMConfig = ExtensionList .lookupSingleton (GlobalPipelineMavenConfig .class );
5856 this .isPluginInstalled = jenkins .getPlugin ("pipeline-maven" ) != null ;
5957 }
6058
@@ -64,6 +62,7 @@ public Iterable<Edge> getUpstreamEdgesIncidentWith(Job<?, ?> project) {
6462 if (!isPluginInstalled ) {
6563 return edges ;
6664 }
65+ GlobalPipelineMavenConfig globalPMConfig = ExtensionList .lookupSingleton (GlobalPipelineMavenConfig .class );
6766 if (globalPMConfig != null && project instanceof WorkflowJob ) {
6867 PipelineMavenPluginDao dao = globalPMConfig .getDao ();
6968 if (project .getLastSuccessfulBuild () != null ) {
@@ -83,6 +82,10 @@ public Iterable<Edge> getUpstreamEdgesIncidentWith(Job<?, ?> project) {
8382 @ Override
8483 public Iterable <Edge > getDownstreamEdgesIncidentWith (Job <?, ?> project ) {
8584 List <Edge > edges = new ArrayList <>();
85+ if (!isPluginInstalled ) {
86+ return edges ;
87+ }
88+ GlobalPipelineMavenConfig globalPMConfig = ExtensionList .lookupSingleton (GlobalPipelineMavenConfig .class );
8689 if (globalPMConfig != null && project instanceof WorkflowJob ) {
8790 PipelineMavenPluginDao dao = globalPMConfig .getDao ();
8891 if (project .getLastSuccessfulBuild () != null ) {
0 commit comments