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

A current active build in the build history is lost if the job configuration XML uploaded

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: core
    • Labels:
      None
    • Similar Issues:

      Description

      If a job is currently building and new configuration is uploaded via an HTTP POST then the current build in build history is lost.

      Build information is maintained as transient state on the job object, which is reset and then reloaded from the build directory:

      @Override
      public void onLoad(ItemGroup<? extends Item> parent, String name) throws IOException {
      super.onLoad(parent, name);

      this.builds = new RunMap<R>();
      this.builds.load(this,new Constructor<R>() {
      public R create(File dir) throws IOException

      { return loadBuild(dir); }

      });

      However, the builds.load(...) ignores directories without a build.xml, which is the case when a build is currently building:

      public synchronized void load(Job job, Constructor<R> cons) {
      ....
      for( String build : buildDirs ) {
      File d = new File(buildDir,build);
      if(new File(d,"build.xml").exists()) {
      // if the build result file isn't in the directory, ignore it.
      try

      { R b = cons.create(d); builds.put( b.getNumber(), b ); }

      catch (IOException e)

      { e.printStackTrace(); } catch (InstantiationError e) { e.printStackTrace(); }

      }
      }

      The job will be out of sync with the persisted build history until the job is reloaded or saved.

        Attachments

          Issue Links

            Activity

            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            changelog.html
            core/src/main/java/hudson/cli/UpdateJobCommand.java
            core/src/main/java/hudson/model/AbstractItem.java
            core/src/main/java/hudson/model/AbstractProject.java
            core/src/main/java/hudson/model/RunMap.java
            test/src/test/groovy/hudson/model/RunMapTest.groovy
            http://jenkins-ci.org/commit/jenkins/9fbd6d3a482643f4080fbb793c67323e8464b11c
            Log:
            [FIXED JENKINS-12318]

            Preserve in-progress builds when reloading a job.
            Because in-flight builds tend to update the state a lot, with this
            change we refrain from reloading those builds from the disk.

            This should be acceptable since we are primarily reloading a job, and
            reloading of builds are secondary.

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/cli/UpdateJobCommand.java core/src/main/java/hudson/model/AbstractItem.java core/src/main/java/hudson/model/AbstractProject.java core/src/main/java/hudson/model/RunMap.java test/src/test/groovy/hudson/model/RunMapTest.groovy http://jenkins-ci.org/commit/jenkins/9fbd6d3a482643f4080fbb793c67323e8464b11c Log: [FIXED JENKINS-12318] Preserve in-progress builds when reloading a job. Because in-flight builds tend to update the state a lot, with this change we refrain from reloading those builds from the disk. This should be acceptable since we are primarily reloading a job, and reloading of builds are secondary.
            Hide
            dogfood dogfood added a comment -

            Integrated in jenkins_main_trunk #1769
            [FIXED JENKINS-12318] (Revision 9fbd6d3a482643f4080fbb793c67323e8464b11c)

            Result = SUCCESS
            Kohsuke Kawaguchi : 9fbd6d3a482643f4080fbb793c67323e8464b11c
            Files :

            • core/src/main/java/hudson/model/AbstractItem.java
            • core/src/main/java/hudson/cli/UpdateJobCommand.java
            • test/src/test/groovy/hudson/model/RunMapTest.groovy
            • core/src/main/java/hudson/model/RunMap.java
            • changelog.html
            • core/src/main/java/hudson/model/AbstractProject.java
            Show
            dogfood dogfood added a comment - Integrated in jenkins_main_trunk #1769 [FIXED JENKINS-12318] (Revision 9fbd6d3a482643f4080fbb793c67323e8464b11c) Result = SUCCESS Kohsuke Kawaguchi : 9fbd6d3a482643f4080fbb793c67323e8464b11c Files : core/src/main/java/hudson/model/AbstractItem.java core/src/main/java/hudson/cli/UpdateJobCommand.java test/src/test/groovy/hudson/model/RunMapTest.groovy core/src/main/java/hudson/model/RunMap.java changelog.html core/src/main/java/hudson/model/AbstractProject.java
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Kohsuke Kawaguchi
            Path:
            changelog.html
            core/src/main/java/hudson/cli/UpdateJobCommand.java
            core/src/main/java/hudson/model/AbstractItem.java
            core/src/main/java/hudson/model/AbstractProject.java
            core/src/main/java/hudson/model/RunMap.java
            test/src/test/groovy/hudson/model/RunMapTest.groovy
            http://jenkins-ci.org/commit/jenkins/a80bc2ca0d95945e21b43291a8bc13c5245f859f
            Log:
            [FIXED JENKINS-12318]

            Preserve in-progress builds when reloading a job.
            Because in-flight builds tend to update the state a lot, with this
            change we refrain from reloading those builds from the disk.

            This should be acceptable since we are primarily reloading a job, and
            reloading of builds are secondary.
            (cherry picked from commit 9fbd6d3a482643f4080fbb793c67323e8464b11c)

            Conflicts:

            changelog.html

            Compare: https://github.com/jenkinsci/jenkins/compare/75dc1e17f4c1...a80bc2ca0d95

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html core/src/main/java/hudson/cli/UpdateJobCommand.java core/src/main/java/hudson/model/AbstractItem.java core/src/main/java/hudson/model/AbstractProject.java core/src/main/java/hudson/model/RunMap.java test/src/test/groovy/hudson/model/RunMapTest.groovy http://jenkins-ci.org/commit/jenkins/a80bc2ca0d95945e21b43291a8bc13c5245f859f Log: [FIXED JENKINS-12318] Preserve in-progress builds when reloading a job. Because in-flight builds tend to update the state a lot, with this change we refrain from reloading those builds from the disk. This should be acceptable since we are primarily reloading a job, and reloading of builds are secondary. (cherry picked from commit 9fbd6d3a482643f4080fbb793c67323e8464b11c) Conflicts: changelog.html Compare: https://github.com/jenkinsci/jenkins/compare/75dc1e17f4c1...a80bc2ca0d95

              People

              • Assignee:
                Unassigned
                Reporter:
                paulsandoz Paul Sandoz
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: