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

32 views
Skip to first unread message

Alok Kumar Singh

unread,
Aug 2, 2016, 3:26:30 AM8/2/16
to Jenkins Users
I amtrying to automate this work through  groovy script. On my jenkins master I have more than 200 jobs where I want to enable bitbucket trigger, How can I do that with groovy script. Please help.

I already tried this but it din't work.

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

  }

Alok Kumar Singh

unread,
Aug 3, 2016, 1:16:59 PM8/3/16
to Jenkins Users
def trigger = new com.cloudbees.jenkins.plugins.BitBucketTrigger()
for(item in Hudson.instance.items)
{
    item.addTrigger(trigger)

}
Reply all
Reply to author
Forward
0 new messages