Commit graph

201 commits

Author SHA1 Message Date
Mariusz Józala
f40328375b
[7.17] [ci] Add debian-12 to matrix in packaging and platform jobs (#116172) (#117336)
* [ci] Add debian-12 to matrix in packaging and platform jobs (#116172)

Lintian test has been changed to parse the result instead of using exit
code. This was required, because now `mismatched-override` is
non-erasable tag which cannot be ignored for exit code.
Lintian introduced non-backward-compatible format change for overrides
file. Because of that, some overrides are now duplicated in a format for
 older versions.
Additionally, Lintian overrides file has been cleaned up to remove the
tags which are no longer failing.

(cherry picked from commit 2ac267de3a)

# Conflicts:
#	distribution/packages/src/deb/lintian/elasticsearch
#	qa/os/src/test/java/org/elasticsearch/packaging/util/LintianResultParser.java
#	qa/packaging/src/test/java/org/elasticsearch/packaging/test/DebMetadataTests.java

* Spotless fix
2024-11-25 18:22:03 +11:00
Mark Vieira
61d76462ee
[7.17] Make docker packaging test more resilient (#111205) (#111209)
* Make docker packaging test more resilient (#111205)

Wrap check for container shutdown log message in an `assertBusy()` to
deal with race conditions.

Closes #111132
# Conflicts:
#	muted-tests.yml
#	qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java

* Fix compile issue
2024-07-24 05:28:16 +10:00
Rene Groeschke
0d3f9b778d
[7.17] Ignore configs from DistributionDownload plugin and bwc for resolveAllDependencies (#110828) (#110837)
* Ignore configs from DistributionDownload plugin and bwc for resolveAllDependencies (#110828)
skip resolving toolchains
2024-07-23 12:33:57 +02:00
Rene Groeschke
a51806acca
[7.17] [CI] Do not cache any es distros when creating ci images (#110742) (#110746)
* [CI] Do not cache any es distros when creating ci images (#110742)

(cherry picked from commit 816cedc217)

# Conflicts:
#	qa/os/build.gradle

* Update build.gradle
2024-07-11 16:42:29 +02:00
Mark Vieira
bb4108eb4c
Install systemd-sysvcompat package on opensuse systems (#109885)
The `systemd-sysv-install` utility is now provided by the
`systemd-sysvcompat` package. Ensure it's installed when running
packaging tests.

Closes #109831
2024-06-19 08:05:38 +10:00
Ryan Ernst
77b14999a2
Retry windows file deletes in packaging tests (#96630) (#96634)
We continue to have CI failures for open files when trying to cleanup on
Windows. This commit tries to account for one of those cases, where the
out/err redirects are cleaned up, opting to retry once after a delay.
2023-06-06 17:27:49 -04:00
Przemyslaw Gomulka
965b9b6ab3
Fix DockerTests for dockerUbi (#91901) (#91905)
kill command was not available. bash -c with kill should be used
relates #91704
closes #91874
2022-11-24 10:40:08 -05:00
Przemyslaw Gomulka
983999fb0f
Improve InnocuousThread permission checks handling backport(#91704) (#91862)
Improve InnocuousThread permission checks handling (6a3855112c)

on shutdown, the jdk's InnocuousThread can try to change a thread name. This requires "java.lang.RuntimePermission" "modifyThread" permission. However InnocuousThread doe not inherit any Access Control Context and therefore have no permissions. This results in AccessControlException.
This commit fixes this by skipping a check for modify thread permission if a thread is innocuous.
relates #91658 and #91650

When previously described AccessControlException is thrown, it is not being catched anywhere in the Elasticsearch, hence it ends up being handled by ElasticsearchUncaughtExceptionHandler#onNonFatalUncaught
This is being again being run by the thread [process reaper] which is an innocuous thread (jdk specific) and has no permissions. onNonFatalUncaught is trying to log a message, but this in turn requires java.lang.RuntimePermission" "getenv." permission. which is does not have. This again results in AccessControlException java.lang.RuntimePermission" "getenv."

We can fix this by executing with doPrivileged in ElasticsearchUncaughtExceptionHandler#onNonFatalUncaught and this will stop the Security Manager's walk and will have ES's global grant permissions.
backport(#91704)
closes #91650
2022-11-23 19:32:23 +01:00
Mark Vieira
e45f50c5e4
Ensure RUNTIME_JAVA_HOME is used for pre-7.0 package upgrade tests (#91629)
Linux packages (deb and rpm) for Elasticsearch 6.x don't include a Java
runtime. Our packaging tests are designed to use an explicit JDK for
packages that do not bundle a JDK. This is not working as intended when
running upgrade tests from 6.x versions and we were instead assuming
a JDK was bundled. The side effect of this is that those versions of
Elasticsearch are using the system JDK, which is different for every
Linux distribution. Specifically, RHEL-based distributions have
recently introduced an update to their Java 8 packages that are
incompatible with the 6.x security manager. This change fixes the logic
that determines if a distribution includes a bundled JDK to ensure that
all versions prior to 7.0 are assumed to not include a bundled JDK.
2022-11-16 14:56:38 -08:00
Rory Hunter
057eea99c6 Pull alpine image in a retry in Docker tests (#88654)
Closes #88651. When using an `alpine` image to perform container
fiddling, first explicitly pull the image and do so in a loop, in an
attempt to make things more robust.
2022-07-25 09:42:26 +01:00
Rory Hunter
a14ba8f89c Fix keystore tests on Docker UBI
Follow up to 3f770e7c. The change in default UID meant that logic that
depended on the Docker type needed to be updated.
2022-07-06 13:19:55 +01:00
Rory Hunter
3f770e7caf
Change UBI docker user to elasticsearch (#88262)
Closes #88218.

Docker image scans have flagged up the `USER` that the UBI Docker image
runs with. Switch to `elasticsearch:root`, which is what the Iron Bank
image also uses, and is what we use for all images from
8.0 onwards.
2022-07-05 15:38:08 +01:00
Mark Vieira
690e1dbf7a
Remove usages of elasticsearch.build plugin in non-production projects (#84961) (#84964)
(cherry picked from commit dc3d3b5e12)
2022-03-15 09:55:44 -07:00
Rory Hunter
1cac2f4812
Expect eof when daemonized (#84371)
Closes #84204 again. When running archive packging tests with a keystore
password and the -d option, there does actually need to be an `eof`
expectation or else we don't capture the error when the keystore
password is incorrect.
2022-02-28 09:19:34 +00:00
Rory Hunter
88a3b2868a Mute KeystoreManagementTests.test44WrongKeystorePasswordOnTty 2022-02-24 20:01:21 +00:00
Rory Hunter
d776d44cc8 Unmute KeystoreManagementTests.test44WrongKeystorePasswordOnTty 2022-02-24 10:42:03 +00:00
Rory Hunter
52a93d0545
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:23:51 +00:00
Rory Hunter
b1573e0365 Mute KeystoreManagementTests.test44WrongKeystorePasswordOnTty 2022-02-24 08:46:47 +00:00
Rory Hunter
ee61c04eee
Remove eof from expect script (#84287)
Hopefully fixes #84204. When we build an expect script in the packaging
tests, we insert `expect eof` after supplying the password. This makes
expect wait until the output of ES is closed, which isn't actaully what
we want, as we then go on to expect on a number of other outputs. So,
remove this `eof`, and let the other expectations do their work.
2022-02-23 15:55:44 +00:00
Rory Hunter
d90d673f5e Mute KeystoreManagementTests.test42KeystorePasswordOnTtyRunningInForeground 2022-02-23 10:07:14 +00:00
Rory Hunter
3e0eb1f4d0
Backport expect improvents in packaging tests (#83635)
In #83430, we made some improvements to how `expect` is used in the packaging tests.
Backport those specific improvements to `7.17` as well.
2022-02-21 15:06:00 +00:00
Rory Hunter
f6c70fef87 Change default shell to bash in default Docker image (#81828)
As a result of changing the base Docker to Ubuntu in #80820, the default shell
i.e. `/bin/sh` changed to `dash`, rather than `bash`, which could impact anyone
invoking `/bin/sh` and expecting it to still propagate environment variables with
periods in their names.

Reconfigure the default shell back to `bash` so that this type of situation works
again.
2021-12-17 09:49:50 +00:00
Rory Hunter
19a27b1c1f Improve Docker image's cacert scripting (#81659)
Apply suggestions from Docker Inc about how to update the `cacerts` in
our Ubuntu-based Docker image. Instead of copying around files and
symlinking, instead install `ca-certificates` and `p11-kit`, and use the
latter to regenerate Java's `cacerts`, as well as ensuring it is
regenerated if the system ca certs are updated.
2021-12-13 21:43:49 +00:00
Rory Hunter
d8df234997
Remove Cloud images from 7.16 (#80742)
We don't actually need Cloud images before v8.0, so remove all
references and supporting code.
2021-12-09 21:20:31 +00:00
Rory Hunter
4eb9667cc0 Revert "Use Cloudflare's zlib in Docker images (#81245)"
This reverts commit 6582acfc00.
2021-12-03 19:24:56 +00:00
Rory Hunter
6582acfc00 Use Cloudflare's zlib in Docker images (#81245)
Closes #81208. Elasticsearch uses zlib for two purposes:    *
Compression of stored fields with `index.codec: best_compression`,
which we use for observability and security data.    * Request /
response compression. Historically, zlib was packaged within the JDK, so
that users wouldn't have to have zlib installed for basic usage of Java.
However, the original zlib optimizes for portability and misses a number
of important optimizations such as leveraging vectorization support for
x86 and ARM architectures. Several forks have been created in order to
address this. Since version 9, the JDK uses the system's zlib when
available and falls back to the zlib that is packaged within the JDK if
a system zlib cannot be found. This commit changes the Docker image to
install the Cloudflare fork of zlib, and run Java using the fork instead
of the original zlib, so that users of the Docker image can get better
performance. Other ES distribution types are out-of-scope, since
configuring the JVM to use an alternative zlib requires an environment
config as well as installed another zlib, and Docker is the only
distribution type where we can control both.
2021-12-03 11:34:08 +00:00
Rory Hunter
b0ed451742
Fix shadowed vars pt6 (#80899) (#80936)
Part of #19752. Fix more instances where local variable names were shadowing field names.
2021-11-23 06:06:51 -05:00
Rory Hunter
9aea490eae Install wget in Cloud Docker images (#80870)
Cloud needs wget to be available in 8.x, so add it to their Docker images.
2021-11-22 10:37:24 +00:00
Rory Hunter
a2c1481ab8
Switch to Ubuntu docker base image 7.16 (#80820)
Backport of #80640.

Switch the ES base Docker image for the default and Cloud images to ubuntu:20.04,
as Ubuntu has a more favourable posture on security updates.
2021-11-22 09:04:37 +00:00
Mark Vieira
7458f37404
Fix resolution of RPM packages for pre-7.0 versions (#80775) 2021-11-16 13:29:11 -08:00
Mark Vieira
3cc54467d7
[7.16] Fix DockerTests.test022InstallPlugin assertion (#80741) (#80773)
* Fix DockerTests.test022InstallPlugin assertion (#80741)

Use order agnostic assertion when testing plugin installation.
https://gradle-enterprise.elastic.co/s/57wwszvhfzwnw/tests/:qa:os:destructiveDistroTest.default-dockerCloud/org.elasticsearch.packaging.test.DockerTests/test022InstallPlugin
@pugnascotia This will likely need to be included in your backport of
#80734
# Conflicts:
#	qa/os/src/test/java/org/elasticsearch/packaging/test/DockerTests.java

* Fix compiler error
2021-11-16 14:07:04 -05:00
Rory Hunter
0724109ad2
Introduce declarative plugin management (#77544) (#80734)
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 13:53:03 -05:00
David Turner
9acb783b93
Set LIBFFI_TMPDIR at startup (#80651) (#80699)
* Set LIBFFI_TMPDIR at startup (#80651)

Today if `libffi` cannot allocate pages of memory which are both
writeable and executable then it will attempt to write code to a
temporary file. Elasticsearch configures itself a suitable temporary
directory for use by JNA but by default `libffi` won't find this
directory and will try various other places. In certain configurations,
none of the other places that `libffi` tries are suitable. With older
versions of JNA this would result in a `SIGSEGV`; since #80617 the JVM
will exit with an exception.

With this commit we use the `LIBFFI_TMPDIR` environment variable to
configure `libffi` to use the same directory as JNA for its temporary
files if they are needed.

Closes #18272
Closes #73309
Closes #74545
Closes #77014
Closes #77053
Relates #77285

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>

* Fix incorrect SSL usage

Co-authored-by: Rory Hunter <roryhunter2@gmail.com>
2021-11-15 09:45:48 -05:00
Rory Hunter
720e1e65cb Fix imports 2021-11-10 13:53:21 +00:00
Rory Hunter
4f17b3db51 Use almalinux as the Docker base image (#80524)
Closes #76681. Our approach to using `scratch` for building Docker
images has caused problems at Docker Hub. Fix this situation by
removing the whole process of using scratch and instead bases the
default distribution on `almalinux:8.4-minimal`. Alma Linux is
binary-compatible with RHEL, and therefore very similar to UBI.
2021-11-10 13:42:02 +00:00
Mark Vieira
3552fcfce3
Tweak packaging test assertion to support RHEL 7 (#80372) (#80387)
Systemd exit codes on RedHat "flavored" distributions behave a bit
differently and we have to account for this in our test assertions. This
adds RHEL to the list of distributions that behave similarly. Closes
#80327
2021-11-04 19:41:22 -04:00
Przemyslaw Gomulka
e25cf1abeb
Deprecation logs indexing is enabled by default. Backport(#78991) (#79035)
Changing the default for deprecation log indexing to be true.
This commit also overrides this default to tests where a deprecation
data stream would interfere - because it uses index template, it would
not be possible to delete with _index_template/*.
The overrides should be removed when #78850 is done.

closes #76292
backport #78991
2021-10-18 18:36:59 +02:00
Rory Hunter
f75ba8b17a Improve Docker image caching and testing (#78552)
Firstly: we tag our Docker images with various pieces of information,
including a timestamp for when the image was built. However, this makes
it impossible completely cache the image. When developing the Docker
images, it's very tedious to completely rebuild an image for every
single change. Therefore, provided we're not building a proper release
build, we fix the build time to midnight so that the Docker build cache
is usable.

Secondly: the `DockerBuildTask` outputs a marker file to indicate that
an image has been built, but that isn't enough for a meaningful
up-to-date check by Gradle. Improve this by fetching the newly-built
image's hash, and writing that to the output file.

Thirdly: improve the Docker tests to make them more ergonomic, and also
disable `ingest.geoip.downloader.enabled` by default.

Fourthly: add missing test coverage for sourcing settings from env vars.
2021-10-07 10:17:43 +01:00
Rory Hunter
b92dca606c Use alpine:3.13, not latest 2021-10-06 09:06:53 +01:00
Mark Vieira
76733d92ee
Remove example-plugins included build (#78408) (#78420) 2021-09-28 15:31:09 -07:00
Rory Hunter
40456b32a0 Revert "Re-enable DockerTests.test124CanRestartContainerWithStackLoggingConfig"
This reverts commit 9e32c036a2.
2021-09-11 15:13:44 +01:00
Rory Hunter
9e32c036a2 Re-enable DockerTests.test124CanRestartContainerWithStackLoggingConfig
Let's see whether #73126 reoccurs.
2021-09-10 11:18:18 +01:00
Rory Hunter
cf8ae49d24
Handle cgroups v2 in OsProbe (#77128) (#77306)
* Handle cgroups v2 in `OsProbe` (#77128)

Closes #76812. Closes #77126.

OsProbe was only capable of handle cgroup data in the v1 format.
However, Debian 11 uses cgroups v2 by default, and Elasticsearch isn't
capable of reporting any cgroup information. Therefore, add support for
the v2 layout.

Note that we have to open access to all of /sys/fs/cgroup because with
cgroups v2, the files we need are in an unpredictably location.

* Handle a max memory value of 'max' (#77289)

* Handle a max memory value of 'max'

* Update docs/changelog/77289.yaml

* Delete 77289.yaml

* Fixes to backport

* Fix
2021-09-06 10:09:31 -04:00
Rory Hunter
bad1b375c4 Revert "Handle cgroups v2 in OsProbe (#76883)"
This reverts commits 722a71bc02 and eff6cd69e6
2021-09-01 14:38:28 +01:00
Rory Hunter
eff6cd69e6 Handle cgroups v2 in OsProbe (#76883)
Closes #76812.

`OsProbe` was only capable of handle cgroup data in the v1 format.
However, Debian 11 uses cgroups v2 by default, and Elasticsearch isn't
capable of reporting any cgroup information. Therefore, add support for
the v2 layout.
2021-09-01 12:00:21 +01:00
Rory Hunter
4fc44b3cc9 Still trying to squash Docker test failure 2021-08-24 16:28:52 +01:00
Rory Hunter
f387ec6cc5 Add code to diagnose #76861 2021-08-24 09:46:46 +01:00
Rory Hunter
40242a823d Fix DockerTests.test010Install 2021-08-23 16:42:54 +01:00
Rory Hunter
ca0440ff83 Mute DockerTests.test140CgroupOsStatsAreAvailable
See #76812
2021-08-23 13:34:56 +01:00
Rory Hunter
f9e8bb5b36
Introduce Cloud docker variant (#74980) (#76790)
* Introduce Cloud docker variant (#74980)

Closes #74795.

Introduce two Docker image variants for Cloud. The first bundles
(actually installs) the S3, Azure and GCS repository plugins. The
second bundles all official plugins, but only installs the repository
plugins.

Both images also bundle Filebeat and Metricbeat.

The testing utils have been refactored to introduce a `docker`
sub-package. This allows the static `Docker.containerId` to be
shared without needing all the code in one big class. The code for
checking file ownership / permissions has also been refactored to
a more Hamcrest style, using a custom Docker file matcher.

* Don't build Cloud docker images on assemble

* Backport fixes

* Tweak Dockerfile.cloud-ess

Some Docker builds are apparently complaining about the `COPY` syntax in
this file, so try and fix it as Docker suggests.

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2021-08-23 07:38:43 -04:00