BuildWrapper teardown cannot get result of build

XMLWordPrintable

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Major
    • Component/s: plugin-proposals
    • None
    • Environment:
      Platform: All, OS: All

      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.

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

              Created:
              Updated:
              Resolved: