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

Cacheability improvements for thirdparty audit task #42085

Merged
merged 3 commits into from
May 15, 2019

Conversation

mark-vieira
Copy link
Contributor

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.

@mark-vieira mark-vieira added :Delivery/Build Build or test infrastructure v8.0.0 labels May 10, 2019
@mark-vieira mark-vieira requested a review from alpar-t May 10, 2019 15:56
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Member

@rjernst rjernst left a 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);
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor

@alpar-t alpar-t left a comment

Choose a reason for hiding this comment

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

LGTM

@mark-vieira mark-vieira merged commit 03e53e8 into elastic:master May 15, 2019
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request May 15, 2019
@mark-vieira mark-vieira deleted the thirdpartyaudit-build-cache branch May 15, 2019 12:12
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants