* 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>
367 строки
13 KiB
YAML
367 строки
13 KiB
YAML
# Base CI template which is called from server-ci-pr.yml
|
|
# and server-ci-master.yml
|
|
|
|
name: Server CI Template
|
|
on:
|
|
workflow_call:
|
|
|
|
jobs:
|
|
check-mocks:
|
|
name: Check mocks
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Generate mocks
|
|
run: make mocks
|
|
- name: Check mocks
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the mocks using `make mocks`"; exit 1; fi
|
|
check-go-mod-tidy:
|
|
name: Check go mod tidy
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Run go mod tidy
|
|
run: make modules-tidy
|
|
- name: Check modules
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please tidy up the Go modules using make modules-tidy"; git diff; exit 1; fi
|
|
golangci:
|
|
name: golangci-lint
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Run golangci
|
|
run: make golangci-lint
|
|
check-gen-serialized:
|
|
name: Check serialization methods for hot structs
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Run make-gen-serialized
|
|
run: make gen-serialized
|
|
- name: Check serialized
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the serialized files using 'make gen-serialized'"; exit 1; fi
|
|
check-mattermost-vet:
|
|
name: Check style
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Reset config
|
|
run: make config-reset
|
|
- name: Run plugin-checker
|
|
run: make plugin-checker
|
|
- name: Run mattermost-vet
|
|
run: make vet BUILD_NUMBER='${GITHUB_HEAD_REF}'
|
|
check-mattermost-vet-api:
|
|
name: Vet API
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Run mattermost-vet-api
|
|
run: make vet-api
|
|
check-migrations:
|
|
name: Check migration files
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Extract migrations files
|
|
run: make migrations-extract
|
|
- name: Check migration files
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the migrations using make migrations-extract"; exit 1; fi
|
|
check-email-templates:
|
|
name: Generate email templates
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Generate email templates
|
|
run: |
|
|
sudo npm install -g mjml@4.9.0
|
|
make build-templates
|
|
- name: Check generated email templates
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the email templates using `make build-templates`"; exit 1; fi
|
|
check-store-layers:
|
|
name: Check store layers
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Generate store layers
|
|
run: make store-layers
|
|
- name: Check generated code
|
|
run: if [[ -n $(git status --porcelain) ]]; then echo "Please update the store layers using make store-layers"; exit 1; fi
|
|
check-mmctl-docs:
|
|
name: Check mmctl docs
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
steps:
|
|
- name: Checkout mattermost-server
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Check docs
|
|
run: |
|
|
echo "Making sure docs are updated"
|
|
make mmctl-docs
|
|
if [[ -n $(git status --porcelain) ]]; then echo "Please update the mmctl docs using make mmctl-docs"; exit 1; fi
|
|
test-postgres-binary:
|
|
if: github.ref_name != 'master' # Do not run postgres binary tests on master
|
|
name: Postgres with binary parameters
|
|
needs: check-mattermost-vet
|
|
uses: ./.github/workflows/server-test-template.yml
|
|
secrets: inherit
|
|
with:
|
|
name: Postgres with binary parameters
|
|
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10&binary_parameters=yes
|
|
drivername: postgres
|
|
logsartifact: postgres-binary-server-test-logs
|
|
test-postgres-normal:
|
|
name: Postgres
|
|
needs: check-mattermost-vet
|
|
uses: ./.github/workflows/server-test-template.yml
|
|
secrets: inherit
|
|
with:
|
|
name: Postgres
|
|
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
|
|
drivername: postgres
|
|
logsartifact: postgres-server-test-logs
|
|
test-mysql:
|
|
name: MySQL
|
|
needs: check-mattermost-vet
|
|
uses: ./.github/workflows/server-test-template.yml
|
|
secrets: inherit
|
|
with:
|
|
name: MySQL
|
|
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-') }}
|
|
name: Generate Test Coverage
|
|
needs: check-mattermost-vet
|
|
uses: ./.github/workflows/server-test-template.yml
|
|
secrets: inherit
|
|
with:
|
|
name: Generate Test Coverage
|
|
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
|
|
drivername: postgres
|
|
logsartifact: coverage-server-test-logs
|
|
fullyparallel: true
|
|
enablecoverage: true
|
|
test-mmctl:
|
|
name: Run mmctl tests
|
|
needs: check-mattermost-vet
|
|
uses: ./.github/workflows/mmctl-test-template.yml
|
|
secrets: inherit
|
|
with:
|
|
name: mmctl
|
|
datasource: postgres://mmuser:mostest@postgres:5432/mattermost_test?sslmode=disable&connect_timeout=10
|
|
drivername: postgres
|
|
logsartifact: mmctl-test-logs
|
|
build-mattermost-server:
|
|
name: Build mattermost server app
|
|
runs-on: ubuntu-22.04
|
|
defaults:
|
|
run:
|
|
working-directory: server
|
|
needs: check-mattermost-vet
|
|
steps:
|
|
- name: Checkout mattermost project
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
- name: Calculate Golang Version
|
|
id: go
|
|
run: echo GO_VERSION=$(cat .go-version) >> "${GITHUB_OUTPUT}"
|
|
- name: Setup Go
|
|
uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0
|
|
with:
|
|
go-version: ${{ steps.go.outputs.GO_VERSION }}
|
|
cache-dependency-path: |
|
|
server/go.sum
|
|
server/public/go.sum
|
|
- name: ci/setup-node
|
|
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
|
|
id: setup_node
|
|
with:
|
|
node-version-file: ".nvmrc"
|
|
cache: npm
|
|
cache-dependency-path: "webapp/package-lock.json"
|
|
- name: Run setup-go-work
|
|
run: make setup-go-work
|
|
- name: Build
|
|
run: |
|
|
make config-reset
|
|
make build-cmd BUILD_NUMBER='${GITHUB_HEAD_REF}-${GITHUB_RUN_ID}'
|
|
make package BUILD_NUMBER='${GITHUB_HEAD_REF}-${GITHUB_RUN_ID}'
|
|
- name: Persist dist artifacts
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: server-dist-artifact
|
|
path: server/dist/
|
|
if-no-files-found: error
|
|
compression-level: 0
|
|
retention-days: 2
|
|
- name: Persist build artifacts
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: server-build-artifact
|
|
path: server/build/
|
|
retention-days: 2
|
|
test-migration:
|
|
name: MySQL to PostgreSQL Migration
|
|
uses: ./.github/workflows/migration.yml
|
|
secrets: inherit
|