Skip to content

make .tar.gz file metadata reproducible#6701

Merged
neilalexander merged 1 commit intomainfrom
more_reproducible_build_tweaks
Apr 7, 2025
Merged

make .tar.gz file metadata reproducible#6701
neilalexander merged 1 commit intomainfrom
more_reproducible_build_tweaks

Conversation

@alexbozhenko
Copy link
Copy Markdown
Member

Make contents of the archive to be owned by root, so archives have same shasum, no matter which user runs the build.
https://www.gnu.org/software/tar/manual/html_node/Reproducibility.html

Test plan

Before

Built 2.11.0 tag locally with:
# go clean -cache && goreleaser release --skip=announce,publish,validate --clean -f .goreleaser.yml
File permissions in the archive are different, reported by https://diffoscope.org/:

# docker run --rm -t -w $(pwd) -v $(pwd):$(pwd):ro       registry.salsa.debian.org/reproducible-builds/diffoscope nats_server_gh_assets/2.11.0/nats-server-v2.11.0-linux-amd64.tar.gz nats-server/dist/nats-server-v2.11.0-linux-amd64.tar.gz
--- nats_server_gh_assets/2.11.0/nats-server-v2.11.0-linux-amd64.tar.gz
+++ nats-server/dist/nats-server-v2.11.0-linux-amd64.tar.gz
├── nats-server-v2.11.0-linux-amd64.tar
│ ├── file list
│ │ @@ -1,3 +1,3 @@
│ │ --rw-r--r--   0 runner    (1001) docker     (118)    11357 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/LICENSE
│ │ --rw-r--r--   0 runner    (1001) docker     (118)     4404 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/README.md
│ │ --rwxr-xr-x   0 runner    (1001) docker     (118) 16442017 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/nats-server
│ │ +-rw-r--r--   0 alex      (1000) alex      (1000)    11357 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/LICENSE
│ │ +-rw-r--r--   0 alex      (1000) alex      (1000)     4404 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/README.md
│ │ +-rwxr-xr-x   0 alex      (1000) alex      (1000) 16442017 2025-03-19 15:28:05.000000 nats-server-v2.11.0-linux-amd64/nats-server

After:
Tar content owned by root:root
image

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 20, 2025 18:57
@alexbozhenko
Copy link
Copy Markdown
Member Author

@neilalexander could you please review when you get a chance?

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

@neilalexander neilalexander merged commit aaf1ac8 into main Apr 7, 2025
37 checks passed
@neilalexander neilalexander deleted the more_reproducible_build_tweaks branch April 7, 2025 10:22
neilalexander added a commit that referenced this pull request Sep 16, 2025
Follow-up to #6359 and
#6701

Since 2.11.2 version of goreleaser, it is allowed to set buildhost for
RPMs
https://github.com/orgs/goreleaser/discussions/5662

I believe with this all the rpms, debs and tars will be reproducible(the
binaries have been reproducible for long time)

## Test plan:
```
# go clean -cache && goreleaser  release --skip=announce,publish,validate --clean -f .goreleaser.yml
```

```
# rpm -qip nats-server-v2.12.0-RC.3-s390x.rpm | grep -i 'Build Host'

Build Host  : synadia.com
```

[skip ci]

Signed-off-by: Alex Bozhenko <alexbozhenko@gmail.com>
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.

2 participants