-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Cacheability improvements for thirdparty audit task #42085
Cacheability improvements for thirdparty audit task #42085
Conversation
Pinging @elastic/es-core-infra |
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
|
||
// Mark successful third party audit check | ||
getSuccessMarker().getParentFile().mkdirs(); | ||
Files.write(getSuccessMarker().toPath(), new byte[]{}, StandardOpenOption.CREATE); |
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.
Wouldn't this fail on subsequent runs? I think we want the default options?
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.
I'm not sure, I think it just creates if it doesn't exist. I stole this from PrecommitTask
. I think using the default options is probably the simpler thing to do though.
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
While doing some build cache experimentation I noticed that we had already made our
ThirdPartyAuditTask
cacheable. This PR makes some improvements here:First, we no longer consider the expanded jars directory as an output. While it is technically "output" that the task creates, it's not the "result" of the task. This is just intermediary output that is created but the result of the task is effectively the error (or lack of error) thrown to the console if an issue is detected. The issue with tracking that expanded jar directory as an output is when we cache this task we pack all that up, essentially, the entire project runtime classpath. This can be quite large and negatively effects build cache performance. When we fetch this task from the cache we don't really need any of that so instead this has been refactored to use the "success marker" pattern of simply writing an empty file to the build directory to indicate this task was successful.
Second, we now use the runtime classpath normalization strategy for the
jarsToScan
. This ensures that things like jar entry order or creation timestamps don't affect the cache hash. When using@InputFiles
we do a strict byte-to-byte comparison of the files, so for archives, this can cause cache misses when the upstream archive is rebuilt, but effectively identical.