Commit graph

130 commits

Author SHA1 Message Date
Rene Groeschke
0e82176644
[8.16] Update Gradle wrapper to 8.13 (#122421) (#123876)
* Update Gradle wrapper to 8.13 (#122421)

* Fix Gradle Deprecation warning as declaring an is- property with a Boolean type has been deprecated.
* Make use of new layout.settingsFolder api to address some cross project references
* Fix buildParams snapshot check for multiprojet projects

(cherry picked from commit e19b2264af)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/BaseInternalPluginBuildPlugin.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalDistributionBwcSetupPlugin.java
#	docs/build.gradle
#	qa/lucene-index-compatibility/build.gradle
#	x-pack/qa/multi-project/core-rest-tests-with-multiple-projects/build.gradle
#	x-pack/qa/multi-project/xpack-rest-tests-with-multiple-projects/build.gradle

* More fixes
2025-03-06 02:08:55 +11:00
Rene Groeschke
4d17b2193a
Update Gradle wrapper to 8.12 (#118683) (#119357)
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)

# Conflicts:
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerCloudElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/distribution/DockerUbiElasticsearchDistributionType.java
#	build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/Fixture.java
#	plugins/repository-hdfs/hadoop-client-api/build.gradle
#	server/src/main/java/org/elasticsearch/inference/ChunkingOptions.java
#	x-pack/plugin/kql/build.gradle
#	x-pack/plugin/migrate/build.gradle
#	x-pack/plugin/security/qa/security-basic/build.gradle
2024-12-31 08:37:28 +01:00
Rene Groeschke
581b9ab7c0
[8.16] [Gradle] Remove static use of BuildParams (#115122) (#117434)
* [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/InternalDistributionBwcSetupPlugin.java
#	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

* [Build] Fix fips testing after buildparams rework (#116934)

* More Cleanup

* [Build] Fix checkstyle exclusions on windows (#115185)

* More merge fixes

* Delete x-pack/plugin/kql/build.gradle
2024-11-27 12:34:32 +01:00
Rene Groeschke
e50a2670e1
[Build] Reapply updating to Gradle 8.11.1 (#117394) (#117429)
This reverts commit b5c6d927c1.
* Simplify and fix dynamic project dependency handling

(cherry picked from commit d2b3dc51d1)
2024-11-25 02:29:31 +11:00
Mark Vieira
0279c0a909
Add AGPLv3 as a supported license 2024-09-13 14:30:33 -07:00
Ry Biesemeyer
f75afb0098
Update year in NOTICE.txt (#109548) 2024-06-10 15:12:38 -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
Lorenzo Dematté
89d666bf90
Adding override for lintian false positive on libvec.so (#108521) 2024-05-13 19:22:12 +02: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
067aba96cd
Standardize build distribution internals on os/architecture (#105842)
The build handles platform specific code which may be for arm or x86.
Yet there are multiple ways to describe 64bit x86, and the build
converts between the two in several places. This commit consolidates on
the x64 nomenclature in most places, except where necessary (eg ML still
uses x86_64).

relates #105715
2024-02-28 11:47:12 -05:00
Rene Groeschke
d214d74000
Use patched nebula os package gradle plugin (#100280)
There is a bug in the nebula os package gradle plugin that breaks copy spec specific setgid handling.
We have created a patch for the plugin that we use for now to unblock us. This will be ported upstream
to the nebula main branch and part of a release but that requires some more polishing and will
be taken care of in a later PR
2023-10-05 07:59:10 +02:00
Rene Groeschke
8fd2a49321
Explicitly configure setgid for RPM and Dep packaging (#100063)
Fixes CI issue: https://github.com/elastic/elasticsearch/issues/99972

Ran packaging tests as part of this PR:

 https://elasticsearch-ci.elastic.co/job/elastic+elasticsearch+pull-request+packaging-tests-unix-sample/44772/
2023-09-29 17:48:34 +02:00
Rene Groeschke
b23e000c30
Update gradle wrapper to 8.3 (#97838)
Gradle now fully supports compiling, testing and running on Java 20. 
Among other general performance improvements this release introduces --test-dry-run command line option that allows checking if tests are filtered or not by gradle.
Required updating nebula ospackage plugin as setuid was broken in gradle 8.3.
2023-09-27 08:48:21 +02:00
Brian Seeders
81e1fd2f1b
Add java-matrix and java-fips-matrix Buildkite pipelines (#97253) 2023-07-28 14:49:46 -04: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
9ce5baed0c
Update Gradle wrapper to 8.0.2 (#92751)
- Remove custom checksum build logic in wrapper task
- Adjust jdk home handling adjusting the change in behaviour in gradle. Requires providing canonical paths for provisioned jdk homes.
- Fix test by add workaround to bug in configuration cache
2023-03-09 13:00:12 +01:00
David Turner
d956501a80
Extend systemd startup timeout to 900s (#91338)
Extends the default `systemd` startup timeout from 75s to 900s.

Relates #86476
2022-11-17 11:16:22 +00:00
Rene Groeschke
dbf39741a0
Make LoggedExec gradle task configuration cache compatible (#87621)
This changes the LoggedExec task to be configuration cache compatible. We changed the implementation
to use `ExecOperations` instead of extending `Exec` task. As double checked with the Gradle team this task
is not planned to be made configuration cache compatible out of the box anytime soon.

This is part of the effort on https://github.com/elastic/elasticsearch/issues/57918
2022-07-11 08:46:54 +02:00
David Roberts
36cffef079
Add Lintian overrides to ignore Intel MKL not linked to libc (#87706)
We don't build these libraries ourselves and the license forbids
us from modifying them in any way, so we won't be able to make
this rule pass on them. All we can do is override it.

Fixes #87632
2022-06-16 18:02:21 +01:00
Ryan Ernst
b9c504b892
Replace most shell script logic with Java (#85758)
Elasticsearch provides several command line tools, as well as the main script to start elasticsearch. While most of the logic is abstracted away for cli tools, the main elasticsearch script has hundreds of lines of platform specific shell code. That code is difficult to maintain because it uses many special shell features which then must also exist in other platforms (ie windows batch files). Additionally, the logic in these scripts are not easy to test, we must be on the actual platform and test with a full installation of Elasticsearch, which is relatively slow (compared to most in process tests).

This commit replaces logic of the main server script, as well as the windows service management script, with Java. The new entrypoints use the CliToolLauncher. The server cli figures out all the jvm options and such necessary, then launches the real server process. If run in the foreground, the launcher will stay alive for the lifetime of Elasticsearch; the streams are effectively inherited so all output from Elasticsearch still goes to the console. If daemonizing, the launcher waits around until Elasticsearch is "ready" (this means the Node startup completed), then detaches and exits.

Co-authored-by: William Brafford <william.brafford@elastic.co>
2022-05-19 08:29:08 -07:00
Ryan Ernst
1d4534f848
Introduce unified entrypoint for CLI scripts (#85821)
CLI scripts have a common infrastructure in that they call to the shared
elasticsearch-cli shell script which launches them with the appropriate
java command line. However, each underlying Java class must implement
its own main method.

This commit introduces a single main method to be shared by CLIs. The
new CliToolLauncher takes in system properties to determine which tool
is being run, and a new CliToolProvider SPI allows defining and finding
the named tools.

relates #85758

Co-authored-by: William Brafford <william.brafford@elastic.co>
2022-04-14 08:53:36 -07:00
Rene Groeschke
579695d032
Update nebula plugins improving configuration cache support (#85316) 2022-03-24 13:55:54 +01:00
Rory Hunter
fb5b44c522 Restart ES after keystore upgrade in postinst (#84224)
Closes #82433. If the environment variable `RESTART_ON_UPGRADE` is true,
then ensure that we delay restarting Elasticseach until after the
keystore is upgraded, or else we can run into permissions problems.
2022-02-24 09:28:49 +00:00
Rene Groeschke
a86f9c5f02
Remove usage of deprecated Provider#forUseAtConfigurationTime (#83932)
Remove gradle api usage that has been deprecated with Gradle 7.4
2022-02-15 08:06:22 -05:00
Rory Hunter
d2dbef5063
Convert repository plugins to modules (#81870)
Closes #81652.

Convert the `repository-azure`, `repository-gcs` and `repository-s3`
plugins into modules, so that they are always included in the
Elasticsearch distribution. Also change plugin installation, removal
and syncing so that attempting to add or remove these plugins still
succeeds but is now a no-op.
2022-01-10 10:45:42 +00:00
Albert Zaharovits
9e9a8cc7d0
Auto-generated TLS files under fixed config path (#81547)
We (mostly I) were initially advocating for the auto-generated files to
use unique names (the name containing a timestamp particle), in order to
avoid that subsequent invocations of the config step conflict with
itself. Moreover, I was wishing that these files will not have to be
handled directly by admins (that the enrollment process was to be used).
However, experience proved us otherwise, admins have to manipulate these
files, and unique configuration names are hard to deal with in scripts
and docs, so this PR is all about using a fixed name for all the
generated files. _Labeling as a bug fix because the feedback is that it
very negatively impacts usabilty._ Closes
https://github.com/elastic/elasticsearch/issues/81057
2021-12-29 12:56:29 -05:00
Rory Hunter
3018e52335
Introduce declarative plugin management (#77544)
Closes #70219.

Introduce a declarative way for the Elasticsearch server to manage plugins,
which reads the `elasticsearch-plugins.yml` file and works which out
plugins need to be added and / or removed to match the configuration. Also
make it possible to configure a proxy in the config file, instead of
through the environment.

Most of the work of adding and removing is still done in the
`InstallPluginAction` and `RemovePluginAction` classes, so the
behaviour should be the same as with the `install` and `remove`
commands. However, these commands will now abort if the above config
file exists. The intent is to make it harder for the configuration
to drift.

This new method only applies to `docker` distribution types at the
moment.

Since this syncing mechanism declarative, rather than imperative,
the Cloud-specific plugin wrapper script is no longer required.
Instead, an environment variable informs `InstallPluginAction` to
install plugins from an archive directory instead of downloading
them, where possible.
2021-11-15 14:41:11 +00:00
Ioannis Kakavas
874180efb1
CLI tool to reconfigure nodes to enroll (#79690)
This change introduces a CLI tool that can be run directly after
installation time in packaged installations, to allow for a node
that was auto-configured to be the initial node of a cluster during
installation ( default installation behavior) to be reconfigured
to join an existing cluster, using an enrollment token.
The use of this tool presumes that the user has the
appropriate permissions to read/write to the installation dirs and
that this node has not been yet started, i.e. this tool is run
directly after installation. It is destructive, as it removes
existing security auto-configuration, and as such it requires an
explicit verification from the user.

This is a follow-up to #7718.
2021-10-27 13:29:52 +03:00
Ioannis Kakavas
5d3b6bf2f7
Allow node to enroll to cluster on startup (#77718)
The functionality to enroll a new node to a cluster was
introduced in #77292 as a CLI tool. This change replaces this
CLI tool with the option to trigger the enrollment functionality 
on startup of elasticsearch via a named argument that can be 
passed to the elasticsearch startup script (--enrollment-token)
so that the users that want to enroll a node to a cluster can do 
this with one command instead of two. 

In a followup PR we are introducing a CLI tool version of this
functionality, that can be used to reconfigure packaged
installations.
2021-10-27 08:13:49 +03:00
Ioannis Kakavas
0eb2baa07d
CLI tool to (re)set users password (#79709)
This change introduces a new CLI tool that can be used to set and
reset the password of all the built-in users and users in the native
realm in Elasticsearch. It depends on the file realm being enabled
(which it is, by default) and can (re)set one built-in user password at a time.
It removes the previously introduced elasticsearch-reset-elastic-password
and elasticsearch-reset-kibana-system-password as their functionality is
covered by this new tool.
2021-10-26 07:57:18 +03:00
Ioannis Kakavas
c5ea5d3ed3
Edit the autoconfiguration output for packages (#79687)
Slight rewording in order to align the output format with that of
archives and docker
2021-10-26 06:24:26 +03:00
Ioannis Kakavas
e3353c385f
Security auto-configuration for packaged installations (#75144)
This commit ensures that for packaged installations
we will run the auto-configuration code on installation (but not upgrade) time. 
This is needed because we expect elasticsearch to be run as a service. 
By the time the service runs, the configuration directory is not writable by the
user that runs elasticsearch so we can't  persist configuration and key/certificate
material on runtime. Running auto-configuration on installation time
allows us to print information to the user that they have better chance of seeing 
(barring unattended installations). We don't have the option to show output to the
user when starting the service with systemctl. 

During installation we:
- Generate TLS material, enable security and TLS and persist on disk
- Generate a password for the elastic user and store a hash of this 
in the elasticsearch.keystore. This will be picked up by the node
starting and will be "promoted" to be the cluster wide elastic
password on first startup. (see #78306 )
- We notify the user in the output of the package installation about
whether we succeed and what the password of the elastic user is.
2021-10-15 09:27:30 +03:00
Ioannis Kakavas
ad5c782f9c
Add xpack core and security to INTEG TEST (#77632)
This change makes it so x-pack-core and x-pack-security are bundled
in the INTEG TEST distribution that we use for testClusters in our
tests. There are two reasons for this:

- In https://github.com/elastic/elasticsearch/pull/77231 where we
are looking into enabling and auto-configuring security by default
for all nodes, we need to call out to ConfigInitialNode to
determine whether we should do the auto-configuration or not.
- Since we are enabling security by default, we should be looking
into enabling security for all for our tests moving forward, or
at least make a conscious decision about which ones run without
security. This change is a step towards that direction.
2021-09-21 08:18:41 +03:00
Mark Vieira
8a9ea85657
Remove no-jdk distributions (#76896) 2021-08-25 09:52:15 -07:00
Ioannis Kakavas
3a1f40302b
Remove keystore initial_md5sum (#76835)
Elasticsearch's keystore initial md5sum was added in #28928 with
the intention to allow us to remove the elasticsearch.keystore
file upon package removal, if this hadn't been altered after
installation. At that time this decision made perfect sense as
the elasticsearch keystore only contains transient data by
default ( keystore.seed ) that is meant to be useful for bootstrap
related actions, and doesn't need to survive re-installations.

With Security ON by default, we will be storing additional
settings in the keystore upon installation(namely, the passwords
for the PKCS#12 keystores used for TLS) and these have a more
persistent nature. Since `remove` doesn't delete the configuration
directories and files where said PKCS#12 keystores are stored, it
makes sense to also not delete the elasticsearch.keystore which
stores the passwords.
2021-08-23 22:28:13 +03:00
Rene Groeschke
76c7e1bb94
Update nebula ospackage plugin (#76639)
This updates the nebula ospackage plugin to 8.6.1 that includes
a our provided PRs:

- https://github.com/nebula-plugins/gradle-ospackage-plugin/pull/402
- https://github.com/nebula-plugins/gradle-ospackage-plugin/pull/400
- https://github.com/nebula-plugins/gradle-ospackage-plugin/pull/397

and also an update to the redline library our fix for ssh256 headers

- https://github.com/craigwblake/redline/pull/157
2021-08-18 16:31:25 +02:00
Rene Groeschke
ba7c7d783d
Update redline library to 1.2.10 (#76440)
* Update redline library to 1.2.10

The redline team just released version 1.2.10 of the redline
library which contains our fix of the rpm signatures / headers.

Also a PR to update that dependency in the ospackage plugin has been
raised at https://github.com/nebula-plugins/gradle-ospackage-plugin/pull/402

* Update common about enforcing redline 1.2.10
2021-08-13 09:29:37 -04:00
Rene Groeschke
da29bb028f
Avoid configuration time task creation (#76245)
Fix publish plugin
2021-08-11 09:30:51 +02:00
Rene Groeschke
b323726ebd
Resolve system properties in build scripts via provider factory (#76199)
This allows tracking system properties used in the build configuration and brings us
one step closer to be gradle configuration cache compliant.
2021-08-09 09:39:30 +02:00
Rene Groeschke
b5016d9179
Update rpm build to add sha256 payload and file digest (#75731)
This is a follow up on https://github.com/elastic/elasticsearch/pull/75569

and should fix installation problems in FIPS enabled environments.
2021-07-27 17:37:15 +02:00
Rene Groeschke
2c5e406b12
Add Sha256 header in elasticsearch RPMs (#75569)
This adds support for Sha256 header signature in our RPMs by
updating the dependency to the readline library to a version
we have patched until the provided PR (https://github.com/craigwblake/redline/pull/157)
got merged and released by the redline folks.

This work is related to #58257
2021-07-22 08:32:53 +02:00
Jake Landis
4553bf03d5
Remove MavenFilteringHack (#73637) 2021-07-20 17:05:16 -04:00
Ioannis Kakavas
0ad794833f
Determine upgrades correctly for deb packages (#75010)
We are using the `-n` bash operator to determine whether a second
argument is passed to the `postinst` script during installation of
our DEB packages. The reasoning is that we want to differentiate
between installations and upgrades and a second argument to
postinst is only passed when this is an upgrade ( the identifier
of the version the package is upgraded to ).
The problem is that we use `-n` without quoting the $2 and this is
unsafe practice as it might yield unexpected results for `-n` and
`-z` operators used within test brackets. Testing with bash
5.0-6ubuntu1.1 `[ -n $2 ]` returns false both for upgrades and
installations, while `[ -n "$2" ]` behaves as expected.

References:
https://tldp.org/LDP/abs/html/comparison-ops.html
https://wiki.debian.org/MaintainerScripts
2021-07-07 18:00:51 +03:00
Rene Groeschke
c2e86258d8
Update wrapper to 7.1 (#73941)
- Fix new introduced deprecated usages
- Update to newer ospackage snapshot to include provided PR for fixing deprecated usage

This gradle release comes with improvements on incremental compilation which we should benefit from
2021-06-17 10:59:22 +02:00
Rene Groeschke
e609e07cfe
Remove internal build logic from public build tool plugins (#72470)
Extract usage of internal API from TestClustersPlugin and PluginBuildPlugin and related plugins and build logic

This includes a refactoring of ElasticsearchDistribution to handle types
better in a way we can differentiate between supported Elasticsearch
Distribution types supported in TestCkustersPlugin and types only supported
in internal plugins.

It also introduces a set of internal versions of public plugins.

As part of this we also generate the plugin descriptors now.

As a follow up on this we can actually move these public used classes into 
an extra project (declared as included build)

We keep LoggedExec and VersionProperties effectively public And workaround for RestTestBase
2021-05-06 14:02:35 +02:00
Rene Groeschke
5bcd02cb4d
Restructure build tools java packages (#72030)
Related to #71593 we move all build logic that is for elasticsearch build only into
the org.elasticsearch.gradle.internal* packages

This makes it clearer if build logic is considered to be used by external projects
Ultimately we want to only expose TestCluster and PluginBuildPlugin logic
to third party plugin authors.

This is a very first step towards that direction.
2021-04-26 14:53:55 +02:00
Rene Groeschke
0f40889879
Update build to Gradle 7.0 (#68506)
- Update gradle wrapper to gradle 7.0
- Remove deprecated usages to make build 7.0 compatible
- Fix excludes in docs snippet tasks (See https://github.com/gradle/gradle/issues/16160 for details)
- Fix deprecation warnings in 7.0
- Add explicit dependencies that have been missed
- Make extract native licenses tasks output dir more explicit
- Use a snapshot of the ospackage plugin that includes a fix for 7.0 already
- fix test runtime classpath setup in repository-hdfs
- Make task dependency explicit to fix further deprecation warnings
- Remove manual check for http repo usages that has been deprecated in gradle 7.0
- Update spock to latest 2.0 milestone required for groovy 3
2021-04-13 09:15:08 +02:00
Rene Groeschke
24adbbca41
Remove OSS specific distribution packaging (#69775)
* Remove OSS projects from distribution packaging
* Remove OSS flavor from ElasticsearchDistribution
* Remove OSS handling from docker build setup
2021-03-03 13:39:29 +01:00
Jason Tedor
5f676ec5a7
Rename JAVA_HOME to ES_JAVA_HOME in environment (#69281)
This commit renames JAVA_HOME to ES_JAVA_HOME in the default environment
file that ships with the Debian and RPM pacakges. This commented out
environment variable shouldu use our preferred name here.
2021-02-19 14:52:28 -05: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