diff --git a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java index 95e4336..a516721 100644 --- a/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java +++ b/src/main/java/io/jenkins/plugins/bitbucketpushandpullrequest/BitBucketPPRJobProbe.java @@ -64,6 +64,14 @@ public class BitBucketPPRJobProbe { private static final Logger logger = Logger.getLogger(BitBucketPPRJobProbe.class.getName()); + private static final BitBucketPPRPluginConfig globalConfig = + BitBucketPPRPluginConfig.getInstance(); + private final List scmTriggered; + + public BitBucketPPRJobProbe() { + scmTriggered = new ArrayList<>(); + } + public void triggerMatchingJobs(BitBucketPPRHookEvent bitbucketEvent, BitBucketPPRAction bitbucketAction, BitBucketPPRObservable observable) { @@ -124,7 +132,7 @@ && mPJobShouldNotBeTriggered(job, bitbucketEvent, bitbucketAction)) { scmTriggered.add(scmTrigger); try { - bitbucketTrigger.onPost(bitbucketEvent, bitbucketAction, scmTrigger, observable); + trigger.bitbucketTrigger.onPost(bitbucketEvent, bitbucketAction, scmTrigger, observable); return; } catch (Throwable e) { @@ -139,6 +147,16 @@ && mPJobShouldNotBeTriggered(job, bitbucketEvent, bitbucketAction)) { })); } + private static class Trigger { + public final BitBucketPPRTrigger bitbucketTrigger; + public final Optional scmTriggerItem; + + public Trigger(BitBucketPPRTrigger bitbucketTrigger, Optional item) { + this.bitbucketTrigger = bitbucketTrigger; + this.scmTriggerItem = item; + } + } + private boolean mPJobShouldNotBeTriggered(Job job, BitBucketPPRHookEvent bitbucketEvent, BitBucketPPRAction bitbucketAction) {