• Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • rebuild-plugin
    • None

      When you click on the "Rebuild Last" link in the main menu, it will trigger the build which was the last one when the page was loaded. If there have been other builds in the mean time, they will be skipped.

      This is especially annoying for parameterized jobs, of course.

      The reason for this is because the link contains the fixed build number in its URL, eg. ../jenkins/job/my-job/6139/rebuild. A simple solution would be to simply use lastCompletedBuild instead of the build number in the link. It will then always use the last build that is not currently running.

          [JENKINS-24017] "Rebuild Last" can trigger the wrong build

          Marc Günther added a comment - - edited

          One more comment, I was first thinking of using lastBuild, but that gave me a NullPointerException if (and only if) the job was currently running. The NPE involved Naginator, though

          Caused by: java.lang.NullPointerException
          	at com.chikli.hudson.plugin.naginator.NaginatorActionFactory.createFor(NaginatorActionFactory.java:20)
          	at hudson.model.Run.getTransientActions(Run.java:351)
          ...
          

          So, using lastCompletedBuild would still give you "wrong" results if a job is currently running, but it's still better than the current behaviour, and seems to be a trivial change.

          Marc Günther added a comment - - edited One more comment, I was first thinking of using lastBuild , but that gave me a NullPointerException if (and only if) the job was currently running. The NPE involved Naginator, though Caused by: java.lang.NullPointerException at com.chikli.hudson.plugin.naginator.NaginatorActionFactory.createFor(NaginatorActionFactory.java:20) at hudson.model.Run.getTransientActions(Run.java:351) ... So, using lastCompletedBuild would still give you "wrong" results if a job is currently running, but it's still better than the current behaviour, and seems to be a trivial change.

            ragesh_nair ragesh_nair
            marc_guenther Marc Günther
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: