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

Unstable main build leads to post steps being executed even if configured not to

      When a build "fails" due to test failures, and post steps are configured with the option "Run only if build succeeds", these post steps are still executed.

      (Jenkins 1.467)

          [JENKINS-14102] Unstable main build leads to post steps being executed even if configured not to

          Daniel Haas added a comment -

          I have the same as Thomas

          Daniel Haas added a comment - I have the same as Thomas

          Peter S added a comment -

          Could you place this system groovy script in postbuild steps as first step. Check console output after reproducing bug to see evaluated build result.

          system groovy script
          import jenkins.*;
          import jenkins.model.*;
          
          def build = Thread.currentThread().executable
          println('Build result:' + build.getResult().toString())
          

          Peter S added a comment - Could you place this system groovy script in postbuild steps as first step. Check console output after reproducing bug to see evaluated build result. system groovy script import jenkins.*; import jenkins.model.*; def build = Thread .currentThread().executable println( 'Build result:' + build.getResult().toString())

          Thomas Demande added a comment - - edited

          Here's the output:

          C:\tools\jenkins\home\jobs\Test-validators\workspace>exit 0 
          Build result:UNSTABLE
          

          P.S.: Note that on that execution, post-steps were configured as "Run only if build succeeds"

          Thomas Demande added a comment - - edited Here's the output: C:\tools\jenkins\home\jobs\Test-validators\workspace>exit 0 Build result:UNSTABLE P.S.: Note that on that execution, post-steps were configured as "Run only if build succeeds"

          I get the same error with Jenkins 1.473, Maven build unstable but post steps still executed.
          I have also tried to pass a -Dmaven.test.failure.ignore=false, the build is then failed but post steps are still executed :/

          Is there any planned date/version to get a fix for this annoying problem?

          Maxime Lemanissier added a comment - I get the same error with Jenkins 1.473, Maven build unstable but post steps still executed. I have also tried to pass a -Dmaven.test.failure.ignore=false, the build is then failed but post steps are still executed :/ Is there any planned date/version to get a fix for this annoying problem?

          Even though the final build state of a maven project with test failures was correct or better the icon/ball had the correct color (yellow) - the build internally did not expose the correct state to post build steps.
          This causes issues with post build steps and publishers relying on the correct state of the build.

          just placed a pull request to fix this issue: https://github.com/jenkinsci/jenkins/pull/654

          Dominik Bartholdi added a comment - Even though the final build state of a maven project with test failures was correct or better the icon/ball had the correct color (yellow) - the build internally did not expose the correct state to post build steps. This causes issues with post build steps and publishers relying on the correct state of the build. just placed a pull request to fix this issue: https://github.com/jenkinsci/jenkins/pull/654

          Code changed in jenkins
          User: imod
          Path:
          maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
          maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java
          maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
          maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java
          test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java
          http://jenkins-ci.org/commit/jenkins/5f4f68be0081cd9b9554c7d0ce8529c573764056
          Log:
          [FIXED JENKINS-14102] mark maven build with test failures as unstable

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: maven-plugin/src/main/java/hudson/maven/Maven3Builder.java maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java http://jenkins-ci.org/commit/jenkins/5f4f68be0081cd9b9554c7d0ce8529c573764056 Log: [FIXED JENKINS-14102] mark maven build with test failures as unstable

          Code changed in jenkins
          User: imod
          Path:
          maven-plugin/src/main/java/hudson/maven/Maven2Builder.java
          maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
          maven-plugin/src/main/java/hudson/maven/MavenBuild.java
          maven-plugin/src/main/java/hudson/maven/MavenBuilder.java
          maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java
          test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java
          http://jenkins-ci.org/commit/jenkins/193173f5597ca02a5ce73a2e34343f77493025dc
          Log:
          [FIXED JENKINS-14102] fix also for maven2 and add test cases

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: maven-plugin/src/main/java/hudson/maven/Maven2Builder.java maven-plugin/src/main/java/hudson/maven/Maven3Builder.java maven-plugin/src/main/java/hudson/maven/MavenBuild.java maven-plugin/src/main/java/hudson/maven/MavenBuilder.java maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java http://jenkins-ci.org/commit/jenkins/193173f5597ca02a5ce73a2e34343f77493025dc Log: [FIXED JENKINS-14102] fix also for maven2 and add test cases

          dogfood added a comment -

          Integrated in jenkins_main_trunk #2156
          [FIXED JENKINS-14102] mark maven build with test failures as unstable (Revision 5f4f68be0081cd9b9554c7d0ce8529c573764056)
          [FIXED JENKINS-14102] fix also for maven2 and add test cases (Revision 193173f5597ca02a5ce73a2e34343f77493025dc)

          Result = SUCCESS
          imod : 5f4f68be0081cd9b9554c7d0ce8529c573764056
          Files :

          • maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
          • maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java
          • test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java
          • maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java
          • maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java

          imod : 193173f5597ca02a5ce73a2e34343f77493025dc
          Files :

          • test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java
          • maven-plugin/src/main/java/hudson/maven/Maven3Builder.java
          • maven-plugin/src/main/java/hudson/maven/MavenBuild.java
          • maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java
          • maven-plugin/src/main/java/hudson/maven/MavenBuilder.java
          • maven-plugin/src/main/java/hudson/maven/Maven2Builder.java

          dogfood added a comment - Integrated in jenkins_main_trunk #2156 [FIXED JENKINS-14102] mark maven build with test failures as unstable (Revision 5f4f68be0081cd9b9554c7d0ce8529c573764056) [FIXED JENKINS-14102] fix also for maven2 and add test cases (Revision 193173f5597ca02a5ce73a2e34343f77493025dc) Result = SUCCESS imod : 5f4f68be0081cd9b9554c7d0ce8529c573764056 Files : maven-plugin/src/main/java/hudson/maven/Maven3Builder.java maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java maven-plugin/src/main/java/hudson/maven/reporters/SurefireArchiver.java maven-plugin/src/main/java/hudson/maven/MavenModuleSet.java imod : 193173f5597ca02a5ce73a2e34343f77493025dc Files : test/src/test/java/hudson/maven/MavenBuildSurefireFailedTest.java maven-plugin/src/main/java/hudson/maven/Maven3Builder.java maven-plugin/src/main/java/hudson/maven/MavenBuild.java maven-plugin/src/main/java/hudson/maven/reporters/TestFailureDetector.java maven-plugin/src/main/java/hudson/maven/MavenBuilder.java maven-plugin/src/main/java/hudson/maven/Maven2Builder.java

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/hudson/maven/Maven3Builder.java
          src/main/java/hudson/maven/MavenModuleSet.java
          src/main/java/hudson/maven/reporters/SurefireArchiver.java
          src/main/java/hudson/maven/reporters/TestFailureDetector.java
          http://jenkins-ci.org/commit/maven-plugin/adf9fc658df6e18a0d0648fea011bbe752094558
          Log:
          [FIXED JENKINS-14102] mark maven build with test failures as unstable

          Originally-Committed-As: 5f4f68be0081cd9b9554c7d0ce8529c573764056

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/hudson/maven/Maven3Builder.java src/main/java/hudson/maven/MavenModuleSet.java src/main/java/hudson/maven/reporters/SurefireArchiver.java src/main/java/hudson/maven/reporters/TestFailureDetector.java http://jenkins-ci.org/commit/maven-plugin/adf9fc658df6e18a0d0648fea011bbe752094558 Log: [FIXED JENKINS-14102] mark maven build with test failures as unstable Originally-Committed-As: 5f4f68be0081cd9b9554c7d0ce8529c573764056

          Code changed in jenkins
          User: imod
          Path:
          src/main/java/hudson/maven/Maven2Builder.java
          src/main/java/hudson/maven/Maven3Builder.java
          src/main/java/hudson/maven/MavenBuild.java
          src/main/java/hudson/maven/MavenBuilder.java
          src/main/java/hudson/maven/reporters/TestFailureDetector.java
          http://jenkins-ci.org/commit/maven-plugin/bb10503a662676b8e72991f63d68859004ea9587
          Log:
          [FIXED JENKINS-14102] fix also for maven2 and add test cases

          Originally-Committed-As: 193173f5597ca02a5ce73a2e34343f77493025dc

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: imod Path: src/main/java/hudson/maven/Maven2Builder.java src/main/java/hudson/maven/Maven3Builder.java src/main/java/hudson/maven/MavenBuild.java src/main/java/hudson/maven/MavenBuilder.java src/main/java/hudson/maven/reporters/TestFailureDetector.java http://jenkins-ci.org/commit/maven-plugin/bb10503a662676b8e72991f63d68859004ea9587 Log: [FIXED JENKINS-14102] fix also for maven2 and add test cases Originally-Committed-As: 193173f5597ca02a5ce73a2e34343f77493025dc

            abayer Andrew Bayer
            tdemande Thomas Demande
            Votes:
            7 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: