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

Optimize Gradle builds by enabling local build caching #3718

Merged
merged 1 commit into from
Jun 29, 2022

Conversation

reta
Copy link
Collaborator

@reta reta commented Jun 27, 2022

Signed-off-by: Andriy Redko andriy.redko@aiven.io

Description

The Gradle build cache is a cache mechanism that aims to save time by reusing outputs produced by other builds. The build cache works by storing (locally or remotely) build outputs and allowing builds to fetch these outputs from the cache when it is determined that inputs have not changed, avoiding the expensive work of regenerating them [1].

Even when used by a single developer only, the build cache can be very useful. Gradle’s incremental build feature helps to avoid work that is already done, but once you re-execute a task, any previous results are forgotten. When you are switching branches back and forth, the local results get rebuilt over and over again, even if you are building something that has already been built before. The build cache remembers the earlier build results, and greatly reduces the need to rebuild things when they have already been built locally. [2]

[1] https://docs.gradle.org/current/userguide/build_cache.html
[2] https://docs.gradle.org/current/userguide/build_cache_use_cases.html#use_cases_cache

Issues Resolved

N/A

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@reta reta requested a review from a team as a code owner June 27, 2022 19:26
@reta reta added backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch backport 2.1 labels Jun 27, 2022
@opensearch-ci-bot
Copy link
Collaborator

❌   Gradle Check failure 4a9c83ba6a28010cac386f324e60d1405f97424e
Log 6379

Reports 6379

@opensearch-ci-bot
Copy link
Collaborator

✅   Gradle Check success 05d48456e0b514a35c312155eb8d5bd4839b3fd6
Log 6382

Reports 6382

@peterzhuamazon
Copy link
Member

@reta could you rebase on main to consume the new gradle check?
Thanks.

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

@reta could you rebase on main to consume the new gradle check?

@peterzhuamazon cryptic failure:

Run echo "https://github.com/opensearch-project/OpenSearch.git PR: 3718"
https://github.com/opensearch-project/OpenSearch.git PR: 3718
Raise from https://github.com/reta/OpenSearch.git 115f91b543c36ac332915b03f7699b8264d31836
PR Title: Optimize Gradle builds by enabling local build caching
Trigger Jenkins workflows
QUEUE_URL null
wait for jenkins to start workflow
Check if queue exist in Jenkins after triggering
Please check jenkins url for logs: 
Result: null

@peterzhuamazon
Copy link
Member

@reta could you rebase on main to consume the new gradle check?

@peterzhuamazon cryptic failure:

Run echo "https://github.com/opensearch-project/OpenSearch.git PR: 3718"
https://github.com/opensearch-project/OpenSearch.git PR: 3718
Raise from https://github.com/reta/OpenSearch.git 115f91b543c36ac332915b03f7699b8264d31836
PR Title: Optimize Gradle builds by enabling local build caching
Trigger Jenkins workflows
QUEUE_URL null
wait for jenkins to start workflow
Check if queue exist in Jenkins after triggering
Please check jenkins url for logs: 
Result: null

Hi @reta I have fixed the issue in #3728 please rebase again.
Sorry for confusion.
Thanks.

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

Hi @reta I have fixed the issue in #3728 please rebase again.
Sorry for confusion.

Thanks a lot, @peterzhuamazon , no problem at all

Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
@peterzhuamazon
Copy link
Member

@reta think failure related to this one?
#3579

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

#3579

@reta think failure related to this one? #3579

Yes, sadly flaky tests :(

@peterzhuamazon
Copy link
Member

Interesting that I just triggered a run on main and it passed.
https://build.ci.opensearch.org/job/gradle-check/31/

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

Interesting that I just triggered a run on main and it passed. https://build.ci.opensearch.org/job/gradle-check/31/

Flakiness at work ... :(

@peterzhuamazon
Copy link
Member

Lets give it a minute as I have a new PR incoming to clear up all the opensearch existing processes before using it for another run. Will rebase this PR once that is in.

Thanks.

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

Lets give it a minute as I have a new PR incoming to clear up all the opensearch existing processes before using it for another run. Will rebase this PR once that is in.

Thanks.

We public CI we have awesome visibility on the health of the builds:

image

Thanks for that, @peterzhuamazon !

@peterzhuamazon
Copy link
Member

😱 https://github.com/opensearch-project/OpenSearch/runs/7102002447?check_suite_focus=true

@reta
Copy link
Collaborator Author

reta commented Jun 28, 2022

@dblock @andrross are you good with the change folks?

Copy link
Member

@andrross andrross left a comment

Choose a reason for hiding this comment

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

Looks good to me!

Random question...does ./gradlew clean also clear this cache?

@reta
Copy link
Collaborator Author

reta commented Jun 29, 2022

Looks good to me!

Thank you!

Random question...does ./gradlew clean also clear this cache?

Aha, good one - nope! That means next build ( fe ./gradlew clean followed by ./gradlew assemble) will be very fast if nothing changed :)

@reta reta merged commit e734497 into opensearch-project:main Jun 29, 2022
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 29, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 29, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)
opensearch-trigger-bot bot pushed a commit that referenced this pull request Jun 29, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)
kartg pushed a commit that referenced this pull request Jun 29, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)

Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
kartg pushed a commit that referenced this pull request Jun 29, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)

Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
reta added a commit that referenced this pull request Jun 30, 2022
Signed-off-by: Andriy Redko <andriy.redko@aiven.io>
(cherry picked from commit e734497)

Co-authored-by: Andriy Redko <andriy.redko@aiven.io>
imRishN pushed a commit to imRishN/OpenSearch that referenced this pull request Jul 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.x Backport to 2.x branch backport 2.0 Backport to 2.0 branch backport 2.1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants