Commit graph

212 commits

Author SHA1 Message Date
Rene Groeschke
342083100b
[Build] Add support for publishing to maven central (#128659)
This ensures we package an aggregation zip with all artifacts we want to publish to maven central as part of a release.
Running zipAggregation will produce a zip file in the build/nmcp/zip folder. The content of this zip is meant to match the maven artifacts we have currently declared as dra maven artifacts.
2025-06-06 17:35:44 +02:00
Rene Groeschke
df43f8396b
Fix serialization issue with RunTask using Configuration Cache (#128596) 2025-05-29 09:52:00 +02:00
Patrick Doyle
a78f1f04b7
Refactor TestBuildInfoPluginFuncTest for clarity (#128469)
* Refactor TestBuildInfoPluginFuncTest for clarity

* Further simplify TestBuildInfoPluginFuncTest
2025-05-27 13:50:26 -04:00
Patrick Doyle
13a0e97e9f
Improve TestBuildInfoPluginFuncTest (#128322)
* Use walkFileTree for extractModuleNameFromDirectory

* More tests in TestBuildInfoPluginFuncTest

* Remove stray line from debugging

* [CI] Auto commit changes from spotless

* Eliminate List.reversed() call

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
2025-05-23 22:28:57 +02:00
Patrick Doyle
7e4d96e1d8
Platform-independent paths in TestBuildInfoPluginFuncTest (#128303) 2025-05-23 09:46:18 -04:00
Jack Conradson
f7a7f0b923
Generate a test dependencies file to support unit tests in entitlements (#127486)
Generates a test file with the following information and format:

{
    "component": "<component name>",
    "locations": [
        {
            "representative_class": <class name with package>,
            "module": "<module name>"
        },
        ...
    ]
}

For painless:

{
    "component": "lang-painless",
    "locations": [
        {
            "representative_class": "org/objectweb/asm/tree/analysis/Analyzer.class",
            "module": "org.objectweb.asm.tree.analysis"
        },
        ...
    ]
}

Then it copies the following files into the jar for consumption by unit tests:

* META-INF/plugin-test-build-info.json
* META-INF/es-plugins/<plugin name>/plugin-descriptor.properties
* META-INF/es-plugins/<plugin name>/entitlement-policy.yaml

For server, the files in the jar become the following:

* META-INF/server-test-build-info.json

This should provide enough information for BootstrapForTesting to be 
able to build a mapping of caller class to policy file using the class file 
to look up the jar or directory within the class path and then associating 
that with it's specified module and finally using the specified module to 
look up the appropriate entitlement policy. 

caller class -> specified module -> entitlement policy


---------

Co-authored-by: Patrick Doyle <patrick.doyle@elastic.co>
2025-05-21 16:21:28 -07:00
Rene Groeschke
9b1815c84a
[Build] Update Develocity Plugin to 4.0.1 (#128053)
After updating Develocity to 2015.1.3 we can also update the according plugin
2025-05-13 21:37:44 -07:00
Ryan Ernst
22a52a9c64
Remove security manager policy files (#127727)
Now that security manager is gone, the policy files are no longer
needed. This commit removes the server, test and plugin specific policy
files
2025-05-06 19:37:46 +02:00
Rene Groeschke
a2e580fb60
Update Gradle wrapper to 8.14 (#126519)
* Fix PatternSetFactory incompatibility
* Update ospackage plugin
* Remove ambigious method definitions
* Cleanup verification metadata
* Some cleanup on unused methods and attributes
2025-05-06 13:00:15 +02:00
Ryan Ernst
3bac50e818
Use logs dir as working directory (#124966)
In the unexpected case that Elasticsearch dies due to a segfault or
other similar native issue, a core dump is useful in diagnosing the
problem. Yet core dumps are written to the working directory, which is
read-only for most installations of Elasticsearch. This commit changes
the working directory to the logs dir which should always be writeable.
2025-04-09 07:07:11 -07:00
Mark Vieira
930b4ab995
Convert remaining plugin projects to new test clusters framework (#125626) 2025-03-26 13:44:07 -07:00
Ryan Ernst
740d9833a8
Add --with-plugins to run task (#125468)
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-24 10:39:07 -07:00
Armin Braun
50437e79d3
Cleanup missing use of StandardCharsets (#125424)
Random annoyance that I figured, I'd just fix globally:
We can do a bit of a cleaner job when doing byte <-> string conversion here and there.
2025-03-21 20:10:15 +01:00
Rene Groeschke
6f7a206a8a
Update Gradle Enterprise Plugin (Develocity) to 3.19.2 (#125137)
with develocity updated to 2024.3.4 we are unblocked on updating the gradle enterprise plugin
2025-03-19 19:19:54 +01:00
Lorenzo Dematté
a4d7297944
Permanently switch from SecurityManager to Entitlements (#124865) (#125117)
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
2025-03-18 18:38:45 +02:00
Mariusz Józala
4ff1aade13
[Tests] Fix copying files for test cluster (#124628)
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-12 16:09:55 +01:00
Mark Vieira
74ccd4dba2
Filter module-info.class from entitlements-bridge jar in distribution (#124580) 2025-03-11 13:37:03 -07:00
Rene Groeschke
9c19538c06
[BUILD] Rework build cache authentication on CI (#122296)
This is required to update to newer version of gradle enterprise and the gradle enterprise plugin.
2025-02-14 16:48:15 +01:00
Mark Vieira
61dc93107f
Add lucene version compatibility tests (#121104)
This commit adds compatibility tests that target ES revisions that align with specific Lucene versions. In this case, we are intending to upgrade from Lucene 10.0 to 10.1. Since no on-prem Elasticsearch release exists with 10.0, we need another method to ensure compatibility with Lucene 10.0 indicies.

The work here is a bit hacky since all our compatibility testing infrastructure is centered around versions and we're now effectively doing compatibility tests between two different revisions of Elasticsearch that both report the same version. Ideally this specific testing would be replaced by unit tests, rather that reusing our full cluster restart tests for this purpose.

We'll also want to bump the commit referenced in the CI pipelines here to align with the last commit using Lucene 10.0.
2025-01-29 13:20:25 -08:00
Rene Groeschke
7b6bdfa323
[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.
2025-01-16 23:23:04 +11:00
Mark Vieira
bd27be37e6
Include full stacktrace in gradle functional test failures (#119900) 2025-01-09 22:04:47 +00:00
Rene Groeschke
ba61f8c7f7
Update Gradle wrapper to 8.12 (#118683)
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
2024-12-30 15:34:24 +01:00
Armin Braun
e94f145350
Fix a bunch of non-final static fields (#119185)
Fixing almost all missing `final` spots, who knows maybe we get a small speedup from
some constant folding here and there.
2024-12-26 19:14:36 +01:00
Mark Vieira
e454d74de4
Add optional pull request check for running with entitlements enabled (#118693) 2024-12-13 13:13:44 -08:00
Rene Groeschke
1b4f5eb36d
[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
2024-12-13 08:55:43 +01:00
Lorenzo Dematté
ba9e0cef4d
Do not try to enable SecurityManager on JDK 24 (#117999) 2024-12-10 18:00:58 +01:00
Mark Vieira
7070e95fa7
Update BWC version logic to support multiple bugfix versions (#117943) 2024-12-05 09:43:18 -08:00
Mark Vieira
c5d155ec2b
Increase test cluster node startup timeout (#117603) 2024-11-27 00:17:40 +00:00
Rene Groeschke
97296598c3
[Build] Tweak BWC tasks caching (#117423)
* do not track certain env vars for LoggedExec
* Fix some more tasks on build cacheability
* Some more cleanup on task inputs
* Mark more tasks as cacheable
2024-11-25 10:28:15 +00:00
Rene Groeschke
d2b3dc51d1
[Build] Reapply updating to Gradle 8.11.1 (#117394)
This reverts commit b5c6d927c1.
* Simplify and fix dynamic project dependency handling
2024-11-24 15:13:15 +01:00
Rene Groeschke
b5c6d927c1 Revert "[Build] Update Gradle wrapper to 8.11.1 (#115886)"
This reverts commit 8f943a6a7c.

breaks serverless build. needs further investigation
2024-11-22 21:30:54 +01:00
Rene Groeschke
8f943a6a7c
[Build] Update Gradle wrapper to 8.11.1 (#115886)
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-22 21:11:28 +01:00
Rene Groeschke
8c20ac5884
[Build] Make test cluster plugin configuration cache compatible (#116890)
This adds infrastructure to make the legacy test cluster plugin and
the legacy test cluster based test plugins generally configuration cache compatible.
2024-11-21 08:00:05 +01:00
Rene Groeschke
def490ef85
[Gradle] Update shadow plugin (#116826)
- The shadow plugin has changed ownership and plugin id.
- Make some formatting of poms more reproducible
2024-11-15 19:07:46 +01:00
Rene Groeschke
13c8aaeffa
[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
2024-11-15 17:58:57 +01:00
Patrick Doyle
338c0538b7
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>
2024-11-06 00:07:52 +01:00
Mariusz Józala
130cc74d8a
[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.
2024-10-31 11:55:47 +01:00
Ryan Ernst
e5d5c17c99
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-`.
2024-10-29 13:02:28 -07:00
Rene Groeschke
f5ceafff4f
[Build] Fix checkstyle exclusions on windows (#115185) 2024-10-22 03:30:23 +11:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -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