Commit graph

91 commits

Author SHA1 Message Date
Rene Groeschke
599560234f
[Build] Setup artifact signing for maven aggregation content (#130179)
Maven central expects signed artifacts when publishing
2025-06-27 14:24:10 +02:00
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
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
Joe Gallo
552066e910
Revert "Bump spotless (#126125)" (#126173)
Reverting https://github.com/elastic/elasticsearch/pull/126125 due to
https://github.com/elastic/elasticsearch/pull/126125#issuecomment-2773672346.
2025-04-03 09:00:33 +11:00
Joe Gallo
1306c6ba01
Bump spotless (#126125) 2025-04-02 13:06:42 -04: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
Rene Groeschke
4bd1f81ef9
Move eclipse specific extention property into elasticsearch eclipse plugin (#123320) 2025-02-25 19:30:42 +11: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
Rene Groeschke
5278159987
Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300) (#119325)
* Reapply "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)

The original PR (#118894) has broken serverless.

* Fix gitinfo plugin for serverless usage

* Update buildscan git revision reference
2024-12-30 08:54:42 +01:00
Mark Vieira
9d0f08bedf
Revert "[Build] Do not invalidate configuration cache when branch is switched (#118894)" (#119300)
This reverts commit f9c6a6c0b2.
2024-12-27 10:05:53 +11:00
Rene Groeschke
f9c6a6c0b2
[Build] Do not invalidate configuration cache when branch is switched (#118894)
* [Build] Do not invalidate configuration cache when branch is switched
* Update build tools tests
* Update GitInfoValueSource.java
2024-12-23 14:51:33 +00:00
Rene Groeschke
9503afc348
[Build] Cache spotless p2 dependencies when baking ci image (#118523)
The eclipse formatter used by spotless is resolved at runtime and not declared as
gradle dependency. Therefore we need to run the spotless task to ensure we have
the dependencies resolved as part of our ci image baking.

This should avoid issues with connecting to p2 repos we have experienced lately
in our ci environment

* Revert "[Build] Declare mirror for eclipse p2 repository (#117732)"

This reverts commit c35777a175.
2024-12-12 09:08:33 -08:00
Rene Groeschke
c35777a175
[Build] Declare mirror for eclipse p2 repository (#117732)
The spotlight plugin directly resolves dependencies from p2 which causes

`java.io.IOException: Failed to load eclipse jdt formatter` issues if that repo is not accessible.

This is a workaround for the eclipse p2 default repository being down resulting in all our
ci jobs to fail.

The artifacts in question we wanna cache live in `~/.m2/repository`
2024-11-29 02:26:34 +01: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
058be9697a
[Gradle] Fix PublishPlugin configuration cache compatibility (#116887)
Relying on GenerateMavenPom#getPom breaks configuration cache compatibility
as this is a transient property that is not serialized.
2024-11-18 10:29:54 +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
Rene Groeschke
0c3e52c11d
[Build] Add AGPL license to open source poms (#114403)
Aftermath of coming back to open source licensing
2024-10-10 11:25:00 +02:00
Mark Vieira
a59c182f9f
Add AGPLv3 as a supported license 2024-09-13 15:29:46 -07: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
Slobodan Adamović
b643abab3b
Harden usage of XML document builder in build-conventions (#106874)
While `LicenseHeadersTask` only uses `DocumentBuilderFactory` internally
to parse `rat.xml` files (which are the output of running Apache RAT on
Elasticsearch codebase files), it is a good practice to disable XXE
features even if it's part of checks that are run on developers
machines.
2024-03-31 19:41:52 -04: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
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
Mark Vieira
6c4e55e714
Fix file path when looking for docker exclusions file (#105304) 2024-02-08 12:27:09 -08:00
Rene Groeschke
209b655d0c
Avoid eager task realization (#103343)
* Avoid eager task realization in esql qa projects
* Fix eager task realization in PomValidationPrecommitPlugin
* Make loadCsvSpecData task lazy created
* Fix test task reference
2024-01-25 14:27:03 +01:00
Mark Vieira
a9546a07f2
Disable incremental compilation in CI environments (#103346) 2023-12-12 13:10:27 -08:00
Rene Groeschke
b8627079b4
Update Gradle Wrapper to 8.2 (#96686)
- Convention usage has been deprecated and was fixed in our build files
- Fix test dependencies and deprecation
2023-07-04 15:35:15 +02:00
Armin Braun
63e64ae61b
Cleanup Stream usage in various spots (#97306)
Lots of spots where we did weird things around streams like redundant stream creation, redundant collecting
before adding all the collected elements to another collection or so, redundant streams for joining strings
and using less efficient `Collectors.toList` and in a few cases also incorrectly relying on the result being mutable.
2023-07-03 14:24:57 +02:00
Rene Groeschke
a45370e6dd
Update spotless gradle plugin (#95999) 2023-05-11 12:06:03 +02:00
Rene Groeschke
4e2f852c08
Resolve runtime java via Gradle tool chain provider (#95319)
Using gradle toolchain support in gradle requires refactoring how the composite build is composed. 
We added three toolchain resolver
1. Resolver for resolving defined bundled version from oracle as openjdk
2. Resolve all available jdks from Adoption
3. Resolve archived Oracle jdk distributions. 

We should be able to remove the JdkDownloadPlugin altogether without having that in place, but we'll do that in a separate effort.

Fixes #95094
2023-05-03 15:28:47 +02:00
Rene Groeschke
2b210b5220
Fix paralle detector configuration cache compatibility (#95452) 2023-04-24 06:41:18 -04:00
Rene Groeschke
025b8ee66a
Revert "Make ParallelDetector Gradle configuration cache compliant (#95434)"
This reverts commit 4fc6dda21e.
2023-04-21 13:24:27 +02:00
Rene Groeschke
4fc6dda21e
Make ParallelDetector Gradle configuration cache compliant (#95434) 2023-04-21 13:14:23 +02:00
Rene Groeschke
e735455431
Provide hints to Gradle Task.onlyIf declarations (#94953)
* Update gradle enterprise plugin to show skip reasons in build scans
* Unify OS specific handling in build logic
2023-03-31 23:57:55 +02:00
Rene Groeschke
1efb95b857
Ensure all sourceSets are compiled as part of Gradle precommit (#91897) 2022-11-24 15:30:41 -05:00
Mark Vieira
7d6dc6c19b
Improve robustness of formatting plugin in composite builds (#91028) 2022-10-19 12:53:19 -07:00
Slobodan Adamović
bd58c74a49
Fix usage of IndexAccessControl in CustomAuthorizationEngine (#90559)
* Fix usage of `IndexAccessControl` in `CustomAuthorizationEngine`

* Make version properties loader more robust

Co-authored-by: Mark Vieira <portugee@gmail.com>
2022-09-30 18:18:38 +02:00
Mark Vieira
c495baee84
Make version properties plugin more robust in a composite build (#90535)
The current logic in `VersionPropertiesPlugin` for determining the
location of the "elasticsearch" project workspace doesn't account well
for scenarios where the elasticsearch project itself is an included
build in a larger composite. This change accounts for this by
traversing the build hierarchy.
2022-09-29 12:40:00 -07:00
Mark Vieira
12b841e048
Add support for Git submodules to GitInfo (#89741) 2022-09-06 09:21:25 -07:00
Rory Hunter
0df14382b9
Add Checkstyle rule for broken switch cases (#88739)
We use `between(x, y)` calls with `switch` statements in tests to
randomize test behaviour. However, some usages define `case` statements
that can never execute, because the `case` value is outside the range
defined by the `between` call.

Write a rule that inspects the switches and the cases, and fails on the
broken cases. This rule checks `between`, `randomIntBetween` and
`randomInt`.
2022-07-27 09:22:06 +01:00
Rory Hunter
a57e645613
Fix checkstyle version drift and API change (#88283)
Fix checkstyle version drift and API change.
2022-07-05 21:37:16 +01:00
Rene Groeschke
8ccae4da71
Setup elasticsearch dependency monitoring with Snyk for production code (#88036)
This adds the generation and upload logic of Gradle dependency graphs to snyk

We directly implemented a rest api based snyk plugin as:

the existing snyk gradle plugin delegates to the snyk command line tool the command line tool 
uses custom gradle logic by injecting a init file that is 

a) using deprecated build logic which we definitely want to avoid
b) uses gradle api we avoid like eager task creation.

Shipping this as a internal gradle plugin gives us the most flexibility as we only want to monitor 
production code for now we apply this plugin as part of the elasticsearch.build plugin, 
that usage has been for now the de-facto indicator if a project is considered a "production" project 
that ends up in our distribution or public maven repositories. This isnt yet ideal and we will revisit 
the distinction between production and non production code / projects in a separate effort.

As part of this effort we added the elasticsearch.build plugin to more projects that actually end up 
in the distribution. To unblock us on this we for now disabled a few check tasks that started failing by applying elasticsearch.build. 

Addresses  #87620
2022-06-29 13:29:14 +02:00
Juan Camilo Bages
abc174bdad
Add support for building elasticsearch source on macos before monterey (#87430)
Closes #87426
2022-06-06 14:09:57 -07:00
Rene Groeschke
da5750c460
Port build dependencies to gradle version catalogue (#86548)
We introduce the use of a Gradle version catalogue for handling build related dependencies.

This provides type safe accessors for dependencies and allow centralised version definitions.
Later we want to move all our dependency handling to version catalogues.
Since this is a Gradle feature we remove long term maintenance cost for custom version handling in
our build and make centralised version handling more straight forward and support better tooling
based on version catalogues

Fixes asm version alignment on the way using 9.3 everywhere in our build logic.
2022-05-10 12:15:36 +02:00
Rene Groeschke
8bbc7c2e0b
Port javadoc configuration logic into a binary plugin (#86471)
Also adding test coverage and fixing certain issues we stumbled into

when resolving project dependencies of compileClasspath we need to use allDependencies instead of dependencies as usually no dependencies are added directly to compileClasspath but via implementation, compileonly and api and friends
Fixed javadoc setup for projects using shadowed dependencies via shadow plugin
Fixed dealing with skipped javadoc tasks in referenced dependent projects.
In general this PR only fixes expected javadoc generation as it was intended before this PR.

This also contains some tweaks to our gradle integration test fixtures for setting up and debugging test projects
2022-05-10 09:58:43 +02:00
Rene Groeschke
2d85fa7c20
Update build convention dependencies (#85444)
- Update spotless to potentially fix invalid git worktree handling
- Update shadow plugin to be in sync with version used in build-tools
2022-03-30 11:08:34 +02:00
Mark Vieira
216c774451
Fall back to naive parallel forks calculation in non-standard cases (#85410)
Some architectures provide non-standard output in /proc/cpuinfo.
Specifically, AWS graviton. In case we can't properly calculate physical
cpu cores via the standard method just fallback to using the JDK-backed
implementation.
2022-03-28 14:42:15 -07:00
Mark Vieira
da8d8b17dd
Fix calculation of max parallel forks for test execution (#85360) 2022-03-28 10:33:14 -07:00
Rene Groeschke
751c8b5330
Fix spotless exclude for build benchmarking (#85204)
Use targetExclude for excluding file from spotless checks as formatter
warnings are not reported as Error in spotless and still can cause the
build to fail
2022-03-22 06:14:55 -04:00
Rene Groeschke
f2a117095b
Split build benchmark jobs for faster feedback (#84978)
Also handle gradle-profiler introduced spotless issue when running performance tests
2022-03-16 12:34:54 +01:00