Commit Graph

1966 Commits

Author SHA1 Message Date
Mark Vieira a58117cf0c
Simplify log handling of test clusters (#68333) 2021-02-03 10:32:33 -08:00
Mark Vieira a92a647b9f Update sources with new SSPL+Elastic-2.0 license headers
As per the new licensing change for Elasticsearch and Kibana this commit
moves existing Apache 2.0 licensed source code to the new dual license
SSPL+Elastic license 2.0. In addition, existing x-pack code now uses
the new version 2.0 of the Elastic license. Full changes include:

 - Updating LICENSE and NOTICE files throughout the code base, as well
   as those packaged in our published artifacts
 - Update IDE integration to now use the new license header on newly
   created source files
 - Remove references to the "OSS" distribution from our documentation
 - Update build time verification checks to no longer allow Apache 2.0
   license header in Elasticsearch source code
 - Replace all existing Apache 2.0 license headers for non-xpack code
   with updated header (vendored code with Apache 2.0 headers obviously
   remains the same).
 - Replace all Elastic license 1.0 headers with new 2.0 header in xpack.
2021-02-02 16:10:53 -08:00
Nik Everett a5f3787be4
It's flame graph time! (#68312)
Upgrade JMH to latest (1.26) to pick up its async profiler integration
and update the documentation to include instructions to running the
async profiler and making pretty pretty flame graphs.
2021-02-02 11:11:16 -05:00
Rafael Acevedo aa672daf65
Update gradle wrapper to 6.8.1 (#68206)
Update gradle wrapper to 6.8.1
2021-02-02 10:30:03 +01:00
Jake Landis 0d404f3207
gradle rest resources plugin clean up (#68174)
This commit cleans up some of the rest resources to honor best practices.

These changes include:
* remove SourceSet from copy api/test tasks and move the logic to the plugin.
  * this allows the tasks talk in simpler terms in File and FileCollections.
* prefer constructor injection over method injection for gradle components
* rename tasks to better match usage:
   * copyRestApiCompatSpecsTask -> copyRestCompatApiTask
   * copyRestApiCompatTestTask -> copyRestCompatTestTask
* remove no longer valid TODO's
2021-02-01 12:13:03 -06:00
Nik Everett c5f0da6ff4 Drop unused checkstyle suppressions
These suppressions no longer do anything because the files they point to
have resolved their line length issues.
2021-02-01 10:37:23 -05:00
Ignacio Vera 747773d5af
Upgrade to Lucene 8.8.0 (#68272) 2021-02-01 13:36:03 +01:00
Jake Landis 3d2f6a4d24
Introduce `RestCompatTestTransformTask` (#68028)
Introduce RestCompatTestTransformTask to execute in transformations
needed for REST compatibility testing.

This new task is part of the execution graph for yamlRestCompatTest
such that when that task is run it now copy the bwc:minor rest
tests to an intermediate location (e.g. build/resources/yamlRestCompatTest/v7restTests/rest-api-spec/test)
Then this new task will read from that location, transform the tests as
necessary and output to the location that test runner expects
(e.g. build/resources/yamlRestCompatTest/rest-api-spec/test)

Currently only the compatibility headers are injected via the
transformation(s), but future additional transformations are possible and this
commit contains only the gradle hooks needed to ensure that all transforms are
executed and result in the correct location on disk for the test runner.
2021-01-29 09:10:50 -06:00
Rene Groeschke d31ad457c8
Fix jdk download plugin to handle extracting azul jdks (#68127)
* Fix jdk download plugin to handle extracting azul jdks

Unpacking transformation of azul packaged jdks have been broken due to
a different packaging structure not handled correctly by the JdkDownloadPlugin

This fixes this and also fixes the packaging of aarch64 jdks into elasticsearch with
jdk distros
2021-01-29 09:22:14 +01:00
Rene Groeschke bcc58f8e0e
Simplify non transitive setup on sourceSet configs (#68095)
This simplifies how transitive dependency resolution for configurations linked to sourceSets
is configured.

A follow up on https://github.com/elastic/elasticsearch/pull/68019
2021-01-29 09:18:46 +01:00
Rory Hunter 5def285693 Relax checkstyle javadoc check for @Inject annotation 2021-01-28 10:26:21 +00:00
Mark Vieira 490293719c
Ensure consistent disabling of transitive dependency resolution (#68019) 2021-01-26 13:11:52 -08:00
Rory Hunter ad1f876daa
Replace NOT operator with explicit `false` check (#67817)
We have an in-house rule to compare explicitly against `false` instead
of using the logical not operator (`!`). However, this hasn't
historically been enforced, meaning that there are many violations in
the source at present.

We now have a Checkstyle rule that can detect these cases, but before we
can turn it on, we need to fix the existing violations. This is being
done over a series of PRs, since there are a lot to fix.
2021-01-26 14:47:09 +00:00
Rene Groeschke 029e094234
Update build tools dependencies (#67703) 2021-01-25 09:31:44 +01:00
Rory Hunter 44fc9d2532 Checkstyle: Don't require Javadoc on JUnit lifecycle methods 2021-01-21 16:58:32 +00:00
Jake Landis 880f850185
Move yamlRestCompatTest plugin to internal and add a new lifecycle (#67394)
This commit moves the yamlRestCompatTest plugin to an internal package
since this plugin is use for the internal build only (ie not plugin devs).

Since there was considerable use of package private class members directly, 
getters/setters have been added and the class members moved to private scope.

This commit also adds a lifecycle to help abstract the execution of the
concept of rest compatibility testing from the current (and only) task. 
This allows this lifecycle task to be added to CI (if needed) and other 
tasks added (if needed) without needing to change the CI setup.
2021-01-21 07:57:07 -06:00
Rory Hunter 82fdec110a
Add extra checkstyle checks in an IDE (#67650)
Now that Checkstyle can be made useful in an IDE, add extra rules only when
checking in the IDE so that a contributor is given extra help when editing
files, without having the checkstyle task spam the console when running gradle.

Apart from the `BooleanNegation` rule below, the new rules have the `warning`
severity level. The new Javadoc rules reflect the guidelines in
`CONTRIBUTING.md` that we've had for some time.

   * I upgraded Checkstyle, so now it interprets the config file in the same was
     as the IntelliJ plugin. That means that I could move the `LineLength` rule
     up a level and remove its special handling in the `:configureIdeCheckstyle`
     task
   * I added the `SuppressWarningsFilter` and `SuppressWarningsHolder` rules so
     that the `@SuppressWarnings` annotation can be used to silence Checkstyle
     checks. We shouldn't typically need this, but it seemed like a useful thing
     to configure. In contrast to the suppressions file, this approach makes the
     suppression obvious.
   * I changed the `:configureIdeCheckstyle` task to pull in rules from
     `checkstyle_ide_fragment.xml` and merged them into the generated config.
     The rules are as follows:
      * `BooleanNegation` - a task defined using `DescendantToken` that detects
        cases of `!` being used negate a boolean expression. This ought to be in
        the main config, but at present we have a number of violations in the
        source
      * `MissingJavadocMethod` - requires that public methods are documented. I
        set `minLineCount` to 2 so that the rule doesn't trigger on simple
        methods.
      * `MissingJavadocPackage` - require Javadoc in `package-info.java`
      * `MissingJavadocType` - require types to be documented
      * `JavadocMethod` - require params and return type to be documeted
2021-01-21 09:39:04 +00:00
Dimitris Athanasiou cdcc2d5e7e
Add missing space in installing modules log message (#67593)
Adds a missing space in the "Installing x modules" log
message that appears on node startup.
2021-01-20 22:01:19 +02:00
Jake Landis bc3838f29b
Introduce functional tests for new REST test plugins (#64186)
This commit introduces 3 new Gradle plugin functional tests.
These tests make use of dummy subprojects to help satisfy the
inter dependencies of the projects in use. Helper methods
have been added to a new shared common parent.
2021-01-20 13:33:54 -06:00
Jake Landis e3dc69b3a3
Introduce REST test transformations (#67268)
This commit introduces the ability to programmatically transform YAML
based REST tests. Specifically this initial commit introduces the 
ability to inject HTTP headers into the YAML REST tests. Additional 
capabilities (transforms) will be introduced in future commits.

Transforming REST tests is a key component to test REST API compatibility. 
Eventually (not included here) the ability to transform tests will be 
integrated with Gradle such that the tests that are transformed prior 
to being executed. This commit does not have any REST API compatibility 
specific changes, and only introduces the code that will be used for that 
testing.

Transforming REST tests at the YAML level was chosen over updating the 
test runners to ensure that these tests may (at a future time) be used 
by the various clients that re-use the YAML based REST tests. By 
transforming the tests themselves, there is a consistent view across all 
runners for exactly how and what to test when running N-1 tests against 
a N cluster with REST compatibility.
2021-01-19 09:48:30 -06:00
Jim Ferenczi e77c523bd9
Upgrade to a new lucene 8.8.0 snapshot (#67691)
This change upgrades to the latest Lucene 8.8.0 snapshot.
It also restores the compression on binary doc values that was lost in the last snapshot upgrade.
The compression is now configurable on binary doc values but we don't expose this functionality yet so this commit ensures that we pick the same compression mode as previous releases (BEST_COMPRESSION).
2021-01-19 13:33:19 +01:00
Mark Vieira ed66192598
Move Java source into appropriate source set (#67483) 2021-01-15 10:48:27 -08:00
Mark Vieira 3798d7ef46 Bump minimum compile jdk version to 15 (#67126)
(cherry picked from commit c7623e63c8)
2021-01-14 12:29:22 -08:00
Ioannis Kakavas 1c56c4049a
Allow test-with-ssl-plugin to be used in FIPS (#66554)
Selectively use PEM files instead of keystores so that the plugin
can be applied to projects even if these would run in fips mode
2021-01-14 15:22:07 +02:00
Benjamin Trent 5cf569ffff
[ML] move find file structure finder in Rest high Level client to its new endpoint and plugin (#67290)
Find file structure finder is now its own plugin, and separated from the ml plugin.

This commit updates the rest high level client to reflect this.

Additionally, this adjusts the internal and client object names from `FileStructure` to the more general `TextStructure`
2021-01-14 08:16:52 -05:00
Rene Groeschke bf57e1ee60
Allow Current JDK as valid installation without requiring ENV setup (#67411)
Co-authored-by: Mark Vieira <portugee@gmail.com>
2021-01-13 14:31:56 -08:00
Rene Groeschke e2ee9bcfe3
Fix runtime jdk vendor detection used in fips.gradle (#67417) 2021-01-13 14:20:59 +01:00
Rene Groeschke a8757f9efe
Update build to use gradle wrapper 6.8 (#65596)
- Updates our build to use the latest Gradle 6.8 release which is the last release 
before the major 7.0 release. 
- Resolve available gradle versions using built-in toolchain support
- Fixes deprecated usage of JavaInstallationRegistry
- We replace jdk handling in our build to rely on jvm detection provided by the gradle build tool itself. 
As we rely on environment variables pointing to jdks we wire this into the gradle jdk detection mechanism
2021-01-12 11:38:29 +01:00
Ignacio Vera 604ee06a3b
Upgrade to lucene-8.8-snapshot-f73f6b1 (#67228) 2021-01-12 08:03:00 +01:00
Mark Vieira 54f66bda11 Revert "Bump minimum compile jdk version to 15 (#67126)"
This reverts commit c7623e63c8.
2021-01-11 08:24:21 -08:00
Mark Vieira c7623e63c8
Bump minimum compile jdk version to 15 (#67126) 2021-01-11 08:23:56 -08:00
Rory Hunter 7540259d99
First attempt at running on darwin aarch64 (#67103)
This PR is a first attempt to get the build to run on an Apple M1 (ARM 64 / aarch64) machine.
I think the changes are mostly reasonable, apart from some hard-coding to use the Azul JVM,
which at the time of writing seems to be the only available JVM. I'll follow up when our preferred
JVM is available.
2021-01-11 14:10:10 +00:00
Mark Vieira e5be708374
Register a test cluster so plugin project "run" tasks continue to work (#66647) 2021-01-07 11:10:57 -08:00
Jason Tedor e31f72e906
Update to jimfs 1.2 (#67120)
A new version of this test dependency is finally available, enabling us
to remove a hack from production code we've long carried because of a
bug in that test dependency. This commit upgrades our tests to use
jimfs-1.2.
2021-01-06 15:07:06 -05:00
Yang Wang bd2fad609a
Support running FIPS tests with Oracle JVM (#66912)
This PR conditionally allow SunRsaSign to be used as a security provider when
the runtime java is an implementation by Oracle. It is necessary because:

* Oracle JVM mandates Security Provider verification 
* The verification class (javax.crypto.JarVerifier) uses hardcoded certificates 
  with md5WithRsa signature.
2021-01-05 09:16:47 +11:00
Ioannis Kakavas bd873698bc
Ensure CI is run in FIPS 140 approved only mode (#64024)
We were depending on the BouncyCastle FIPS own mechanics to set
itself in approved only mode since we run with the Security
Manager enabled. The check during startup seems to happen before we
set our restrictive SecurityManager though in
org.elasticsearch.bootstrap.Elasticsearch , and this means that
BCFIPS would not be in approved only mode, unless explicitly
configured so.

This commit sets the appropriate JVM property to explicitly set
BCFIPS in approved only mode in CI and adds tests to ensure that we
will be running with BCFIPS in approved only mode when we expect to.
It also sets xpack.security.fips_mode.enabled to true for all test clusters
used in fips mode and sets the distribution to the default one. It adds a
password to the elasticsearch keystore for all test clusters that run in fips
mode.
Moreover, it changes a few unit tests where we would use bcrypt even in
FIPS 140 mode. These would still pass since we are bundling our own
bcrypt implementation, but are now changed to use FIPS 140 approved
algorithms instead for better coverage.

It also addresses a number of tests that would fail in approved only mode
Mainly:

    Tests that use PBKDF2 with a password less than 112 bits (14char). We
    elected to change the passwords used everywhere to be at least 14
    characters long instead of mandating
    the use of pbkdf2_stretch because both pbkdf2 and
    pbkdf2_stretch are supported and allowed in fips mode and it makes sense
    to test with both. We could possibly figure out the password algorithm used
    for each test and adjust password length accordingly only for pbkdf2 but
    there is little value in that. It's good practice to use strong passwords so if
    our docs and tests use longer passwords, then it's for the best. The approach
    is brittle as there is no guarantee that the next test that will be added won't
    use a short password, so we add some testing documentation too.
    This leaves us with a possible coverage gap since we do support passwords
    as short as 6 characters but we only test with > 14 chars but the
    validation itself was not tested even before. Tests can be added in a followup,
    outside of fips related context.

    Tests that use a PKCS12 keystore and were not already muted.

    Tests that depend on running test clusters with a basic license or
    using the OSS distribution as FIPS 140 support is not available in
    neither of these.

Finally, it adds some information around FIPS 140 testing in our testing
documentation reference so that developers can hopefully keep in
mind fips 140 related intricacies when writing/changing docs.
2020-12-23 21:00:49 +02:00
Rene Groeschke d0c7c65dd9
Ensure we verify versioned dir for es bwc builds (#66590)
Update according integ tests
2020-12-21 09:05:40 +01:00
Rene Groeschke 09727ac411
Fix test assertion on in buildtools for windows (#66513) 2020-12-17 13:59:51 +01:00
Rene Groeschke 5f219b3eee
Avoid building ES archives for bwc nested builds (#66342)
Certain BWC tests rely on elasticsearch distributions build from source.
So far this was done by building an ES archive in a nested build ( e.g. see
https://gradle-enterprise.elastic.co/s/e7jb5w2dyi7oy/timeline?details=potxx3gikoxci )
and then the consuming build extracted that archive immediately before running tests
against that distribution.

This change closes the loop on consuming extract only configurations that were introduced in
an earlier PR (#63599) which results in saving us building
the elasticsearch tars and zips in the nested builds which reduces the overhead drastically
new nested build without archive building:
https://gradle-enterprise.elastic.co/s/xa56zkpa6awhw/timeline?details=qjvevbdhsjooy

Most of the changed files are integTest related to have a proper reflection of how we handle 
older versions that do not support directly access extracted assemble.

Fixes #62115
2020-12-17 09:59:29 +01:00
Rene Groeschke 790f2b39f6
Adjust port ranges for tests and test fixtures (#66470)
* Adjust port ranges for tests and test fixtures
* Do not use general ephermal port range
2020-12-17 08:35:23 +01:00
Mark Vieira 87a15ede4c
Use Gradle-approved exception message prefix for json validation tasks (#66420) 2020-12-16 12:02:50 -08:00
Rene Groeschke cf18382907
Fix build tools integ tests on windows
- deal better with space in paths on windows
- Fixes #66372
2020-12-16 18:30:25 +01:00
Rene Groeschke d5f1bbf9ef
Allow dynamic port allocation for hdfs fixture (#66440)
Running multiple hdfs fixtures in parallel for running integration tests requires
a dynamic port assignment in order to avoid port clashes. This introduces
the ability to assign port ranges to gradle projects that can be used
to allocate dynamically ports used by these projects.

We apply this dynamic port setup for hdfs fixtures used in
:x-pack:plugin:searchable-snapshots:qa only at the moment as
tests sources (rest tests) in :plugins:repository-hdfs still rely on
hard coded ports.

This is a simplified version of fixtures I created before on the gradle codebase
to deal with similar issues.

Fixes #66377
2020-12-16 15:59:33 +01:00
Mark Vieira 87fafc79c5
Use the build JVM for executing third party audit checks (#66379) 2020-12-15 11:30:53 -08:00
Rene Groeschke ebbe8cab2f
Always finalize AntFixture by AntStopTask
- applies a more strict finalize rule for any antfixture executed in the build
- Related to #66377
2020-12-15 19:03:03 +01:00
Rene Groeschke 2c83c93e1f
Add debug info and potential fix for failing build tools test
- related to #66372
2020-12-15 19:03:02 +01:00
Francisco Fernández Castaño fd1d282ba9
Upgrade Azure repository SDK to v12 (#65140)
Upgrade Azure repository to the latest non blocking Azure SDK.

Closes https://github.com/elastic/elasticsearch/issues/43309

Co-authored-by: Ryan Ernst <ryan@iernst.net>
2020-12-15 11:39:06 +01:00
Rene Groeschke defaa93902
Avoid tasks materialized during configuration phase (#65922)
* Avoid tasks materialized during configuration phase
* Fix RestTestFromSnippet testRoot setup
2020-12-12 16:14:17 +01:00
Rory Hunter 68b5465575
Make it possible to use Stack logging in Docker (#65778)
Closes #62758.

Include the Stack log4j config in the Docker image, in order to
make it possible to write logs in a container environment in the
same way as for an archive or package deployment. This is useful
in situations where the user is bind-mounting the logs directory
and has their own arrangements for log shipping.

To use stack logging, set the environment variable `ES_LOG_STYLE`
to `file`. It can also be set to `console`, which is the same as
not specifying it at all.

The Docker logging config is now auto-generated at image build time,
by running the default config through a transformer program when
preparing the distribution in an image builder step.

Also, in the docker distribution `build.gradle`, I changed a helper
closure into a class with a static method in order to fix an
issue where the Docker image was always being rebuilt, even when
there were no changes.
2020-12-10 12:25:47 +00:00
Rene Groeschke 0911d04467
Make AntFixture handling task provider api compliant (#65832)
This tweaks the AntFixture handling to make it compliant with the task avoidance api.
Tasks of type StandaloneRestTestTask are now generally finalised by using the typed ant stop task
which allows us to remove of errorprone dependsOn overrides in StandaloneRestTestTask. As a result
we also ported more task definitions in the build to task avoidance api.

Next work item regarding AntFixture handling is porting AntFixture to a plain Gradle task and remove
Groovy AntBuilder will allow us to port more build logic from Groovy to Java but is out of the scope of
This PR.
2020-12-08 13:07:36 +01:00