Markus commented on New Feature JENKINS-16855

Great!

Since registering this issue, I've made a groovy script that runs periodically to add claiming rights to all jobs. I'll paste it in here if anyone needs it. Note that I am no groovy master so it may have bugs etc. But it works for us:

import hudson.model.*
import hudson.maven.*
import hudson.tasks.*

println("Scanning for jobs without claim rights")
for(item in Hudson.instance.items) {
  println("  Checking $item.name")
  hasClaim = false;
  if(item instanceof FreeStyleProject) {
    for(p in  item.getPublishersList() )
    {
      if(p instanceof hudson.plugins.claim.ClaimPublisher)
      {
        hasClaim = true;
      }
    }
    if (item.name.startsWith("x"))
      println("    Skipping utility job")
    else {
      if(!hasClaim)
      {
        println("    Adding claim right to $item.name")
        item.getPublishersList().add(new  hudson.plugins.claim.ClaimPublisher() );
        item.save()
      } else {
        println("    Claim right already added to $item.name")
      }
    }
  } else {
    type = item.getClass().toString();
    println("    Skipping non-FreeStyleProject job ($type)");
  }
}
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to