-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Disable bwc distribution caching in master branch #46686
Merged
mark-vieira
merged 5 commits into
elastic:master
from
mark-vieira:bwc-cache-optimizations
Sep 18, 2019
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f997642
Disable bwc distribution caching in master branch
mark-vieira dd987fe
Make this more robust
mark-vieira c4877dc
Merge branch 'master' into bwc-cache-optimizations
elasticmachine e084c61
Remove unused import
mark-vieira bd00970
Add cache if condition description
mark-vieira File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 don't love the fact that we have a CI specific conditional here, but don't have any alternatives to suggest.
Maybe some generic way to turn of caching for arbitrary tasks and configure that from CI ?
Also this won't work correctly for PRs that target master, guess that's not as big of an issue because those don't write to the cache ?
It would be so great if we could come up with a solution that does not involve special casing master.
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.
Correct, it doesn't really matter. They'll still make cache requests that will miss but that's pretty minimal.
Special logic for "if I'm in CI do this" is really commonplace and I'm honestly surprised we don't have instances of this already. To me, I'd much rather have this kind of thing in the build than in CI config (that is complicated enough) and it also allows us to do this branch-specific (CI config is the same for all branches). To me the more we can push logic out of JJB and into the build we should strive to do that. It's easier to reason about, cuts down on JJB and as mentioned, allows us to do branch-specific logic which we're limited in until we move to JJBB.
My preference was to somehow base this on version information the build had but I don't think that's possible. The
7x
branch has no idea there is another newer major version that exists ahead of it.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 not so much that we do something for CI specifically that bother me, and I hear you very well on the JJb complexity, it's more how hard to find it is, and how hard it will be to reason about if we keep adding these.
It's fine if we want to configure it in the build but it would be worth to do in a way that produces an overview of what the differences are.
For example including a build script conditionally on cI and having all the configuration there with wrapped in
project(":distribution:bwc") {}
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.
Yeah, there are pros/cons to that approach as well. As if I'm looking at a particular plugin or build script, I also have to consider if there's any CI-specific config in this separate script. This approach would be predicated on use assuming there's CI-specific config at play w/ regards to any particular issue.
Personally, if I'm tracking down a build config issue I'm naturally going to go to the source of that logic. I think I'd rather have any conditionals regarding CI or otherwise to live there. Again, I've dealt with may projects with CI-specific conditionally logic in this way and it's generally not been a problem or source of confusion.
To help out here specifically I've added added a description to this
cacheIf
condition (as we really should do in all cases) which will make this specific condition very obvious in build scans.I'm not sure if I want one more place where I have to look in order to assemble the whole picture of build logic for CI. I already have to consider the build scripts/buildSrc itself, plus the
.ci
init scripts, plus whatever lives in the Jenkins job definition. Not sure having another location to look for stuff that might affect the behavior of the build will improve the situation.