moonrepo / moon

A build system and monorepo management tool for the web ecosystem, written in Rust.
https://moonrepo.dev/moon
MIT License
2.92k stars 159 forks source link

[feature] VCS datetime Tokens #1729

Open matray opened 2 days ago

matray commented 2 days ago

Is your feature request related to a problem? Please describe.

Tokens for timestamps from VCS for reproducible builds with meaningful metadata.

Describe the solution you'd like

Tokens are super useful to leverage metadata in build tasks. However, the existing date/time tokens don't allow for reproducible building. As moon already hooks in to the configured VCS, it would be nice to expose timestamps that are VCS-intelligent, like commit timestamps. This allows build tasks to be reproducible and potentially more cache-able.

To preserve the potentially useful for other reasons dateTime tokens, perhaps these are exposed with the prefix of vcs. e.g. vcsDatetime, vcsDate, vcsTime, vcsTimestamp

Describe alternatives you've considered

Right now we just leverage script blocks in commands to extract this metadata ourselves. Directly going to git works, but it's not as nice as grabbing metadata from the project.

matray commented 2 days ago

This might be an extension of https://github.com/moonrepo/moon/issues/1639, I see mentioned that token layer has no VCS intelligence at the current point in time.

matray commented 2 days ago

Oh nice! I see there's already some progress on that front coming in 1.30, incredible https://github.com/moonrepo/moon/pull/1718/

milesj commented 31 minutes ago

v1.30 is out, is $vcsRevision enough here?