Support Elasticsearch v9 (for v10.11) (#35925)

* Support Elasticsearch v9 alongside v8

* Add CI workflow changes for Elasticsearch v8/v9 testing

* Support Elasticsearch v7 in addition to v8/v9, add v7 CI test job

Lowers the minimum supported ES version from 8 to 7 to avoid dropping
v7 support in a dot release. Adds a dedicated CI job to verify v7
compatibility alongside the existing v8 and v9 (default) jobs.

* Fix ES7 plugin install crash on cgroup v2 hosts

* Fix ES 7 container startup on cgroup v2 Linux (GitHub Actions)

ES 7 bundles JDK 11, which crashes with a NullPointerException in
CgroupV2Subsystem.getMountPoint() on modern Linux kernels that use
cgroup v2 (including GitHub Actions ubuntu-latest runners). The flag
was already set during the Dockerfile RUN step, but not at runtime.

Adding -XX:-UseContainerSupport to ES_JAVA_OPTS in docker-compose
fixes the crash. The flag is harmless on ES 8/9 which ship JDK 17+
where the cgroup v2 bug is fixed (it simply opts out of container-aware
JVM sizing).

* Capture docker compose logs in CI test artifact

* Use ES 7.17.29 for v7 CI test; remove cgroup v2 workarounds

ES 7.17.0 bundled JDK 17.0.1 which had a cgroup v2 bug
(CgroupV2Subsystem NPE) not fixable via -XX:-UseContainerSupport.
ES 7.17.29 bundles JDK 22 where the bug is long fixed.

Reverts the -XX:-UseContainerSupport workarounds added in the
previous two commits as they were based on a wrong diagnosis
and are no longer needed.

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Jesse Hallam
2026-04-20 15:44:31 -03:00
коммит произвёл GitHub
родитель b65ae49523
Коммит f6760151c4
8 изменённых файлов: 182 добавлений и 11 удалений

24
.github/workflows/server-ci-template.yml поставляемый
Просмотреть файл

@@ -264,6 +264,30 @@ jobs:
datasource: mmuser:mostest@tcp(mysql:3306)/mattermost_test?charset=utf8mb4&multiStatements=true&maxAllowedPacket=4194304
drivername: mysql
logsartifact: mysql-server-test-logs
test-elasticsearch-v8:
name: Elasticsearch v8 Compatibility
needs: check-mattermost-vet
uses: ./.github/workflows/server-test-template.yml
secrets: inherit
with:
name: Elasticsearch v8 Compatibility
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
drivername: postgres
logsartifact: elasticsearch-v8-server-test-logs
elasticsearch-version: "8.9.0"
test-target: "test-server-elasticsearch"
test-elasticsearch-v7:
name: Elasticsearch v7 Compatibility
needs: check-mattermost-vet
uses: ./.github/workflows/server-test-template.yml
secrets: inherit
with:
name: Elasticsearch v7 Compatibility
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
drivername: postgres
logsartifact: elasticsearch-v7-server-test-logs
elasticsearch-version: "7.17.29"
test-target: "test-server-elasticsearch"
test-coverage:
# Skip coverage generation for cherry-pick PRs into release branches.
if: ${{ github.event_name != 'pull_request' || !startsWith(github.event.pull_request.base.ref, 'release-') }}

17
.github/workflows/server-test-template.yml поставляемый
Просмотреть файл

@@ -22,6 +22,14 @@ on:
required: false
type: boolean
default: false
elasticsearch-version:
required: false
type: string
default: "9.0.0"
test-target:
required: false
type: string
default: "test-server"
# -- Test sharding inputs (leave defaults for non-sharded callers) --
shard-index:
required: false
@@ -75,6 +83,8 @@ jobs:
echo "${{ inputs.name }}" > server/test-name
echo "${{ github.event.pull_request.number }}" > server/pr-number
- name: Run docker compose
env:
ELASTICSEARCH_VERSION: ${{ inputs.elasticsearch-version }}
run: |
cd server/build
docker compose --ansi never run --rm start_dependencies
@@ -143,11 +153,11 @@ jobs:
env:
BUILD_IMAGE: mattermost/mattermost-build-server:${{ steps.go.outputs.GO_VERSION }}
run: |
if [[ ${{ github.ref_name }} == 'master' && ${{ inputs.fullyparallel }} != true ]]; then
if [[ ${{ github.ref_name }} == 'master' && ${{ inputs.fullyparallel }} != true && "${{ inputs.test-target }}" == "test-server" ]]; then
export RACE_MODE="-race"
fi
TEST_TARGET="test-server${RACE_MODE}"
TEST_TARGET="${{ inputs.test-target }}${RACE_MODE}"
BUILD_NUMBER="${GITHUB_HEAD_REF}-${GITHUB_RUN_ID}"
DOCKER_CMD="make ${TEST_TARGET}"
@@ -186,8 +196,10 @@ jobs:
disable_search: true
files: server/cover.out
- name: Stop docker compose
if: ${{ always() }}
run: |
cd server/build
docker compose --ansi never logs --no-color > ../../docker-compose.log 2>&1
docker compose --ansi never stop
- name: Archive logs
if: ${{ always() }}
@@ -200,4 +212,5 @@ jobs:
server/cover.out
server/test-name
server/pr-number
docker-compose.log