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

BuildWrapper teardown cannot get result of build

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Component/s: plugin-proposals
    • Labels:
      None
    • Environment:
      Platform: All, OS: All
    • Similar Issues:

      Description

      I created a BuildWrapper and implemented a tearDown method.
      When I try to get the build.getResult() from within this tearDown method the
      result is always null.

      Reason see code in Build class

      protected class RunnerImpl extends AbstractRunner {
      protected Result doRun(BuildListener listener) throws Exception {
      if(!preBuild(listener,project.getBuilders()))
      return Result.FAILURE;
      if(!preBuild(listener,project.getPublishers()))
      return Result.FAILURE;

      buildEnvironments = new ArrayList<Environment>();
      try {
      List<BuildWrapper> wrappers = new ArrayList<BuildWrapper>
      (project.getBuildWrappers().values());

      ParametersAction parameters = getAction(ParametersAction.class);
      if (parameters != null)
      parameters.createBuildWrappers(Build.this,wrappers);

      for( BuildWrapper w : wrappers )

      { Environment e = w.setUp((AbstractBuild)Build.this, launcher, listener); if(e==null) return Result.FAILURE; buildEnvironments.add(e); }

      if(!build(listener,project.getBuilders()))
      return Result.FAILURE;
      } finally

      { // tear down in reverse order for( int i=buildEnvironments.size()-1; i>=0; i-- ) buildEnvironments.get(i).tearDown((AbstractBuild) Build.this,listener); buildEnvironments = null; }

      return null;
      }

      The BuildWrapper.tearDown method is called from within the finally block and
      the result is not set yet.

        Attachments

          Activity

          nkeymeulen nkeymeulen created issue -
          mindless Alan Harder made changes -
          Field Original Value New Value
          Assignee mindless [ mindless ]
          mindless Alan Harder made changes -
          Status Open [ 1 ] In Progress [ 3 ]
          scm_issue_link SCM/JIRA link daemon made changes -
          Resolution Fixed [ 1 ]
          Status In Progress [ 3 ] Resolved [ 5 ]
          abayer Andrew Bayer made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          rtyler R. Tyler Croy made changes -
          Workflow JNJira [ 132558 ] JNJira + In-Review [ 201501 ]

            People

            Assignee:
            mindless Alan Harder
            Reporter:
            nkeymeulen nkeymeulen
            Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: