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

Make gradle build finished logic CC compatible #96475

Merged
merged 10 commits into from
Nov 10, 2023

Conversation

breskeby
Copy link
Contributor

@breskeby breskeby commented Jun 1, 2023

The buildfinished build logic in Gradle is not configuration cache. compatible. To allow CI builds running builds with configuration cache enabled we need to move away from using this API to newer APIs provided by Gradle.

Gradle Configuration Cache: https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:intro

This generally allows us to run builds with configuration cache enabled on our CI infrastructure as all builds use this build finish logic.

@breskeby breskeby self-assigned this Jun 1, 2023
@breskeby breskeby added >enhancement :Delivery/Build Build or test infrastructure Team:Delivery Meta label for Delivery team labels Jun 1, 2023
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-delivery (Team:Delivery)

@breskeby breskeby marked this pull request as draft June 1, 2023 08:17
@breskeby breskeby changed the title Make gradle build finished logic CC compatible WIP - Make gradle build finished logic CC compatible Jun 1, 2023
@quux00 quux00 added v8.11.0 and removed v8.10.0 labels Aug 16, 2023
@mattc58 mattc58 added v8.12.0 and removed v8.11.0 labels Oct 4, 2023
@breskeby breskeby added the buildkite-opt-in Opts your PR into Buildkite instead of Jenkins label Nov 1, 2023
@breskeby
Copy link
Contributor Author

breskeby commented Nov 6, 2023

related to #57918

@breskeby breskeby changed the title WIP - Make gradle build finished logic CC compatible Make gradle build finished logic CC compatible Nov 7, 2023
@breskeby breskeby requested a review from a team November 8, 2023 18:03
@breskeby breskeby marked this pull request as ready for review November 8, 2023 18:03
}
}
}
project.getPlugins().apply(ElasticsearchBuildFinishedPlugin.class)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just apply this plugin to the root project and ditch this pre-compiled script plugin altogether?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

BuildScanExtension extension = target.getExtensions().getByType(BuildScanExtension.class);
File daemonsLogDir = new File(target.getGradle().getGradleUserHomeDir(), "daemon/" + target.getGradle().getGradleVersion());

getFlowScope().always(BuildFinishedFlowAction.class, spec -> {
Copy link
Contributor

Choose a reason for hiding this comment

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

What on earth is a FlowAction and how does this equate to a "build finished"? I can't see anythere here that defines when this action runs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't get me started. That is the last half baked overly complicated gradle api that allows code executing on buildFinished. The when is declared implicitly by this line where we map the BuildWorkResult which implicitly defers this code execution till that result is available. There is currently only getFlowProviders().getBuildWorkResult() as "flow provider". It's been around for some versions now, obviously incubating but all that is available right now.

spec.getParameters().getFilteredFiles().addAll(getFlowProviders().getBuildWorkResult().map((result) -> {

Copy link
Contributor

Choose a reason for hiding this comment

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

So calling getBuildWorkResult() implicitly makes this a "build finished" hook. That's not confusing...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it is. but yes.

@breskeby breskeby merged commit 841f711 into elastic:main Nov 10, 2023
13 checks passed
breskeby added a commit to breskeby/elasticsearch that referenced this pull request Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
buildkite-opt-in Opts your PR into Buildkite instead of Jenkins :Delivery/Build Build or test infrastructure >enhancement Team:Delivery Meta label for Delivery team v8.12.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants