Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use docker compose for elasticsearch/opensearch integration tests #5490

Merged
merged 16 commits into from
May 28, 2024
30 changes: 21 additions & 9 deletions .github/workflows/ci-elasticsearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version:
- major: 7.x
image: 7.14.0
distribution: elasticsearch
- major: 8.x
image: 8.8.2
distribution: elasticsearch
name: ${{ matrix.version.distribution }} ${{ matrix.version.major }}
major-version: [7, 8]
name: Elasticsearch v${{ matrix.major-version }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
Expand All @@ -50,10 +44,24 @@ jobs:
run: make install-ci

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Set up Elasticsearch
run: |
docker-compose -f ./.github/workflows/docker-compose-elasticsearch-v${{ matrix.major-version }}.yml up -d
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved

- name: Run elasticsearch integration tests
id: test-execution
run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }}
run: |
if [ "${{ matrix.major-version }}" = "7" ]; then
export ELASTICSEARCH_VERSION=$(grep 'image: docker.elastic.co/elasticsearch/elasticsearch' $(pwd)/.github/workflows/docker-compose-elasticsearch-v7.yml | cut -d ':' -f3)
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
elif [ "${{ matrix.major-version }}" = "8" ]; then
export ELASTICSEARCH_VERSION=$(grep 'image: docker.elastic.co/elasticsearch/elasticsearch' $(pwd)/.github/workflows/docker-compose-elasticsearch-v7.yml | cut -d ':' -f3)
else
echo "Unsupported Elasticsearch version"
exit 1
fi
echo "Elasticsearch version: $ELASTICSEARCH_VERSION"
bash scripts/es-integration-test.sh elasticsearch $ELASTICSEARCH_VERSION

- name: Output Elasticsearch logs
run: docker logs ${{ steps.test-execution.outputs.cid }}
Expand All @@ -64,3 +72,7 @@ jobs:
with:
files: cover.out,cover-index-cleaner.out,cover-index-rollover.out
flags: elasticsearch-${{ matrix.version.major }}
- name: Tear down
run: |
docker-compose -f ./.github/workflows/docker-compose-elasticsearch-v${{ matrix.major-version }}.yml down

10 changes: 10 additions & 0 deletions .github/workflows/docker-compose-elasticsearch-v7.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0
environment:
- discovery.type=single-node
ports:
- "9200:9200"
- "9300:9300"
10 changes: 10 additions & 0 deletions .github/workflows/docker-compose-elasticsearch-v8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.8'

services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2
environment:
- discovery.type=single-node
ports:
- "9200:9200"
- "9300:9300"