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

TestClusters: Generic artifact injection for unreleased versions #41208

Closed
wants to merge 3 commits into from

Conversation

alpar-t
Copy link
Contributor

@alpar-t alpar-t commented Apr 15, 2019

This PR removes coupling between BwcVersions and testclusters.
The goal is to have TestClusters deal with released artifacts only,
with support for a map that tells it where to look for others for
the special case of our build that tests unreleased versions.

The main build script now configures this map on all testclusters from
the build.

I accidentally reformatted the main build.gradle the actual change is only at the end of the file.

This PR removes coupling between BwcVersions and testclusters.
The goal is to have TestClusters deal with released artifacts only,
with support for a map that tells it where to look for others for
the special case of our build that tests unreleased versions.

The main build script now configures this map on all testclusters from
the build.
@alpar-t alpar-t requested a review from mark-vieira April 15, 2019 16:12
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@mark-vieira mark-vieira left a comment

Choose a reason for hiding this comment

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

A few comments.

}


subprojects {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure this "decoupling" is really all that much better. I certainly think the registering of artifacts bit is better but realitically, these things are coupled, we've just moved the logic into a more obscure place.

I think the awkwardness is around how we fetch an instance of versions. I think we could really simplify this by moving this into a static method on BwcVersions. Something like getInstance(). Then we could get at this from anywhere we want without having to awkwardly get at a extra property on the root project.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making it easier to reference will just increase the coupling.
I don't see why you would think they are coupled, with the registering of the artifacts testclusters don't care at all where these are coming from and weather these were released or not, and the bits that do care moved closer together in the build script.
Also this will offer more clarity when ruining in external plugins that can only deal with released versions. I also think it makes it easier to understand and reason about what testclsuters does as it doesn't mix in related functions like dealing with unreleased artifacts.

Copy link
Contributor

Choose a reason for hiding this comment

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

My concern is that's its more difficult to reason about where test clusters is resolving these artifacts from because they are registered outside the plugin. Injection in Gradle plugins is simply awkward and there's no good solution for it. So the issue with exposing some API is that it could be called from anywhere. This is probably fine but I generally like to avoid adding more stuff to the root build.gradle which is already getting large and doesn't benefit from static compilation and type safety like stuff in buildSrc does.

@@ -194,7 +194,14 @@ if (project != rootProject) {
}

String localDownloads = "${rootProject.buildDir}/local-downloads"
// TODO: keep a single copy once we have testclusters for example plugins
Copy link
Contributor

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 follow. Why do we need two copies of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some of the tests like the example plugins still use ClusterFormationTasks , but with this change, the Version class doesn't encode -SNAPSHOT. The result is that one will look for 8.0.0 and the other for 8.0.0-SNAPSHOT in the artifact name. This won't matter once we have everything on testclusters and we can clean it up then.

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.

Can you please remove the whitespace changes from the root build.gradle? I know you mentioned this was unintentional in a comment, but I cannot figure out which changes are actually to that file.

I agree with Mark that decoupling like this seems overkill. In fact, I want to add more coupling in some ways. We need to pass extra information to these test clusters to improve the reproduce line to include the hash of what was built for that bwc version. This decoupling seems like additional abstraction that will only make that work more difficult, but not actually make the code any less coupled.

@alpar-t
Copy link
Contributor Author

alpar-t commented Apr 19, 2019

ok, I see your point on these being actually coupled, but then let's look at making this more explicit. My distaste is for how this is achieved using ext properties. I also don't like it that this part is not really testable since it requires the entire project to figure out and build bwc versions ( but this part is not solved in this PR either ).

@mark-vieira
Copy link
Contributor

I really wish Gradle's service registry stuff, or some version of it, would become public API. The ability to register global services with explicit scopes that could be injected into managed code would be great. There's great need for this and we use hacks like attaching extra properties to the root project as a way to get around this.

@alpar-t
Copy link
Contributor Author

alpar-t commented May 6, 2019

Closing this in favor of #41504

@alpar-t alpar-t closed this May 6, 2019
@alpar-t alpar-t deleted the testclusters-clear-versions branch November 11, 2019 09:41
@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 >non-issue 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