• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • maven-plugin
    • None
    • Platform: All, OS: All

      It seems that hudson "sometimes" puts the wrong build-number in the environment.
      I developed a small maven plugin which writes build-number, build-id and
      revision to a properties file. Sometimes however, the build-number in the
      environment differs from the actual hudson-build number. The difference can be
      up to 3 builds. After some time, the build-numbers are synchronous again.

      I don't know how to reproduce this issue, it may correlates with the "Hudson
      building jobs twice"-bug which I am also experiencing.

      Hudson-Version: 0.123
      Project-Type: Maven2
      Container: Tomcat 5.5
      OS: Linux (Debian Etch)

          [JENKINS-700] Wrong build-number in environment

          I noticed that in your build Hudson is reusing the Maven process. I suspect that
          has something to do with this. Would it be possible for you to look at some of
          the past failures and see if there's any correlation between failures and maven
          process reuse?

          How does your plugin learns the build number? Through system property or through
          environment variable?

          Kohsuke Kawaguchi added a comment - I noticed that in your build Hudson is reusing the Maven process. I suspect that has something to do with this. Would it be possible for you to look at some of the past failures and see if there's any correlation between failures and maven process reuse? How does your plugin learns the build number? Through system property or through environment variable?

          d_lehmann added a comment -

          You are right there - every time the maven process is reused, the build-number
          is wrong. If a new Maven process is taken the build number is ok.

          I'am accessing the build-number through System.getenv("BUILD_NUMBER").

          d_lehmann added a comment - You are right there - every time the maven process is reused, the build-number is wrong. If a new Maven process is taken the build number is ok. I'am accessing the build-number through System.getenv("BUILD_NUMBER").

          In 1.129, the same set of variables that are available to free-style projects as
          environment variables are now available to maven2 builds as system properties.

          So you can do System.getProperty("BUILD_NUMBER") to access the build number.

          Because of the maven process reuse and the lack of ability in Java to update
          environment variable, the reported bug itself cannot be fixed (but then, this
          environment variable in the nave m2 project is not a documented part of Hudson,
          right?) So I'm marking this bug as closed.

          Kohsuke Kawaguchi added a comment - In 1.129, the same set of variables that are available to free-style projects as environment variables are now available to maven2 builds as system properties. So you can do System.getProperty("BUILD_NUMBER") to access the build number. Because of the maven process reuse and the lack of ability in Java to update environment variable, the reported bug itself cannot be fixed (but then, this environment variable in the nave m2 project is not a documented part of Hudson, right?) So I'm marking this bug as closed.

            Unassigned Unassigned
            d_lehmann d_lehmann
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: