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

Currently building links point to wrong downstream projects when concurent builds are active

      We have a multijob job that manages a bunch of downstream jobs. All the jobs have concurrency enabled meaning they can have multiple builds going at the same time.

      When you look at a running multijob build, it will have links at the bottom saying what's running. However it seems if there are multiple builds running in the downstream job, the multijob build actually presents the status and the links to the last build of that downstream job, instead of the build the multijob job actually triggered.

      The console displays the correct build and status (saying the correct build has finished, etc).

          [JENKINS-15965] Currently building links point to wrong downstream projects when concurent builds are active

          Doron Shai added a comment -

          Doron Shai added a comment - Duplicated with https://issues.jenkins-ci.org/browse/JENKINS-14955 and https://issues.jenkins-ci.org/browse/JENKINS-14952

          This bug is definitely not the same situation as JENKINS-14952 or JENKINS-14955 as we're not using '--prefix'. The links retain the correct context, it's the build number that's incorrect. I believe this has to do with concurrent builds for both the multijob and the downstream jobs.

          Devin Linnington added a comment - This bug is definitely not the same situation as JENKINS-14952 or JENKINS-14955 as we're not using '--prefix'. The links retain the correct context, it's the build number that's incorrect. I believe this has to do with concurrent builds for both the multijob and the downstream jobs.

          Doron Shai added a comment -

          You are right

          Doron Shai added a comment - You are right

          I do not know any Jenkins(user only) but I have an feeling some of the issue is located in MultiJobBuilder.java. I believe the build number gathered with project.getLastBuild() could be incorrect if sub build is allowed to execute parallel. Is it possible to query project(sub build) about upstream build number to make sure the correct sub build number is used?

          [...]
                  public boolean perform(AbstractBuild<?, ?> build, Launcher launcher,
                                  BuildListener listener) throws InterruptedException, IOException {
          [...]
                                                          addSubBuild(thisBuild, thisProject,
                                                                          (AbstractBuild) project.getLastBuild());
                                                          projectList.remove(project);
                                                          futuresList.remove(future);
                                                          break;
                                                  } catch (ExecutionException e) {
                                                          failed = true;
                                                  }
                                          } else if (project.isBuilding()) {
                                                  addSubBuild(thisBuild, thisProject,
                                                                  (AbstractBuild) project.getLastBuild());
                                          }
          [...]
          

          I may very well wrong!

          Asmund Ostvold added a comment - I do not know any Jenkins(user only) but I have an feeling some of the issue is located in MultiJobBuilder.java. I believe the build number gathered with project.getLastBuild() could be incorrect if sub build is allowed to execute parallel. Is it possible to query project(sub build) about upstream build number to make sure the correct sub build number is used? [...] public boolean perform(AbstractBuild<?, ?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { [...] addSubBuild(thisBuild, thisProject, (AbstractBuild) project.getLastBuild()); projectList.remove(project); futuresList.remove( future ); break ; } catch (ExecutionException e) { failed = true ; } } else if (project.isBuilding()) { addSubBuild(thisBuild, thisProject, (AbstractBuild) project.getLastBuild()); } [...] I may very well wrong!

          You are probably correct. The console output contains the correct links to the right build number, so the stuff generating the console output must be using a different method than project.getLastBuild(). Otherwise I would imagine the console would be having the same issue.

          Devin Linnington added a comment - You are probably correct. The console output contains the correct links to the right build number, so the stuff generating the console output must be using a different method than project.getLastBuild(). Otherwise I would imagine the console would be having the same issue.

          Having done some searching on the issue of downstream upstream build numbers it looks like it could be difficult only using numbers. One(execution) build can be triggered by multiple upstream builds.

          My suggestion is to hack in a build parameter ID that is generated unique for sub build. And then somehow match against this build parameter. But as I have already stated I do not know MultiJob and Jenkins internals at all.

          Asmund Ostvold added a comment - Having done some searching on the issue of downstream upstream build numbers it looks like it could be difficult only using numbers. One(execution) build can be triggered by multiple upstream builds. My suggestion is to hack in a build parameter ID that is generated unique for sub build. And then somehow match against this build parameter. But as I have already stated I do not know MultiJob and Jenkins internals at all.

          Code changed in jenkins
          User: Yoram Michaeli
          Path:
          src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java
          http://jenkins-ci.org/commit/tikal-multijob-plugin/c8c4eb7b24f59662489341bf1c04e280e2a03c21
          Log:
          Fix for issue JENKINS-14955 (which also duplicate with issue
          JENKINS-15965)


          You received this message because you are subscribed to the Google Groups "Jenkins Commits" group.
          To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com.
          For more options, visit https://groups.google.com/groups/opt_out.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Yoram Michaeli Path: src/main/java/com/tikal/jenkins/plugins/multijob/MultiJobBuilder.java http://jenkins-ci.org/commit/tikal-multijob-plugin/c8c4eb7b24f59662489341bf1c04e280e2a03c21 Log: Fix for issue JENKINS-14955 (which also duplicate with issue JENKINS-15965 ) – You received this message because you are subscribed to the Google Groups "Jenkins Commits" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-commits+unsubscribe@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out .

          Thanks, that line definitely looks like the problem

          Devin Linnington added a comment - Thanks, that line definitely looks like the problem

          looking at the fix I would believe that all use of project.getLastBuild() should be removed. Think of the case where project is accepts concurrent builds. Then last build may very well be wrong. I still do not understand this fully I may very well be wrong.

          Asmund Ostvold added a comment - looking at the fix I would believe that all use of project.getLastBuild() should be removed. Think of the case where project is accepts concurrent builds. Then last build may very well be wrong. I still do not understand this fully I may very well be wrong.

            yorammi Yoram Michaeli
            devin_linnington Devin Linnington
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: