Skip to content

Commit

Permalink
Add opensearch to github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social committed Jul 7, 2022
1 parent 6a8ac6e commit 5300f3e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 28 deletions.
45 changes: 35 additions & 10 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,22 @@ jobs:
java-version: [11]
es-major-version: [6, 7, 8]
include:
- es-major-version: 6
es-version: 6.8.23
- es-distribution: elasticsearch
es-major-version: 6
es-image: elasticsearch:6.8.23
es-config: elasticsearch.yml
- es-major-version: 7
es-version: 7.17.3
- es-distribution: elasticsearch
es-major-version: 7
es-image: elasticsearch:7.17.3
es-config: elasticsearch.yml
- es-major-version: 8
es-version: 8.1.2
- es-distribution: elasticsearch
es-major-version: 8
es-image: elasticsearch:8.1.2
es-config: elasticsearch-auth.yml
- es-distribution: opensearch
es-major-version: 2
es-image: opensearchproject/opensearch:2.0.1
es-config: elasticsearch.yml
steps:
- uses: actions/checkout@v2

Expand All @@ -125,31 +132,41 @@ jobs:
docker run -d \
--name elasticsearch \
-p 9200:9200 \
-v $(pwd)/${{ matrix.es-config }}:/usr/share/elasticsearch/config/elasticsearch.yml \
-e "discovery.type=single-node" \
-e "ES_JAVA_OPTS=-Xms128m -Xmx256m" \
--health-cmd="curl http://localhost:9200/_cluster/health" \
--health-interval=5s \
--health-timeout=2s \
--health-retries=10 \
elasticsearch:${{ matrix.es-version }}
${{ matrix.es-image }}
echo -n "Waiting Elasticsearch "
until [ $(docker inspect -f '{{.State.Health.Status}}' elasticsearch) == "healthy" ]; do
sleep 1
echo -n .
done
echo "ELASTIC_URL=http://localhost:9200" >> $GITHUB_ENV
- name: Setup Elasticsearch password
if: ${{ matrix.es-major-version >= 8 }}
if: matrix.es-distribution == 'elasticsearch' && matrix.es-major-version >= 8
run: |
set -eux
set -eu
ELASTIC_PASSWORD=$( \
docker exec elasticsearch \
/usr/share/elasticsearch/bin/elasticsearch-reset-password --batch -u elastic | \
awk 'BEGIN { FS=": "; } /^New value:/ { print $2; }' \
)
echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV
echo "ELASTIC_USER=elastic" >> $GITHUB_ENV
echo "ELASTIC_PASSWORD=$ELASTIC_PASSWORD" >> $GITHUB_ENV
- name: Opensearch settings
if: matrix.es-distribution == 'opensearch'
run: |
set -eu
echo "ELASTIC_URL=https://localhost:9200" >> $GITHUB_ENV
echo "ELASTIC_USER=admin" >> $GITHUB_ENV
echo "ELASTIC_PASSWORD=admin" >> $GITHUB_ENV
- name: Setup
uses: ./.github/setup
with:
Expand All @@ -164,18 +181,26 @@ jobs:
- name: Run integration tests
run: |
set -eux
# Allow self-signed certificates for JS engine: https://stackoverflow.com/a/66476468/473308
export NODE_TLS_REJECT_UNAUTHORIZED=0
export ELASTIC_URL='${{ env.ELASTIC_URL }}'
export ELASTIC_USER='${{ env.ELASTIC_USER }}'
export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}'
./gradlew :integ-tests:check $GRADLE_ARGS
- name: Run samples JVM
run: |
set -eux
export ELASTIC_URL='${{ env.ELASTIC_URL }}'
export ELASTIC_USER='${{ env.ELASTIC_USER }}'
export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}'
./gradlew run -p samples $GRADLE_ARGS
- name: Run samples native
run: |
set -eux
export ELASTIC_URL='${{ env.ELASTIC_URL }}'
export ELASTIC_USER='${{ env.ELASTIC_USER }}'
export ELASTIC_PASSWORD='${{ env.ELASTIC_PASSWORD }}'
./gradlew runDebugExecutableNative -p samples $GRADLE_ARGS
Expand Down
13 changes: 0 additions & 13 deletions elasticsearch-auth.yml

This file was deleted.

5 changes: 0 additions & 5 deletions elasticsearch.yml

This file was deleted.

0 comments on commit 5300f3e

Please sign in to comment.