Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change format of git.commit.time used by git-commit-id-maven-plugin from RFC 822 to ISO 8601 #39606

Closed
wants to merge 1 commit into from

Conversation

TheSnoozer
Copy link
Contributor

Related to git-commit-id/git-commit-id-maven-plugin#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>

…H:mm:ssZ` RFC 822 to `yyyy-MM-dd'T'HH:mm:ssXXX` ISO 8601

Related to git-commit-id/git-commit-id-maven-plugin#674.

This change is required to make the times produced by the git-commit-id-maven-plugin usable for Maven's [reproducible builds]( https://maven.apache.org/guides/mini/guide-reproducible-builds.html).

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](https://reproducible-builds.org/docs/source-date-epoch/">SOURCE_DATE_EPOCH)

Example usage might be
E.g.
```
   <properties>
     <project.build.outputTimestamp>${git.commit.time}</project.build.outputTimestamp>
   </properties>
```
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Feb 16, 2024
Copy link

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonatan-ivanov
Copy link
Member

jonatan-ivanov commented Feb 16, 2024

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>

@michael-o
Copy link

michael-o commented Feb 16, 2024

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.

@jonatan-ivanov
Copy link
Member

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.

@mhalbritter
Copy link
Contributor

mhalbritter commented Feb 19, 2024

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.

@michael-o
Copy link

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.

@mhalbritter mhalbritter added the for: team-meeting An issue we'd like to discuss as a team to make progress label Feb 19, 2024
@philwebb philwebb changed the title 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 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 Feb 21, 2024
@philwebb philwebb added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels Feb 21, 2024
@philwebb philwebb added this to the 3.3.x milestone Feb 21, 2024
@mhalbritter mhalbritter changed the title 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 Change dateformat for git-commit-id-maven-plugin from RFC 822 timezone to ISO 8601 timezone Feb 21, 2024
@mhalbritter
Copy link
Contributor

Note to myself: Check what the Gradle plugin does.

@michael-o
Copy link

michael-o commented Feb 22, 2024

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

@wilkinsona wilkinsona changed the title Change dateformat for git-commit-id-maven-plugin from RFC 822 timezone to ISO 8601 timezone Change format of git.commit.time used by git-commit-id-maven-plugin from RFC 822 to ISO 8601 Feb 22, 2024
mhalbritter pushed a commit that referenced this pull request Feb 28, 2024
Old formmat: yyyy-MM-dd'T'HH:mm:ssZ, RFC 822
New format:  yyyy-MM-dd'T'HH:mm:ssXXX ISO 8601

Related to git-commit-id/git-commit-id-maven-plugin#674.

This change is required to make the times produced by the
git-commit-id-maven-plugin usable for Maven's reproducible builds,
see https://maven.apache.org/guides/mini/guide-reproducible-builds.html.

Timestamp for reproducible output archive entries must either formatted
as ISO 8601 or as an int representing seconds since the epoch.

Example usage might be

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

See gh-39606
@mhalbritter
Copy link
Contributor

Thank you very much and congratulations on your first contribution 🎉!

@mhalbritter mhalbritter modified the milestones: 3.3.x, 3.3.0-M3 Feb 28, 2024
@TheSnoozer
Copy link
Contributor Author

Great, thanks for getting this integrated :-)

@TheSnoozer TheSnoozer deleted the patch-1 branch February 28, 2024 18:20
@wilkinsona
Copy link
Member

This has been superseded by #40015 as we can now use the plugin's default.

@wilkinsona wilkinsona added status: superseded An issue that has been superseded by another type: task A general task and removed type: enhancement A general enhancement labels Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: superseded An issue that has been superseded by another type: task A general task
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants