-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Use reproducible method of generating properties file for better caching #42539
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
Use reproducible method of generating properties file for better caching #42539
Conversation
|
Pinging @elastic/es-core-infra |
| processResources { | ||
| inputs.file(propsFile) | ||
| // We need to be explicit with the version because we add snapshot and qualifier to it based on properties | ||
| inputs.property("dynamic_elasticsearch_version", props.getProperty("elasticsearch")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we lost adding this property?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's no longer necessary as the generate task tracks all properties as an input.
properties(props) // final computed prop values are an input to generateVersionProperties task```
rjernst
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The default Java implementation of
Properties.store()is non-reproducible. First, because it stores properties internally in aHashTableso the final ordering will be non-deterministic and secondly because it injects a comment with a timestamp into the generated file. Both of these things break build cacheability since this file eventually ends up on the build classpath.Here we use Gradle's
WritePropertiestask instead which solves both issues and ensures for the same set on inputs, reproducible output will be generated.