Skip to content

Set CommitDate in goreleaser archives#6658

Merged
neilalexander merged 1 commit intomainfrom
archives_timestamp
Mar 13, 2025
Merged

Set CommitDate in goreleaser archives#6658
neilalexander merged 1 commit intomainfrom
archives_timestamp

Conversation

@alexbozhenko
Copy link
Copy Markdown
Member

@alexbozhenko alexbozhenko commented Mar 12, 2025

Follow up to #6299
The modification time of LICENSE and README.md in the archive is the one when the job https://github.com/nats-io/nats-server/actions/runs/13816873025/job/38652255585 checked out the code:

wget https://github.com/nats-io/nats-server/releases/download/v2.11.0-RC.3/nats-server-v2.11.0-RC.3-linux-amd64.tar.gz
tar -xvf nats-server-v2.11.0-RC.3-linux-amd64.tar.gz
ll nats-server-v2.11.0-RC.3-linux-amd64
total 16080
drwxr-xr-x  2 alex alex      100 Mar 12 12:58 .
drwxrwxrwt 48 root root     1280 Mar 12 12:57 ..
-rw-r--r--  1 alex alex    11357 Mar 12 09:54 LICENSE
-rwxr-xr-x  1 alex alex 16442017 Mar 12 09:43 nats-server
-rw-r--r--  1 alex alex     4404 Mar 12 09:54 README.md

And that works as designed: actions/checkout#364 (comment)

Those timestamps make archive not reproducible. Fix it by setting to commitDate.

Test plan:

 touch LICENSE README.md
goreleaser  release --snapshot --clean -f .goreleaser.yml

Timestamp of all the files is the same(commit date), making archives reproducible:

tar -xvf dist/nats-server-v2.11.0-RC.3-linux-amd64.tar.gz
# ll nats-server-v2.11.0-RC.3-linux-amd64/
total 16088
drwxr-xr-x  2 alex alex     4096 Mar 12 12:53 .
drwxr-xr-x 16 alex alex     4096 Mar 12 12:53 ..
-rw-r--r--  1 alex alex    11357 Mar 12 09:43 LICENSE
-rwxr-xr-x  1 alex alex 16442017 Mar 12 09:43 nats-server
-rw-r--r--  1 alex alex     4404 Mar 12 09:43 README.md

Signed-off-by: Alex Bozhenko alex@synadia.com

Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
@alexbozhenko alexbozhenko requested a review from a team as a code owner March 12, 2025 20:12
@alexbozhenko
Copy link
Copy Markdown
Member Author

cc @neilalexander

Copy link
Copy Markdown
Member

@neilalexander neilalexander left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@neilalexander neilalexander merged commit 8b8de9f into main Mar 13, 2025
5 checks passed
@neilalexander neilalexander deleted the archives_timestamp branch March 13, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants