Skip to content

Tool binaries (like builder) are not reproducible and break the cache #2951

@adobke

Description

@adobke

What version of rules_go are you using?

v0.28.0

What version of gazelle are you using?

v0.22.3

What version of Bazel are you using?

4.0.0

Does this issue reproduce with the latest releases of all the above?

Yes

What operating system and processor architecture are you using?

Linux, x86

Any other potentially useful information about your toolchain?

N/A

What did you do?

Between two workspaces, the builder tool is not reproducible as it includes the full goroot in the binary. This is evident when comparing the execution logs (https://docs.bazel.build/versions/main/remote-execution-caching-debug.html). Because the builder binary can be different in different workspaces, we may lose the ability to make use of remote caching. This case of non-reproducibility was already fixed in go_binary rules.

Reproduce very quickly like so:

git clone https://github.com/bazelbuild/rules_go.git rules_go1
cd rules_go1
bazel build @go_sdk//:builder
sha256sum bazel-bin/external/go_sdk/builder
# <first hash>  bazel-bin/external/go_sdk/builder

git clone https://github.com/bazelbuild/rules_go.git rules_go2
cd rules_go2
bazel build @go_sdk//:builder
sha256sum bazel-bin/external/go_sdk/builder
# <second hash>  bazel-bin/external/go_sdk/builder

What did you expect to see?

These binaries should have the same hash and should be identical

What did you see instead?

They are not

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions