user_dev user_dev - 4 months ago 29
Groovy Question

How to apply build trigger for bitbucket in jenkins from groovy sccript?

I am trying to trigger the bitbucket push for some jobs using groovy scripts.

for(item in Hudson.instance.items)
{
item.addTrigger(com.cloudbees.jenkins.plugins.BitBucketTrigger$DescriptorImpl)

}


But it is not enabling the trigger. What would be the right way.

Answer
def trigger = new com.cloudbees.jenkins.plugins.BitBucketTrigger()
for(item in Hudson.instance.items)
{
    item.addTrigger(trigger)

}
Comments