diff --git a/README.md b/README.md index 1093d17..41bff4c 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,10 @@ freeStyleJob('test-job') { **Changelog** +#### 1.1.21 (28. August 2020) + +- Fixed [JENKINS-63374 - Bitbucket plugin changed API for the bitbucketPush trigger in an incompatible way](https://issues.jenkins-ci.org/browse/JENKINS-63374) + #### 1.1.20 (12. August 2020) - Show what project is triggered, not just the branch name. #69 diff --git a/src/main/java/com/cloudbees/jenkins/plugins/BitBucketTrigger.java b/src/main/java/com/cloudbees/jenkins/plugins/BitBucketTrigger.java index 2c18ff2..1727cdb 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/BitBucketTrigger.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/BitBucketTrigger.java @@ -14,6 +14,7 @@ import org.apache.commons.jelly.XMLOutput; import org.jenkinsci.Symbol; import org.kohsuke.stapler.DataBoundConstructor; +import org.kohsuke.stapler.DataBoundSetter; import org.kohsuke.stapler.QueryParameter; import javax.servlet.ServletException; @@ -34,18 +35,21 @@ */ public class BitBucketTrigger extends Trigger> { - private final String overrideUrl; + private String overrideUrl; @DataBoundConstructor - public BitBucketTrigger(String overrideUrl) { - this.overrideUrl = overrideUrl; - } + public BitBucketTrigger() { } // notice that the name of the getter must exactly like the parameter public String getOverrideUrl() { return overrideUrl; } + @DataBoundSetter + public void setOverrideUrl(String overrideUrl){ + this.overrideUrl = overrideUrl; + } + /** * Called when a POST is made. */ diff --git a/src/main/java/com/cloudbees/jenkins/plugins/extensions/dsl/BitbucketHookJobDslExtension.java b/src/main/java/com/cloudbees/jenkins/plugins/extensions/dsl/BitbucketHookJobDslExtension.java index a3b7519..7b077a2 100644 --- a/src/main/java/com/cloudbees/jenkins/plugins/extensions/dsl/BitbucketHookJobDslExtension.java +++ b/src/main/java/com/cloudbees/jenkins/plugins/extensions/dsl/BitbucketHookJobDslExtension.java @@ -10,7 +10,7 @@ public class BitbucketHookJobDslExtension extends ContextExtensionPoint { @DslExtensionMethod(context = TriggerContext.class) public Object bitbucketPush(Runnable closure) { - return new BitBucketTrigger(""); + return new BitBucketTrigger(); } } diff --git a/src/test/java/com/cloudbees/jenkins/plugins/BitbucketTriggerTest.java b/src/test/java/com/cloudbees/jenkins/plugins/BitbucketTriggerTest.java index b4a21be..85bb020 100644 --- a/src/test/java/com/cloudbees/jenkins/plugins/BitbucketTriggerTest.java +++ b/src/test/java/com/cloudbees/jenkins/plugins/BitbucketTriggerTest.java @@ -38,8 +38,8 @@ public void symbolAnnotationBitbucketTrigger() throws Exception { @SuppressWarnings("rawtypes") @Test public void configRoundTripBitbucketTrigger() throws Exception { PipelineTriggersJobProperty triggersProperty = new PipelineTriggersJobProperty(null); - triggersProperty.addTrigger(new BitBucketTrigger("")); + triggersProperty.addTrigger(new BitBucketTrigger()); List properties = Collections.singletonList(triggersProperty); - new SnippetizerTester(j).assertRoundTrip(new JobPropertyStep(properties), "properties([pipelineTriggers([bitbucketPush('')])])"); + new SnippetizerTester(j).assertRoundTrip(new JobPropertyStep(properties), "properties([pipelineTriggers([bitbucketPush()])])"); } }