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

Maven2 project build wrapper sees build status of null rather than Aborted

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • core, (1)
      maven-plugin
    • None
    • Hudson 1.383
      Hudson M2 Extra Steps Plugin 1.1.3
      Hudson Groovy builder 1.4

      If you cancel a running build for a maven2 project, build wrappers see a build status of null rather than Aborted. This causes the m2-extra-steps plugin to run post-build steps that are marked "Run only if build succeeds" even when you cancel a build.

      I'm attaching a sample project I used to test this. The pom just invokes sleep for 20 seconds so it is easy to cancel it in-flight. The project uses m2-extra-steps to do two things:

      1. Invoke a groovy script to print the current status of the current build - in my testing this printed null for the current build status.
      2. Invoke another mvn goal just to see m2-extra-steps run.

      Since the extra-steps are "Run only if build succeeds" I would expect them not to run when a build is canceled, but they do run as shown in the attached build log.

        1. config.xml
          2 kB
        2. log
          3 kB
        3. pom.xml
          1 kB

          [JENKINS-8054] Maven2 project build wrapper sees build status of null rather than Aborted

          Nathan Parry added a comment -

          This issue is probably the cause of JENKINS-7864 - that describes the same symptoms I was seeing.

          Nathan Parry added a comment - This issue is probably the cause of JENKINS-7864 - that describes the same symptoms I was seeing.

          Nathan Parry added a comment -

          Copying a comment added in the old Hudson issue tracker:

          This is actually true even for free-style jobs, not just Maven jobs.

          So is it true that there is currently no way to detect aborted build in build wrapper?

          Nathan Parry added a comment - Copying a comment added in the old Hudson issue tracker : This is actually true even for free-style jobs, not just Maven jobs. So is it true that there is currently no way to detect aborted build in build wrapper?

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          changelog.html
          http://jenkins-ci.org/commit/core/99bf80604de9a0afbef0531ff60658233fc6a361
          Log:
          [FIXED JENKINS-8054] recording the fix in the merge

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: changelog.html http://jenkins-ci.org/commit/core/99bf80604de9a0afbef0531ff60658233fc6a361 Log: [FIXED JENKINS-8054] recording the fix in the merge

          Nathan Parry added a comment -

          Verified as fixed in Jenking 1.399

          Nathan Parry added a comment - Verified as fixed in Jenking 1.399

          Code changed in jenkins
          User: Mikko Peltonen
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/978a23428ad48789b01ef1e7cb14ea37785e5999
          Log:
          Set 'Aborted' result before invoking BuildWrapper's tearDown. Fixes JENKINS-7864 and JENKINS-8054.

          Originally-Committed-As: 9c965617b3b385ef65eaf50860865c05a114a01d

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mikko Peltonen Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/978a23428ad48789b01ef1e7cb14ea37785e5999 Log: Set 'Aborted' result before invoking BuildWrapper's tearDown. Fixes JENKINS-7864 and JENKINS-8054 . Originally-Committed-As: 9c965617b3b385ef65eaf50860865c05a114a01d

          Code changed in jenkins
          User: Kohsuke Kawaguchi
          Path:
          src/main/java/hudson/maven/MavenModuleSetBuild.java
          http://jenkins-ci.org/commit/maven-plugin/ca87835ac51ffa67278cfee342d3bfbbc1fa36eb
          Log:
          Merge branch 'JENKINS-8054'

          Originally-Committed-As: 7ef707390d5eb8df2e0244dad1a1708cdca055e2

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Kohsuke Kawaguchi Path: src/main/java/hudson/maven/MavenModuleSetBuild.java http://jenkins-ci.org/commit/maven-plugin/ca87835ac51ffa67278cfee342d3bfbbc1fa36eb Log: Merge branch ' JENKINS-8054 ' JENKINS-8054 : Set 'Aborted' result before invoking BuildWrapper's tearDown. Fixes JENKINS-7864 and JENKINS-8054 . Originally-Committed-As: 7ef707390d5eb8df2e0244dad1a1708cdca055e2

          Code changed in jenkins
          User: Mikko Peltonen
          Path:
          test/src/test/java/hudson/maven/AbortedMavenBuildTest.java
          http://jenkins-ci.org/commit/maven-plugin/2e46314420a9e7227843a9682391d74317ed32e9
          Log:
          Add test cases for JENKINS-8054

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mikko Peltonen Path: test/src/test/java/hudson/maven/AbortedMavenBuildTest.java http://jenkins-ci.org/commit/maven-plugin/2e46314420a9e7227843a9682391d74317ed32e9 Log: Add test cases for JENKINS-8054

          Code changed in jenkins
          User: Mikko Peltonen
          Path:
          test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java
          http://jenkins-ci.org/commit/jenkins-test-harness/93f45f3e9091f09d9a3da41b5eb436e83e4485f5
          Log:
          Add test cases for JENKINS-8054

          Originally-Committed-As: 042a4cd8a4137b28e881df5fbbf017e9fdd1a1c9

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mikko Peltonen Path: test/src/main/java/org/jvnet/hudson/test/HudsonTestCase.java http://jenkins-ci.org/commit/jenkins-test-harness/93f45f3e9091f09d9a3da41b5eb436e83e4485f5 Log: Add test cases for JENKINS-8054 Originally-Committed-As: 042a4cd8a4137b28e881df5fbbf017e9fdd1a1c9

            Unassigned Unassigned
            nparry Nathan Parry
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: