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

Improve testcluster distribution artifact handling #38933

Merged

Conversation

mark-vieira
Copy link
Contributor

This commit moves validation logic for ensuring our testclusters configuration doesn't contain unexpected artifacts into the plugin itself. This change allows us to remove the custom copy task implementation altogether.

Additionally, the error message has been improved to display component ids in addition to the artifacts to make it easier to figure out what actual dependency is at fault.

An example of the error message looks like this:

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':syncTestClustersArtifacts'.
> Dependencies with non-zip artifacts found in configuration 'testclusters': [hamcrest-core.jar (org.hamcrest:hamcrest-core:1.3), junit.jar (junit:junit:4.13-beta-2)]

This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
@mark-vieira mark-vieira added >non-issue :Delivery/Build Build or test infrastructure v8.0.0 labels Feb 14, 2019
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

@mark-vieira
Copy link
Contributor Author

@atorok I'm not sure what all version labels are appropriate here. Please add what is necessary and I'll backport as needed.

@mark-vieira
Copy link
Contributor Author

Additionally, TestClustersPluginIT failed for me locally in a way seemingly unrelated to the issue referenced on the @Ignore annotation.

https://scans.gradle.com/s/p5bai45p5ycho/tests/orjfcz7hu5lqq-eajrubpg6r7za

I had to do some hacking of the way we build the distribution dependency string to get it to work. Perhaps this is still WIP?

@alpar-t
Copy link
Contributor

alpar-t commented Feb 15, 2019

Unfortunately the tests broke while they were muted.
We'll get this back on track soon.

@alpar-t
Copy link
Contributor

alpar-t commented Feb 15, 2019

Back-port wise I find that taking the build changes all the way back makes life easier. The back-ports ( at least to changes in buildSrc ) should be straight forward since I'we been following this policy for a while.

@@ -98,7 +116,15 @@ public void apply(Project project) {
// the clusters will look for artifacts there based on the naming conventions.
// Tasks that use a cluster will add this as a dependency automatically so it's guaranteed to run early in
// the build.
rootProject.getTasks().create(SYNC_ARTIFACTS_TASK_NAME, SyncTestClustersConfiguration.class);
rootProject.getTasks().create(SYNC_ARTIFACTS_TASK_NAME, Sync.class, sync -> {
sync.from((Callable<List<FileTree>>) () ->
Copy link
Contributor

Choose a reason for hiding this comment

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

wondering why the cast is needed here

Copy link
Contributor Author

@mark-vieira mark-vieira Feb 15, 2019

Choose a reason for hiding this comment

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

CopySpec.from() simply takes Object... as an argument. Each item passed can be any of the types listed here. We can't just pass a raw lambda, as Java has now idea what SAM type to cast it to. So we have to explicitly cast it as one of the supported types. We don't have this problem in Groovy as { } returns an instance of Closure.

There's actually no real need to include the generic type arguments here, Gradle will figure this out at runtime, but its more explicit and folks reading the code immediately see what that lambda returns.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Additionally, if it's not obvious, we wrap all this in a Callable because we are iterating over a Configuration here so we can return a FileTree from each resolved artifact. Doing so causes the Configuration to be resolved (and files to be downloaded) so we want to defer this until task execution. Or in this case more specifically, during task graph calculation.

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, thanks Mark !

@mark-vieira mark-vieira merged commit ad012c8 into elastic:master Feb 15, 2019
@mark-vieira mark-vieira deleted the improved-testclusters-dependency-sync branch February 15, 2019 19:10
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Feb 15, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Feb 15, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Feb 15, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Feb 15, 2019
* master:
  Address some CCR REST test case flakiness (elastic#38975)
  Edits to text in Completion Suggester doc (elastic#38980)
  SQL: doc polishing
  [DOCS] Fixes broken formatting
  SQL: Polish the rest chapter (elastic#38971)
  Remove `nGram` and  `edgeNGram` token filter names (elastic#38911)
  Add an exception throw if waiting on transport port file fails (elastic#37574)
  Improve testcluster distribution artifact handling (elastic#38933)
  Advance max_seq_no before add operation to Lucene (elastic#38879)
  Reduce global checkpoint sync interval in disruption tests (elastic#38931)
  [test] disable packaging tests for suse boxes
  Relax testStressMaybeFlushOrRollTranslogGeneration (elastic#38918)
  [DOCS] Edits warning in put watch API (elastic#38582)
  Fix serialization bug in ShardFollowTask after cutting this class over to extend from ImmutableFollowParameters.
  [DOCS] Updates methods for upgrading machine learning (elastic#38876)
mark-vieira added a commit that referenced this pull request Feb 15, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
mark-vieira added a commit that referenced this pull request Feb 15, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
mark-vieira added a commit that referenced this pull request Feb 20, 2019
This commit moves validation logic for ensuring our testclusters
configuration doesn't contain unexpected artifacts into the plugin
itself. This change allows us to remove the custom copy task
implementation altogether.

Additionally, the error message has been improved to display component
ids in addition to the artifacts to make it easier to figure out what
actual dependency is at fault.
@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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants