spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

Change dateformat for git-commit-id-maven-plugin from `yyyy-MM-dd'T'HHH:mm:ssZ` RFC 822 to `yyyy-MM-dd'T'HH:mm:ssXXX` ISO 8601

Open TheSnoozer opened this issue 1 year ago • 3 comments

Related to https://github.com/git-commit-id/git-commit-id-maven-plugin/issues/674.

This change is required to make the times produced by the git-commit-id-maven-plugin usable for Maven's reproducible builds.

Timestamp for reproducible output archive entries must either formatted as ISO 8601 yyyy-MM-dd'T'HH:mm:ssXXX or as an int representing seconds since the epoch

Example usage might be E.g.

   <properties>
     <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
   </properties>

TheSnoozer avatar Feb 16 '24 17:02 TheSnoozer

Isn't yyyy-MM-dd'T'HHH:mm:ssZ (2024-02-16T19:32:16Z) in fact conforms ISO 8601?

If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z".

(wiki: ISO 8601)

That's what the Maven docs are using too on the page you linked above:

<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>

jonatan-ivanov avatar Feb 16 '24 19:02 jonatan-ivanov

Isn't yyyy-MM-dd'T'HHH:mm:ssZ (2024-02-16T19:32:16Z) in fact conforms ISO 8601?

If the time is in UTC, add a Z directly after the time without a space. Z is the zone designator for the zero UTC offset. "09:30 UTC" is therefore represented as "09:30Z" or "T0930Z". "14:45:15 UTC" would be "14:45:15Z" or "T144515Z".

(wiki: ISO 8601)

That's what the Maven docs are using too on the page you linked above:

<project.build.outputTimestamp>2023-01-01T00:00:00Z</project.build.outputTimestamp>

No, you are confusing to yyyy-MM-dd'T'HH:mm:ss'Z' with yyyy-MM-dd'T'HHH:mm:ssZ.

michael-o avatar Feb 16 '24 20:02 michael-o

Oops, indeed, I meant Z in the output (UTC + ISO 8601), I missed that in the diff too. XXX does that if the time is in UTC but I'm not sure if that is guaranteed (if it isn't maybe that should be the concern of another issue). Btw, I think you also meant HH instead of HHH.

jonatan-ivanov avatar Feb 16 '24 21:02 jonatan-ivanov

So, git.commit.time=2024-02-19T10:18:10+0100 (RFC 822) is bad, and git.commit.time=2024-02-19T10:18:10+01:00 (ISO 8601) is good? The latter can be parsed by Instant.parse, too.

mhalbritter avatar Feb 19 '24 09:02 mhalbritter

So, git.commit.time=2024-02-19T10:18:10+0100 is bad, and git.commit.time=2024-02-19T10:18:10+01:00 is good? The latter can be parsed by Instant.parse, too.

Correct.

michael-o avatar Feb 19 '24 09:02 michael-o

Note to myself: Check what the Gradle plugin does.

mhalbritter avatar Feb 21 '24 16:02 mhalbritter

@TheSnoozer @mhalbritter Please change the title because ISO 8601 is not aware of any timezones, but offsets only.

michael-o avatar Feb 22 '24 07:02 michael-o

Thank you very much and congratulations on your first contribution :tada:!

mhalbritter avatar Feb 28 '24 12:02 mhalbritter

Great, thanks for getting this integrated :-)

TheSnoozer avatar Feb 28 '24 18:02 TheSnoozer

This has been superseded by https://github.com/spring-projects/spring-boot/issues/40015 as we can now use the plugin's default.

wilkinsona avatar Mar 19 '24 10:03 wilkinsona