Commit graph

195 commits

Author SHA1 Message Date
Mark Vieira
f236efc1d5
Convert remaining plugin projects to new test clusters framework (#125626) (#125726)
(cherry picked from commit 930b4ab995)

# Conflicts:
#	plugins/discovery-azure-classic/build.gradle
#	plugins/discovery-gce/qa/gce/build.gradle
2025-03-27 09:41:37 +11:00
Ryan Ernst
eee3e1d686
Add --with-plugins to run task (#125468) (#125522)
This commit adds a new command line option to the run task to include
plugins. The option takes in a comma separated list of plugins from the
plugins directory. For example:
```
./gradlew run --with-plugins=analysis-icu,analysis-nori
```
2025-03-25 05:53:27 +11:00
Rene Groeschke
963515b155
Update Gradle Enterprise Plugin (Develocity) to 3.19.2 (#125137) (#125246)
with develocity updated to 2024.3.4 we are unblocked on updating the gradle enterprise plugin
2025-03-20 06:26:10 +11:00
Lorenzo Dematté
0d15294d86
[8.18] Permanently switch from SecurityManager to Entitlements (#124865) (#125073)
* Permanently switch from SecurityManager to Entitlements (#124865)

The JDK team has completely disabled the Java SecurityManager from Java 24. Elasticsearch has always used the Java SecurityManager as an additional protection mechanism; in order to retain this second line of defense, the Elasticsearch Core/Infra team has been working on the Entitlements project.

Similar to SecurityManager, Entitlements only allow calling specific methods in the JDK when the caller has a matching policy attached. In other words, if some code (in the main Elasticsearch codebase, in a plugin/module, or in a script) attempts to perform a "privileged" operation and it is not entitled to do so, a NotEntitledException will be thrown.

This PR includes the minimal set of changes to always use Entitlements, regardless of system properties or Java version.

Relates to ES-10921

* Update changelog
2025-03-18 21:19:51 +11:00
Mark Vieira
e79ad5e669
[8.18] Filter module-info.class from entitlements-bridge jar in distribution (#124580) (#124599) 2025-03-12 12:01:42 -07:00
Mariusz Józala
6a560f7b3e
[Tests] Fix copying files for test cluster (#124628) (#124656)
In case when file with `.attach_pid` in name was stored in distribution
and then deleted, the exception could stop copying/linking files
without any sign of issue. The files were then missing in the cluster
used in the test causing them sometimes to fail (depending on which
files haven't been copied).

When using `Files.walk` it is impossible to catch the IOException and
continue walking through files conditionally. It has been replaced with
FileVisitor implementation to be able to continue if the exception is
caused by files left temporarily by JVM but no longer available.
2025-03-13 03:31:55 +11:00
Rene Groeschke
51190c7920
[BUILD] Rework build cache authentication on CI (#122296) (#122618)
This is required to update to newer version of gradle enterprise and the gradle enterprise plugin.

(cherry picked from commit 9c19538c06)

# Conflicts:
#	.ci/init.gradle
2025-02-28 04:38:25 +11:00
Rene Groeschke
38f5207f3d
[8.x] [Gradle] Make rolling upgrade tests configuration cache compatible (#119577) (#120315)
* [Gradle] Make rolling upgrade tests configuration cache compatible (#119577)

With this, all rolling upgrade tests that involve a
`nextNodeToNextVersion` update are gradle configuration cache
compatible.

Simplify API around test cluster registry and cc compatible usage of
test cluster in TestClusterAware tasks.

(cherry picked from commit 7b6bdfa323)

# Conflicts:
#	qa/ccs-rolling-upgrade-remote-cluster/build.gradle
#	x-pack/plugin/sql/qa/jdbc/security/build.gradle
#	x-pack/plugin/sql/qa/server/security/build.gradle

* Fix backport merge issue
2025-01-30 04:15:33 +11:00
Ryan Ernst
940ad90304
Do not try to enable SecurityManager on JDK 24 (#117999) (#119975)
* Do not try to enable SecurityManager on JDK 24 (#117999)

* cleanup

* [CI] Auto commit changes from spotless

* more

* [CI] Auto commit changes from spotless

---------

Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-01-11 07:09:15 +11:00
Mark Vieira
f424dd1372
Include full stacktrace in gradle functional test failures (#119900) (#119903) 2025-01-10 09:51:02 +11:00
Rene Groeschke
6b7cd0339e
Update Gradle wrapper to 8.12 (#118683) (#119363)
This updates the gradle wrapper to 8.12

We addressed deprecation warnings due to the update that includes:

- Fix change in TestOutputEvent api
- Fix deprecation in groovy syntax
- Use latest ospackage plugin containing our fix
- Remove project usages at execution time
- Fix deprecated project references in repository-old-versions

(cherry picked from commit ba61f8c7f7)
2024-12-31 08:36:31 +01:00
Rene Groeschke
d000f0fca9
[Build] Make test cluster plugin configuration cache compatible (#116890) (#119365)
This adds infrastructure to make the legacy test cluster plugin and
the legacy test cluster based test plugins generally configuration cache compatible.

(cherry picked from commit 8c20ac5884)

# Conflicts:
#	qa/mixed-cluster/build.gradle
2024-12-31 06:11:13 +11:00
Rene Groeschke
28f60f78ba
[8.x] [Build] Fix Concurrency issue in buildparams access (#117552) (#119278)
* [Build] Fix Concurrency issue in buildparams access (#117552)

Also provide caching support for buildparams provider
* Extract BuildParameterExtension public api into interface
* Make tests better readable
* Fix test flakyness

(cherry picked from commit 1b4f5eb36d)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java

* Ignore BuildParameterExtensionSpec for now

* Ignore BuildParameterExtensionSpec for now
2024-12-30 15:29:47 +01:00
Mark Vieira
c5d3799af1
Update BWC version logic to support multiple bugfix versions (#117943) (#118116)
(cherry picked from commit 7070e95fa7)

# Conflicts:
#	.buildkite/pipelines/intake.yml
#	.buildkite/pipelines/periodic.yml
#	.ci/snapshotBwcVersions
#	build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPluginFuncTest.groovy
#	build-tools-internal/src/integTest/groovy/org/elasticsearch/gradle/internal/test/rest/LegacyYamlRestCompatTestPluginFuncTest.groovy
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BwcVersions.java
#	build-tools-internal/src/test/groovy/org/elasticsearch/gradle/internal/BwcVersionsSpec.groovy
2024-12-06 09:53:35 +11:00
Mark Vieira
452a1ff8c8
Increase test cluster node startup timeout (#117603) (#117605) 2024-11-27 11:21:10 +11:00
Rene Groeschke
617644f781
[8.x] [Gradle] Remove static use of BuildParams (#115122) (#117436)
* [Gradle] Remove static use of BuildParams (#115122)

Static fields dont do well in Gradle with configuration cache enabled.

- Use buildParams extension in build scripts
- Keep BuildParams.ci for now for easy serverless migration
-  Tweak testing doc

(cherry picked from commit 13c8aaeffa)

# Conflicts:
#	TESTING.asciidoc
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/RestTestBasePlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/AbstractYamlRestCompatTestPlugin.java
#	build.gradle
#	modules/ingest-geoip/qa/full-cluster-restart/build.gradle
#	qa/mixed-cluster/build.gradle
#	x-pack/plugin/ent-search/qa/full-cluster-restart/build.gradle
#	x-pack/plugin/eql/qa/rest/build.gradle
#	x-pack/plugin/fleet/qa/rest/build.gradle
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/mapper-unsigned-long/build.gradle
#	x-pack/plugin/ml/qa/multi-cluster-tests-with-security/build.gradle
#	x-pack/plugin/security/qa/multi-cluster/build.gradle
#	x-pack/plugin/sql/qa/jdbc/build.gradle
#	x-pack/plugin/transform/qa/multi-cluster-tests-with-security/build.gradle

* fix merge issue

* Fix more merge conflicts

* Fix merge conflicts

* Update TESTING.asciidoc
2024-11-25 18:28:51 +01:00
Rene Groeschke
b974020a7f
[Build] Update Gradle wrapper to 8.11.1 (#115886) (#117386)
replace deprecated gradle api

fix permission api usage in debian and rpm package creation
remove deprecated usage of #ProjectDependency..getDependencyProject()
improves gradle configuration cache reading in our weekly benchmark by almost 30%
2024-11-25 02:25:30 +11:00
Rene Groeschke
28b2f5248f
[Gradle] Update shadow plugin (#116826) (#116876)
- The shadow plugin has changed ownership and plugin id.
- Make some formatting of poms more reproducible

(cherry picked from commit def490ef85)
2024-11-16 15:06:40 +01:00
Patrick Doyle
37edf70bda
Backport entitlement work up to #116473 to 8.x (#116613)
* Add initial entitlement policy parsing (#114448)

This change adds entitlement policy parsing with the following design:
* YAML file for readability and re-use of our x-content parsers
* hierarchical structure to group entitlements under a single scope
* no general entitlements without a scope or for the entire project

* Avoid double instrumentation via class annotation (#115398)

* Move entitlement jars to libs (#115883)

The distribution tools are meant to be CLIs. This commit moves the
entitlements jar projects to the libs dir, under a single
libs/entitlement root directory to keep the related jars together.

* Entitlement tools: SecurityManager scanner (#116020)

* Dynamic entitlement agent (#116125)

* Refactor: treat "maybe" JVM options uniformly

* WIP

* Get entitlement running with bridge all the way through, with qualified
exports

* Cosmetic changes to SystemJvmOptions

* Disable entitlements by default

* Bridge module comments

* Fixup forbidden APIs

* spotless

* Rename EntitlementChecker

* Fixup InstrumenterTests

* exclude recursive dep

* Fix some compliance stuff

* Rename asm-provider

* Stop using bridge in InstrumenterTests

* Generalize readme for asm-provider

* InstrumenterTests doesn't need EntitlementCheckerHandle

* Better javadoc

* Call parseBoolean

* Add entitlement to internal module list

* Docs as requested by Lorenzo

* Changes from Jack

* Rename ElasticsearchEntitlementChecker

* Remove logging javadoc

* exportInitializationToAgent should reference EntitlementInitialization, not EntitlementBootstrap.

They're currently in the same module, but if that ever changes, this code would have become wrong.

* Some suggestions from Mark

---------

Co-authored-by: Ryan Ernst <ryan@iernst.net>

* Remove unused EntitlementInternals (#116473)

* Revert "Entitlement tools: SecurityManager scanner (#116020)"

This reverts commit 023fb663de.

---------

Co-authored-by: Jack Conradson <osjdconrad@gmail.com>
Co-authored-by: Lorenzo Dematté <lorenzo.dematte@elastic.co>
Co-authored-by: Ryan Ernst <ryan@iernst.net>
2024-11-13 05:36:55 +11:00
Mariusz Józala
11fa0520b1
[8.x] [TEST] Migrated REST tests extending JsonLogsIntegTestCase (#115188) (#116025)
* [TEST] Migrated REST tests extending JsonLogsIntegTestCase (#115188)

REST tests extending JsonLogsIntegTestCase migrated to the new REST
testing framework, using 'elasticsearch.internal-java-rest-test' Gradle
plugin
Explicit handling of test single-cluster config by checking if cluster
is explicitly configured as single-node to avoid an incorrect configuration
which may cause split brain.

Replaced `ElasticsearchJavaPlugin` with `ElasticsearchJavaBasePlugin` in
 `RestTestBasePlugin` for better granularity.
Additionally, updated the `DistributionDownloadPlugin` to set configurations as
non-consumable and the `InternalDistributionArchiveSetupPlugin` to mark
certain configurations as consumable. This ensures that configurations
are correctly utilized during build setup and execution phases.

(cherry picked from commit 130cc74d8a)

* Fixed DefaultSettingsProvider to use Java 17 (#116029)

It is needed to be able to backport the change to the 8.x.
Having same code for both versions can help us to avoid some merge
conflicts in the future.
2024-11-04 20:59:59 +11:00
Ryan Ernst
dedf9fd6d7
Use directory name as project name for libs (#115720) (#115984)
* Use directory name as project name for libs (#115720)

The libs projects are configured to all begin with `elasticsearch-`.
While this is desireable for the artifacts to contain this consistent
prefix, it means the project names don't match up with their
directories. Additionally, it creates complexities for subproject naming
that must be manually adjusted.

This commit adjusts the project names for those under libs to be their
directory names. The resulting artifacts for these libs are kept the
same, all beginning with `elasticsearch-`.

* fixes
2024-10-31 07:52:10 +11:00
Rene Groeschke
a8cef2ddca
[Build] Fix checkstyle exclusions on windows (#115185) (#115259) 2024-10-23 11:24:50 +02:00
Mark Vieira
0279c0a909
Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
Mark Vieira
e23588046a
Pass allow security manager flag in gradle test policy setup plugin (#111725)
The `java.security.manager=allow` system property is required when
running tests on newer Java versions with the security manager
deprecated. As such, it should be set in our
`GradleTestPolicySetupPlugin` so that it's done for external plugin
authors.
2024-08-09 09:48:47 +10:00
Rene Groeschke
1a52716345
Use bundled jdk as default runtime jdk instead of build jvm (#111197)
* Fallback to bundled jdk for runtime jdk instead of build jvm
* Rework bundled jdk resolution to be lazy
* Use fixed runtime jdk for gradle build integ tests
2024-07-31 16:06:27 +02:00
Rene Groeschke
dd4b410bc0
[Gradle] Remove default Environment variables setup for LoggedExec tasks (#110375)
We do not implicitly rely on all different kind of env variables when leveraging Gradle Configuration Cache
this makes reusing config cache more reliable and improves cache hits

* configure default env variables for logged exec task
* Fix antfixturestop constructor
* Make LoggedExec cc compatible (fix integtests)
* Fix spotless
2024-07-23 15:25:07 +02:00
Rene Groeschke
022b84b41d
Make --write-verification-metadata faster (#111103)
by ignoring elasticsearch distributions when resolving artifacts
2024-07-19 17:52:44 +02:00
Rene Groeschke
320f2414aa
Ignore configs from DistributionDownload plugin and bwc for resolveAllDependencies (#110828) 2024-07-12 17:17:55 +02:00
Mark Vieira
239eb9e84c
Improve error message when resource leaks are detected in test clusters (#109996)
We throw an error when we detect resource leaks in cluster logs but we
don't provide any indication of which cluster, or which log. This change
logs the path to the log file in question so you can investigate.
2024-06-21 05:32:33 +10:00
Rene Groeschke
fad8c191fc
Make BWC build logic configuration cache compatible (#109354)
More refactoring towards configuration cache compatibility
2024-06-06 07:30:21 +02:00
Rene Groeschke
8ac3e3dd90
Update Gradle wrapper to 8.8 (#108021)
Fix incompatibility with 8.8 and our internal api usages

- Update ospackage to a version that contains a fix we provided
- Tweak build logic to avoid deprecation warnings
- Use newer permission api
- Use custom shadowplugin
- Rework ElasticsearchDistribution dependencies resolution
- Update Gradle wrapper to 8.8
2024-06-04 12:43:02 +02:00
Armin Braun
c2f528e5a4
Check REST test nodes LeakTracker like we check Netty's LeakDetector (#108540)
We should make sure to find leaks reported by both of these, these days
our `LeakTracker` will likely be more sensitive that Netty's in some
cases since our objects refer to Netty objects and thus get collected
first.
2024-05-14 21:13:52 +02:00
Volodymyr Krasnikov
0fc53816b9
Fix typo in RunTask settings name (#108271)
This typo prevents running ES locally with `./gradlew run`
2024-05-03 19:45:36 -04:00
Mark Vieira
e206f6e44e
Move muted tests file and allow for additional files to be configured (#107916)
Some refactoring to the muted tests plugin to better support usage in a
composite build configuration.
2024-04-25 15:45:30 -04:00
Rene Groeschke
a0caf336e6
Support mdx file format for docs (#107428)
Adding support for MDX files in our :docs project. We parse those *.mdx files
like we do for asciidoc files for code snippets and generate yaml specs from them that
we test as part of our integration tests.

By default:
When searching for doc sources in the docs folder we fail the build if we detect multiple files of
the same name but different extension. E.g. having painless-field-context.mdx
and painless-field-context.asciidoc in the same source folder will fail the build.

Migration Mode:
To allow easier migration from asciidoc to mdx the build supports a kind of migration mode.
When running the build with -Dgradle.docs.migration=true (e.g. ./gradlew buildRestTests -Dgradle.docs.migration=true)

Duplicate doc source files (asciidoc and mdx) are allowed
The Generated yaml rest specs for duplicates will have the extension *.mdx.yml or *asciidoc.yml.
The generated yaml rest specs for duplicates are compared to each other to ensure they produce the same yml output.
2024-04-25 09:38:46 +02:00
Brian Seeders
bb0bc17ece
Muted test automation (#106784) 2024-04-18 10:19:27 -07:00
Moritz Mack
de3e2e4ef2
Remove deprecated APM setting from RunTask (#105076) 2024-03-19 11:26:08 +01:00
Ryan Ernst
405b88b882
Add zstd to native access (#105715)
This commit makes zstd compression available to Elasticsearch. The
library is pulled in through maven in jar files for each platform, then
bundled in a new platform directory under lib. Access to the zstd
compression/decompression is through NativeAccess.
2024-03-13 09:45:12 -07:00
Ryan Ernst
abd2722228
Cleanup subproject creation in build tests (#105998)
Sometimes subprojects are created by build tests. There exists a utility
function to define the subproject build file. Yet some tests add the
project to settings and then configure through the subprojects directive
in the root build file. This commit cleans up two such cases to use
explicit subproject build files.
2024-03-06 12:27:30 -08:00
Tim Vernum
e9ff896738
Fix gradle run on Serverless (#105938)
On Serverless it is not possible to configure deprecation indexing (it
is always off). This commit updates the behaviour of
`ElasticsearchCluster` to no longer attempt to configure deprecation
indexing on stateless nodes.
2024-03-05 12:53:25 +01:00
Armin Braun
3f8bc36788
Fix Gradle File leaks (#105597)
Fixing a couple of file leaks (and cleaning up one missing
try-with-resources). The directory descriptor leaks in particular
were leaking massively on every precommit run, to the point where it
slows down the whole system and/or we're running into descriptor limits.
2024-02-18 17:56:22 +01:00
Dmitry Cherniachenko
a50e58d99a
Use single-char variant of String.indexOf() where possible (#105205)
* Use single-char variant of String.indexOf() where possible

indexOf(char) is more efficient than searching for the same one-character String.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2024-02-12 14:14:32 -05:00
Dmitry Cherniachenko
e21a4874ab
Use String.replace() instead of replaceAll() for non-regexp replacements (#105127)
* Use String.replace() instead of replaceAll() for non-regexp replacements

When arguments do not make use of regexp features replace() is a more efficient option, especially the char-variant.
2024-02-12 13:11:15 -05:00
Dmitry Cherniachenko
263ea5e987
Replace generic HashSet / HashMap with more efficient EnumSet / EnumMap (#105238) 2024-02-08 13:43:14 +00:00
Moritz Mack
dbf59c5414
Update/Cleanup references to old tracing.apm.* legacy settings in favor of the telemetry.* settings (#104917) 2024-01-31 09:20:05 +01:00
Moritz Mack
00ca64bcf2
Use allow-list for APM agent settings and consolidate defaults in APMJvmOptions (#104141)
Prevent invalid and miss-configuration of APM agent using an explicit allow-list of setting keys.
Additionally, configuration defaults of APMAgentSettings are consolidated in APMJvmOptions to keep defaults in a single location.
(ES-6916)
2024-01-12 10:30:04 +01:00
Armin Braun
21386c784f
Fix all "lambda can be folded" warnings in the codebase (#104020)
Just some obvious cleanup.
2024-01-08 12:51:30 +01:00
Mark Vieira
a9546a07f2
Disable incremental compilation in CI environments (#103346) 2023-12-12 13:10:27 -08:00
Przemyslaw Gomulka
543919b7f3
Enable APM tracing when --with-apm-server is used (#103268)
when runtask (gradlew run) task is run with --with-apm-server apm tracing should also be enabled
2023-12-11 15:12:28 +01:00
Przemyslaw Gomulka
fc9991aa4e
Disable metrics sending only when the setting was not used explicitly (#102796)
RunTaks is used by both statefull and serverless.
when --with-apm-server is used, `telemetry.metrics.enabled` is always turned to true
and server_url is set to localhost
However when --with-apm-server is NOT used, then we should disable `telemetry.metrics.enabled`
only if that setting was not explicitly used. This explicte use is for instance when
running gradlew run and configuring ES to send to ESS cluster
a follow up from https://github.com/elastic/elasticsearch/pull/101941/files#r1388403805
2023-11-30 12:48:40 +01:00