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

go: introduce cache key for compile actions #14661

Merged
merged 4 commits into from
Mar 2, 2022

Conversation

tdyas
Copy link
Contributor

@tdyas tdyas commented Mar 1, 2022

As described in #14625, the Go version and other compiler values that influence the output (other than input file content hashes) were not incorporated into the cache key for building a Go package. (The input files were handled by being part of the input root's Digest.) This caused issues when, for example, changing the version of the compiler where incompatible artifacts built by an earlier Go compiler were being used with an upgraded Go compiler.

The go tool handles this by incorporating "action IDs" into the "build ID" of a build product. This PR introduces a similar concept to Pants and tries to follow the go tool's algorithm as much as possible. (Links to relevant code are in comments in the code.)

[ci skip-rust]

[ci skip-build-wheels]

[ci skip-rust]

[ci skip-build-wheels]
@tdyas
Copy link
Contributor Author

tdyas commented Mar 1, 2022

Note: This PR only adds a cache key for compile actions. The cache key for link actions will be added via a separate PR.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

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

Excellent, thank you.

src/python/pants/backend/go/subsystems/golang.py Outdated Show resolved Hide resolved
src/python/pants/backend/go/subsystems/golang.py Outdated Show resolved Hide resolved
src/python/pants/backend/go/util_rules/build_pkg.py Outdated Show resolved Hide resolved
Tom Dyas added 2 commits March 1, 2022 17:22
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
[ci skip-rust]

[ci skip-build-wheels]
@tdyas tdyas merged commit 7e220df into pantsbuild:main Mar 2, 2022
@tdyas tdyas deleted the golang_cache_key_improvements branch March 2, 2022 00:01
Eric-Arellano pushed a commit to Eric-Arellano/pants that referenced this pull request Mar 2, 2022
As described in pantsbuild#14625, the Go version and other compiler values that influence the output (other than input file content hashes) were not incorporated into the cache key for building a Go package. (The input files were handled by being part of the input root's `Digest`.) This caused issues when, for example, changing the version of the compiler where incompatible artifacts built by an earlier Go compiler were being used with an upgraded Go compiler.

The `go` tool handles this by incorporating "action IDs" into the "build ID" of a build product. This PR introduces a similar concept to Pants and tries to follow the `go` tool's algorithm as much as possible. (Links to relevant code are in comments in the code.)

[ci skip-rust]

[ci skip-build-wheels]
Eric-Arellano added a commit that referenced this pull request Mar 2, 2022
…14672)

As described in #14625, the Go version and other compiler values that influence the output (other than input file content hashes) were not incorporated into the cache key for building a Go package. (The input files were handled by being part of the input root's `Digest`.) This caused issues when, for example, changing the version of the compiler where incompatible artifacts built by an earlier Go compiler were being used with an upgraded Go compiler.

The `go` tool handles this by incorporating "action IDs" into the "build ID" of a build product. This PR introduces a similar concept to Pants and tries to follow the `go` tool's algorithm as much as possible. (Links to relevant code are in comments in the code.)

[ci skip-rust]

[ci skip-build-wheels]

Co-authored-by: Tom Dyas <tdyas@toolchain.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