• Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • git-plugin
    • None

      Please see below full problem 'thread'

      Actually, if the date is being returned from the Git plugin as 1970-01-17T04:01:10+0000 +0300), parsing and reformatting won't work. I think you need to open a bug against the Git plugin.

      slide

      On Tue, Apr 8, 2014 at 5:37 AM, Nir Reuveny wrote:
      Hi,

      I hope someone can help with this…

      We use custom jelly email template, and it used to work fine. (it works if I roll back the git-plugin to 2.0.1), the date is showing as below in the email (seems like wrong unix time conversion)
      CHANGES
      by XXX:1970-01-17T04:01:10+0000 +0300)
      this is an example of an email when we roll back to git-plugin 2.0.1:
      by XXX:2014-03-24 16:54:00 +0200)
      this is the section in the jelly template we use:
      <j:forEach var="cs" items="${changeSet}" varStatus="loop">
      <j:set var="hadChanges" value="true" />
      <j:set var="aUser" value="${cs.hudsonUser}"/>
      <TR>
      <TD colspan="2" class="bg2">${spc}by
      <B>${aUser!=null?aUser.displayName:cs.author.displayName}: </B>
      <B>(${cs.date})</B>
      <B>${cs.msgAnnotated}</B>
      </TD>
      I opened a bug and got the below reply… can anyone help here? I’m really unsure exactly what to do… I’m not a developer…
      Thanks!
      ——
      Looks like the git plugin changed the date format they used. https://github.com/jenkinsci/git-plugin/commit/430bdc9b6ed121d653ef2633d2109b259aa8687b
      added a comment - 08/Apr/14 11:40 AM
      So what can we do to get the correct format using the email-ext plugin?...
      added a comment - 08/Apr/14 11:42 AM
      Since the getDate() method returns a string, you'd have to parse the string back into a date object and then format the date how you want. If you need additional help, please use the mailing list as this is not a bug.

      You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
      For more options, visit https://groups.google.com/d/optout.


      Website: http://earl-of-code.com

      You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
      To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-users+unsubscribe@googlegroups.com.
      For more options, visit https://groups.google.com/d/optout.

          [JENKINS-22536] Date in changeset is in wrong format

          Mark,

          it seems that you didn't open a proper PR on the plugin. It seems that now you are the official maintainer for this plugin and your change is interesting. Could you do something for it? Thanks

          Adrien Lecharpentier added a comment - Mark, it seems that you didn't open a proper PR on the plugin. It seems that now you are the official maintainer for this plugin and your change is interesting. Could you do something for it? Thanks

          Mark Waite added a comment -

          alecharp You are correct, I am the maintainer of the plugin and I did not use a pull request to submit the proposed change, since a pull request wouldn't get the further analysis needed for the change any more than my e-mail request for a review did.

          This change needs more evaluation / automated tests before it is ready to be included in the plugin. I don't want to make a change which changes to yet a different incorrect behavior.

          If you're willing to experiment with an unreleased version of the plugin which includes that change, I'm happy to build one. I am most concerned that the time value returned from the REST call may be in the wrong time zone, or may be the wrong date value (offset by time zone hours).

          Mark Waite added a comment - alecharp You are correct, I am the maintainer of the plugin and I did not use a pull request to submit the proposed change, since a pull request wouldn't get the further analysis needed for the change any more than my e-mail request for a review did. This change needs more evaluation / automated tests before it is ready to be included in the plugin. I don't want to make a change which changes to yet a different incorrect behavior. If you're willing to experiment with an unreleased version of the plugin which includes that change, I'm happy to build one. I am most concerned that the time value returned from the REST call may be in the wrong time zone, or may be the wrong date value (offset by time zone hours).

          Mark,

          I saw that this is much more difficult than just removing the original timezone offset from the string. But, as the plugin is using `joda-time`, it is possible to use `DateTime` and `DateTimeZone` to include the original offset.

          I'm trying to create tests to validate my change. When I'm ok with it, I'll send you a PR.

          Best regards.

          Adrien Lecharpentier added a comment - Mark, I saw that this is much more difficult than just removing the original timezone offset from the string. But, as the plugin is using `joda-time`, it is possible to use `DateTime` and `DateTimeZone` to include the original offset. I'm trying to create tests to validate my change. When I'm ok with it, I'll send you a PR. Best regards.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/GitChangeSet.java
          src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java
          http://jenkins-ci.org/commit/git-plugin/28978eeaea3cc9a8fd1974acb5408757c59e7bf0
          Log:
          [Fix JENKINS-22536] Use ISO 8601 date format for GitChangeSet dates

          The date format presented previously was a combination of the ISO 8601
          formatted date and a copy of the time zone information from the original
          git change log entry.

          The new format is only the ISO 8601 formatted date, since it already
          includes time zone information.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/GitChangeSet.java src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java http://jenkins-ci.org/commit/git-plugin/28978eeaea3cc9a8fd1974acb5408757c59e7bf0 Log: [Fix JENKINS-22536] Use ISO 8601 date format for GitChangeSet dates The date format presented previously was a combination of the ISO 8601 formatted date and a copy of the time zone information from the original git change log entry. The new format is only the ISO 8601 formatted date, since it already includes time zone information.

          Code changed in jenkins
          User: Mark Waite
          Path:
          src/main/java/hudson/plugins/git/GitChangeSet.java
          src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java
          http://jenkins-ci.org/commit/git-plugin/b3dcb0270e6fd49738844b7ada28ec3ed0fae395
          Log:
          [Fix JENKINS-22536] Use ISO 8601 date format for GitChangeSet dates

          The date format presented previously was a combination of the ISO 8601
          formatted date and a copy of the time zone information from the original
          git change log entry.

          The new format is only the ISO 8601 formatted date, since it already
          includes time zone information.

          SCM/JIRA link daemon added a comment - Code changed in jenkins User: Mark Waite Path: src/main/java/hudson/plugins/git/GitChangeSet.java src/test/java/hudson/plugins/git/GitChangeSetSimpleTest.java http://jenkins-ci.org/commit/git-plugin/b3dcb0270e6fd49738844b7ada28ec3ed0fae395 Log: [Fix JENKINS-22536] Use ISO 8601 date format for GitChangeSet dates The date format presented previously was a combination of the ISO 8601 formatted date and a copy of the time zone information from the original git change log entry. The new format is only the ISO 8601 formatted date, since it already includes time zone information.

          Mark,

          I'm not sure that just "removing" the original timezone offset is the way to go. What I've done so far is here: https://github.com/alecharp/git-plugin/commit/c04174ee94e8e6765b1d2bdaea0beeb291678ab8

          In the documentation here (https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats), the dates in seconds from EPOC may have a timezone offset, which is important. Just removing it shouldn't convert correctly the date. What do you think?

          Adrien Lecharpentier added a comment - Mark, I'm not sure that just "removing" the original timezone offset is the way to go. What I've done so far is here: https://github.com/alecharp/git-plugin/commit/c04174ee94e8e6765b1d2bdaea0beeb291678ab8 In the documentation here ( https://www.kernel.org/pub/software/scm/git/docs/git-commit.html#_date_formats ), the dates in seconds from EPOC may have a timezone offset, which is important. Just removing it shouldn't convert correctly the date. What do you think?

          Mark Waite added a comment -

          alecharp I agree that removing the timezone information completely does not seem like the right thing to do, since timezone information is there. When I looked at it, it seemed there was an extra timezone definition appended to the end of the date. That meant it had two (sometimes conflicting) timezone definitions in the date. I thought that two timezone definitions in one time field were probably not right.

          Mark Waite added a comment - alecharp I agree that removing the timezone information completely does not seem like the right thing to do, since timezone information is there. When I looked at it, it seemed there was an extra timezone definition appended to the end of the date. That meant it had two (sometimes conflicting) timezone definitions in the date. I thought that two timezone definitions in one time field were probably not right.

          Yes, two timezone offset is not right, but I'm not sure that using the one from the `new Date()` is correct. As the project already depends on `joda-time`, my patch use it and normally the `DateTime` and `DateTimeZone` should correct that.

          I made my changes based on git-2.2.6 tag, but it's quite easy to move it to HEAD. But, as the git-plugin need 1.568 core now, I'd like to be able to backport this to the latest version compatible with the previous required core version.

          Adrien Lecharpentier added a comment - Yes, two timezone offset is not right, but I'm not sure that using the one from the `new Date()` is correct. As the project already depends on `joda-time`, my patch use it and normally the `DateTime` and `DateTimeZone` should correct that. I made my changes based on git-2.2.6 tag, but it's quite easy to move it to HEAD. But, as the git-plugin need 1.568 core now, I'd like to be able to backport this to the latest version compatible with the previous required core version.

          Mark Waite added a comment -

          alecharp could you evaluate git plugin 2.4.0 and git client plugin 1.18.0 in the context of this bug report? They were released 18 Jul 2015.

          Mark Waite added a comment - alecharp could you evaluate git plugin 2.4.0 and git client plugin 1.18.0 in the context of this bug report? They were released 18 Jul 2015.

          Mark Waite added a comment -

          Assuming this was fixed in git client plugin 1.18.0 and git plugin 2.4.0, released 18 July 2015

          Mark Waite added a comment - Assuming this was fixed in git client plugin 1.18.0 and git plugin 2.4.0, released 18 July 2015

            Unassigned Unassigned
            nreuveny Nir Reuveny
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: