Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-16855

Add "Allow broken build claiming" function

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      It would be great if it was possible to add "Allow broken build claiming". See the https://wiki.jenkins-ci.org/display/JENKINS/Claim+plugin plugin. The plugin has 1800 installations, so I'd assume others would need it as well.

      (Thanks for a great plugin!)

        Attachments

          Activity

          Hide
          ninian Ninian added a comment -

          I've just created a PR in github for this item.

          Show
          ninian Ninian added a comment - I've just created a PR in github for this item.
          Hide
          mabahj Markus added a comment -

          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)");
            }
          }
          
          Show
          mabahj Markus added a comment - 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)" ); } }
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ninian
          Path:
          pom.xml
          src/main/java/configurationslicing/claim/ClaimSlicer.java
          src/test/java/configurationslicing/claim/ClaimSlicerTest.java
          http://jenkins-ci.org/commit/configurationslicing-plugin/e1d546944f7509b7960001ea36b64d5f4003c710
          Log:
          JENKINS-16855: Add claim build action configuration slicer

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ninian Path: pom.xml src/main/java/configurationslicing/claim/ClaimSlicer.java src/test/java/configurationslicing/claim/ClaimSlicerTest.java http://jenkins-ci.org/commit/configurationslicing-plugin/e1d546944f7509b7960001ea36b64d5f4003c710 Log: JENKINS-16855 : Add claim build action configuration slicer
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ninian
          Path:
          pom.xml
          http://jenkins-ci.org/commit/configurationslicing-plugin/a150eb81deb0d634c865f9aa199a5c11e4b5fe42
          Log:
          JENKINS-16855: Problem reported with PR seems to be related to
          JENKINS-6687, reported fixed in 1.420 of jenkins, so I've moved the base
          version forward to a LTS build after that point.

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ninian Path: pom.xml http://jenkins-ci.org/commit/configurationslicing-plugin/a150eb81deb0d634c865f9aa199a5c11e4b5fe42 Log: JENKINS-16855 : Problem reported with PR seems to be related to JENKINS-6687 , reported fixed in 1.420 of jenkins, so I've moved the base version forward to a LTS build after that point.
          Hide
          scm_issue_link SCM/JIRA link daemon added a comment -

          Code changed in jenkins
          User: ninian
          Path:
          pom.xml
          src/main/java/configurationslicing/claim/ClaimSlicer.java
          src/test/java/configurationslicing/claim/ClaimSlicerTest.java
          http://jenkins-ci.org/commit/configurationslicing-plugin/6cec5bb74c18afb00053bf9d000af291d7326b0e
          Log:
          Merge pull request #9 from ninian/master

          JENKINS-16855: Add claim build action configuration slicer

          Compare: https://github.com/jenkinsci/configurationslicing-plugin/compare/ded86667f54a...6cec5bb74c18

          Show
          scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: ninian Path: pom.xml src/main/java/configurationslicing/claim/ClaimSlicer.java src/test/java/configurationslicing/claim/ClaimSlicerTest.java http://jenkins-ci.org/commit/configurationslicing-plugin/6cec5bb74c18afb00053bf9d000af291d7326b0e Log: Merge pull request #9 from ninian/master JENKINS-16855 : Add claim build action configuration slicer Compare: https://github.com/jenkinsci/configurationslicing-plugin/compare/ded86667f54a...6cec5bb74c18
          Hide
          ninian Ninian added a comment -

          Should be included in the next version 1.39

          Show
          ninian Ninian added a comment - Should be included in the next version 1.39
          Hide
          mabahj Markus added a comment -

          Thank you!

          Show
          mabahj Markus added a comment - Thank you!

            People

            • Assignee:
              ninian Ninian
              Reporter:
              mabahj Markus
            • Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: