diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4ffabf0a44..ba6e11f6f8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -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 @@ -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: @@ -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 diff --git a/elasticsearch-auth.yml b/elasticsearch-auth.yml deleted file mode 100644 index 41e3e4963b..0000000000 --- a/elasticsearch-auth.yml +++ /dev/null @@ -1,13 +0,0 @@ -cluster.name: "docker-cluster" -network.host: 0.0.0.0 - -# Enable security features -xpack.security.enabled: true - -xpack.security.enrollment.enabled: true - -# Disable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents -xpack.security.http.ssl.enabled: false - -# Disable encryption and mutual authentication between cluster nodes -xpack.security.transport.ssl.enabled: false diff --git a/elasticsearch.yml b/elasticsearch.yml deleted file mode 100644 index dfba8ad60d..0000000000 --- a/elasticsearch.yml +++ /dev/null @@ -1,5 +0,0 @@ -cluster.name: "docker-cluster" -network.host: 0.0.0.0 - -# Disable security features -xpack.security.enabled: false