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

If baseline-creation post-build action fails, then the build run result is no longer a failure

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • dimensionsscm-plugin
    • Serena Dimsions CM 12.2.2.4
      Jenkins 1.619 with Dimensionsscm plugin 0.8.12

      Hello ,

      When Tagging Successful builds in Dimensions as a Baseline and when the said a baseline name already exists in Dimensions, the dimensionsscm plugin reports the failure thrown by Dimesions (as expected) by logging the message 'Tag successful builds in Dimensions as a baseline' marked build as failure but then it carries on and doesn't mark the entire build as failed. It ends the job with Finished: SUCCESS which is misleading.

      Ideally when the tagging fails it should make the entire build as failed and change the icon accordingly.

      here is the full error and some


      _FATAL: Unable to tag build in Dimensions (DimensionsRuntimeException: Create baseline (DimensionsRuntimeException: Dimensions command 'CBL "STREAM1:TEST_MAIN_33" /WORKSET="STREAM1:TEST_MAIN" /SCOPE=WORKSET /DESCRIPTION="Baseline created by Hudson/Jenkins for job 'TEST_MAIN' - build 94"' failed (DimensionsRuntimeException: COR0005315E Identifier "TEST_MAIN_33" is already used for another object of this type, please use a different identifier
      )))
      ERROR: Build step failed with exception
      java.lang.IllegalStateException: cannot change build result while in POST_PRODUCTION
      at hudson.model.Run.setResult(Run.java:456)
      at hudson.plugins.dimensionsscm.DimensionsBuildNotifier.perform(DimensionsBuildNotifier.java:410)
      at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
      at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:782)
      at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:723)
      at hudson.model.Build$BuildExecution.cleanUp(Build.java:195)
      at hudson.model.Run.execute(Run.java:1785)
      at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
      at hudson.model.ResourceController.execute(ResourceController.java:98)
      at hudson.model.Executor.run(Executor.java:410)
      Build step 'Tag successful builds in Dimensions as a baseline' marked build as failure
      Finished: SUCCESS
      _

          [JENKINS-32268] If baseline-creation post-build action fails, then the build run result is no longer a failure

          Jenkins core behaviour changed around version 1.584 to only allow build result to be changed during certain phases of the build process - see https://github.com/jenkinsci/jenkins/commit/28dfd90d2d6ae99c57eb174871c46f4e07e303ba#diff-c4f9931d88bca347279b881007d71f0eL445 and JENKINS-25406 and JENKINS-28880.

          Unfortunately, the fix may require a fairly fundamental change to the baseline-creation code from being a publisher to a build step, if publishers ("Post-build actions") can no longer change the build result in recent Jenkins versions (which may always have been the intention, but is only recently being enforced).

          David Conneely added a comment - Jenkins core behaviour changed around version 1.584 to only allow build result to be changed during certain phases of the build process - see https://github.com/jenkinsci/jenkins/commit/28dfd90d2d6ae99c57eb174871c46f4e07e303ba#diff-c4f9931d88bca347279b881007d71f0eL445 and JENKINS-25406 and JENKINS-28880 . Unfortunately, the fix may require a fairly fundamental change to the baseline-creation code from being a publisher to a build step, if publishers ("Post-build actions") can no longer change the build result in recent Jenkins versions (which may always have been the intention, but is only recently being enforced).

          To investigate : Looks like overriding Publisher#needsToRunAfterFinalized may help to address this.

          David Conneely added a comment - To investigate : Looks like overriding Publisher#needsToRunAfterFinalized may help to address this.

          Code changed in jenkins
          User: David Conneely
          Path:
          src/main/java/hudson/plugins/dimensionsscm/DimensionsBuildNotifier.java
          http://jenkins-ci.org/commit/dimensionsscm-plugin/eecadc0f7f6eaddea920e6969d96694c5796233c
          Log:
          [FIXES JENKINS-32268] Post-build baseline operations should be able to change the build result, and should happen even if the build is UNSTABLE.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: David Conneely Path: src/main/java/hudson/plugins/dimensionsscm/DimensionsBuildNotifier.java http://jenkins-ci.org/commit/dimensionsscm-plugin/eecadc0f7f6eaddea920e6969d96694c5796233c Log: [FIXES JENKINS-32268] Post-build baseline operations should be able to change the build result, and should happen even if the build is UNSTABLE.

          Release 0.8.14 should resolve this issue

          David Conneely added a comment - Release 0.8.14 should resolve this issue

            Unassigned Unassigned
            tndfr Nas Taibi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: