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

When triggering a new build from current build page, 'Next Build' isn't shown after reloading page

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • core
    • 1.532.1-rc1, 1.540, 1.533, 1.500

      1. Create a freestyle project 'foo' with a shell build step that executes sleep 30 and save.
      2. Click 'Build Now'
      3. Go to the build's page (/job/foo/1) and wait until the build finishes.
      4. From the breadcrumb bar, select 'Build Now' from the 'foo' job's context menu.
      5. Wait a second (so the build is actually started), then reload.

      Expected result: 'Next Build' link is shown
      Actual result: It's not

      If you open the job's main page at /job/foo e.g. in another tab, then reload the build page again, the 'Next Build' link appears after reloading.

          [JENKINS-20662] When triggering a new build from current build page, 'Next Build' isn't shown after reloading page

          Daniel Beck added a comment -

          This seems to be a bug in core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java's getNextBuild():

          The first call to that method (step 3) sets nextBuildR to none().

          Subsequent calls (step 5) check for null (false), then check for none() (true), and then return null.

          Daniel Beck added a comment - This seems to be a bug in core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java 's getNextBuild() : The first call to that method (step 3) sets nextBuildR to none() . Subsequent calls (step 5) check for null ( false ), then check for none() ( true ), and then return null .

          Jesse Glick added a comment -

          Not related to JENKINS-22052 since you see this with a freestyle project. Probably also not related to JENKINS-22395 since that involves build deletion.

          I think the bug is that when the new build is created, if you are not displaying it right away (which would be the case if you merely scheduled it), getPreviousBuild is not getting called on the new build, and thus nextBuildR is not getting updated on the first build. If true (and that would be pretty easy to test), the fix would simply be to call getPreviousBuild as soon as possible, such as from LazyBuildMixIn.newBuild.

          Jesse Glick added a comment - Not related to JENKINS-22052 since you see this with a freestyle project. Probably also not related to JENKINS-22395 since that involves build deletion. I think the bug is that when the new build is created, if you are not displaying it right away (which would be the case if you merely scheduled it), getPreviousBuild is not getting called on the new build, and thus nextBuildR is not getting updated on the first build. If true (and that would be pretty easy to test), the fix would simply be to call getPreviousBuild as soon as possible, such as from LazyBuildMixIn.newBuild .

          Daniel Beck added a comment -

          Jesse: Sorry about the wrong track!

          Daniel Beck added a comment - Jesse: Sorry about the wrong track!

          Daniel Beck added a comment -

          Daniel Beck added a comment - https://github.com/jenkinsci/jenkins/pull/1191

          Code changed in jenkins
          User: Daniel Beck
          Path:
          core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
          http://jenkins-ci.org/commit/jenkins/e6e7526021bdc8e4975c816944b931dcc5f739c0
          Log:
          [FIXED JENKINS-20662] Establish relation to new build immediately.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java http://jenkins-ci.org/commit/jenkins/e6e7526021bdc8e4975c816944b931dcc5f739c0 Log: [FIXED JENKINS-20662] Establish relation to new build immediately.

          Code changed in jenkins
          User: Daniel Beck
          Path:
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/26735ec022d57ffd48340d5aa641e80b84b022c2
          Log:
          JENKINS-20662 Add test.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/26735ec022d57ffd48340d5aa641e80b84b022c2 Log: JENKINS-20662 Add test.

          Code changed in jenkins
          User: Daniel Beck
          Path:
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/b59c490a3b49d72e20007c1ca26051b6602f2401
          Log:
          JENKINS-20662 Simplify test after feedback

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Beck Path: test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/b59c490a3b49d72e20007c1ca26051b6602f2401 Log: JENKINS-20662 Simplify test after feedback

          Code changed in jenkins
          User: Jesse Glick
          Path:
          core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java
          test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy
          http://jenkins-ci.org/commit/jenkins/b227088704070acf5a50486be0ff6a315e36a9c5
          Log:
          Merge branch 'JENKINS-20662' of github.com:daniel-beck/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy http://jenkins-ci.org/commit/jenkins/b227088704070acf5a50486be0ff6a315e36a9c5 Log: Merge branch ' JENKINS-20662 ' of github.com:daniel-beck/jenkins

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Jesse Glick Path: changelog.html http://jenkins-ci.org/commit/jenkins/dad71f530964e99bd0ca9b8d156ddf7ad49b2e43 Log: JENKINS-20662 Noting merge of #1191. Compare: https://github.com/jenkinsci/jenkins/compare/54c5df2c34cf...dad71f530964

          dogfood added a comment -

          Integrated in jenkins_main_trunk #3339
          [FIXED JENKINS-20662] Establish relation to new build immediately. (Revision e6e7526021bdc8e4975c816944b931dcc5f739c0)
          JENKINS-20662 Add test. (Revision 26735ec022d57ffd48340d5aa641e80b84b022c2)
          JENKINS-20662 Simplify test after feedback (Revision b59c490a3b49d72e20007c1ca26051b6602f2401)
          JENKINS-20662 Noting merge of #1191. (Revision dad71f530964e99bd0ca9b8d156ddf7ad49b2e43)

          Result = SUCCESS
          daniel-beck : e6e7526021bdc8e4975c816944b931dcc5f739c0
          Files :

          • core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java

          daniel-beck : 26735ec022d57ffd48340d5aa641e80b84b022c2
          Files :

          • test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy

          daniel-beck : b59c490a3b49d72e20007c1ca26051b6602f2401
          Files :

          • test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy

          Jesse Glick : dad71f530964e99bd0ca9b8d156ddf7ad49b2e43
          Files :

          • changelog.html

          dogfood added a comment - Integrated in jenkins_main_trunk #3339 [FIXED JENKINS-20662] Establish relation to new build immediately. (Revision e6e7526021bdc8e4975c816944b931dcc5f739c0) JENKINS-20662 Add test. (Revision 26735ec022d57ffd48340d5aa641e80b84b022c2) JENKINS-20662 Simplify test after feedback (Revision b59c490a3b49d72e20007c1ca26051b6602f2401) JENKINS-20662 Noting merge of #1191. (Revision dad71f530964e99bd0ca9b8d156ddf7ad49b2e43) Result = SUCCESS daniel-beck : e6e7526021bdc8e4975c816944b931dcc5f739c0 Files : core/src/main/java/jenkins/model/lazy/LazyBuildMixIn.java daniel-beck : 26735ec022d57ffd48340d5aa641e80b84b022c2 Files : test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy daniel-beck : b59c490a3b49d72e20007c1ca26051b6602f2401 Files : test/src/test/groovy/jenkins/model/lazy/LazyBuildMixIn_Test.groovy Jesse Glick : dad71f530964e99bd0ca9b8d156ddf7ad49b2e43 Files : changelog.html

            danielbeck Daniel Beck
            danielbeck Daniel Beck
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: