From 259f7ef66b604d08b86ac27e46881f8406525f67 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 May 2024 03:24:38 +0530 Subject: [PATCH 01/11] updating ci Signed-off-by: Your Name --- .github/workflows/ci-elasticsearch.yml | 30 +++++++++++++------ .../docker-compose-elasticsearch-v7.yml | 10 +++++++ .../docker-compose-elasticsearch-v8.yml | 10 +++++++ 3 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/docker-compose-elasticsearch-v7.yml create mode 100644 .github/workflows/docker-compose-elasticsearch-v8.yml diff --git a/.github/workflows/ci-elasticsearch.yml b/.github/workflows/ci-elasticsearch.yml index a87e511b785..106508ce37a 100644 --- a/.github/workflows/ci-elasticsearch.yml +++ b/.github/workflows/ci-elasticsearch.yml @@ -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 @@ -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 - 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) + 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 }} @@ -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 + diff --git a/.github/workflows/docker-compose-elasticsearch-v7.yml b/.github/workflows/docker-compose-elasticsearch-v7.yml new file mode 100644 index 00000000000..b4fd82e24fb --- /dev/null +++ b/.github/workflows/docker-compose-elasticsearch-v7.yml @@ -0,0 +1,10 @@ +version: '3.8' + +services: + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0 + environment: + - discovery.type=single-node + ports: + - "9200:9200" + - "9300:9300" diff --git a/.github/workflows/docker-compose-elasticsearch-v8.yml b/.github/workflows/docker-compose-elasticsearch-v8.yml new file mode 100644 index 00000000000..b8453a47194 --- /dev/null +++ b/.github/workflows/docker-compose-elasticsearch-v8.yml @@ -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" From e2ab38d9cc74168c3fae50e184bbd764f2d44ce9 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 May 2024 15:05:17 +0530 Subject: [PATCH 02/11] updated CI Signed-off-by: Your Name --- .github/workflows/ci-elasticsearch.yml | 36 +++--- .github/workflows/ci-opensearch.yml | 18 +-- .../docker-compose-elasticsearch-v7.yml | 5 +- .../docker-compose-elasticsearch-v8.yml | 0 .../docker-compose-opensearch-v1.yml | 11 ++ .../docker-compose-opensearch-v2.yml | 11 ++ scripts/es-integration-test.sh | 109 ++++++++---------- 7 files changed, 100 insertions(+), 90 deletions(-) rename {.github/workflows => docker-compose/elasticsearch}/docker-compose-elasticsearch-v7.yml (68%) rename {.github/workflows => docker-compose/elasticsearch}/docker-compose-elasticsearch-v8.yml (100%) create mode 100644 docker-compose/opensearch/docker-compose-opensearch-v1.yml create mode 100644 docker-compose/opensearch/docker-compose-opensearch-v2.yml diff --git a/.github/workflows/ci-elasticsearch.yml b/.github/workflows/ci-elasticsearch.yml index 106508ce37a..f4128f64677 100644 --- a/.github/workflows/ci-elasticsearch.yml +++ b/.github/workflows/ci-elasticsearch.yml @@ -20,8 +20,17 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - major-version: [7, 8] - name: Elasticsearch v${{ matrix.major-version }} + version: + - major: 7.x + distribution: elasticsearch + jaeger: v1 + - major: 8.x + distribution: elasticsearch + jaeger: v1 + - major: 8.x + distribution: elasticsearch + jaeger: v2 + name: ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} steps: - name: Harden Runner uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 @@ -44,24 +53,9 @@ 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 - - - name: Run elasticsearch integration tests + - name: Run ${{ matrix.version.distribution }} integration tests id: test-execution - 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) - 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 + run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - name: Output Elasticsearch logs run: docker logs ${{ steps.test-execution.outputs.cid }} @@ -72,7 +66,5 @@ 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 + diff --git a/.github/workflows/ci-opensearch.yml b/.github/workflows/ci-opensearch.yml index 6556a36360c..acaf7d306c3 100644 --- a/.github/workflows/ci-opensearch.yml +++ b/.github/workflows/ci-opensearch.yml @@ -19,15 +19,19 @@ jobs: opensearch: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: version: - major: 1.x - image: 1.3.7 distribution: opensearch + jaeger: v1 - major: 2.x - image: 2.3.0 distribution: opensearch - name: ${{ matrix.version.distribution }} ${{ matrix.version.major }} + jaeger: v1 + - major: 2.x + distribution: opensearch + jaeger: v2 + name: ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} steps: - name: Harden Runner uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 @@ -51,11 +55,11 @@ jobs: - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 - - name: Run opensearch integration tests + - name: Run ${{ matrix.version.distribution }} integration tests id: test-execution - run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.image }} + run: bash scripts/es-integration-test.sh ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.version.jaeger }} - - name: Output Opensearch logs + - name: Output ${{ matrix.version.distribution }} logs run: docker logs ${{ steps.test-execution.outputs.cid }} if: ${{ failure() }} @@ -63,4 +67,4 @@ jobs: uses: ./.github/actions/upload-codecov with: files: cover.out,cover-index-cleaner.out,cover-index-rollover.out - flags: opensearch-${{ matrix.version.major }} + flags: ${{ matrix.version.distribution }}-${{ matrix.version.major }}-${{ matrix.version.jaeger }} diff --git a/.github/workflows/docker-compose-elasticsearch-v7.yml b/docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml similarity index 68% rename from .github/workflows/docker-compose-elasticsearch-v7.yml rename to docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml index b4fd82e24fb..edf45199c05 100644 --- a/.github/workflows/docker-compose-elasticsearch-v7.yml +++ b/docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml @@ -5,6 +5,7 @@ services: image: docker.elastic.co/elasticsearch/elasticsearch:7.14.0 environment: - discovery.type=single-node + - http.host=0.0.0.0 + - transport.host=127.0.0.1 ports: - - "9200:9200" - - "9300:9300" + - "9200:9200" \ No newline at end of file diff --git a/.github/workflows/docker-compose-elasticsearch-v8.yml b/docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml similarity index 100% rename from .github/workflows/docker-compose-elasticsearch-v8.yml rename to docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml diff --git a/docker-compose/opensearch/docker-compose-opensearch-v1.yml b/docker-compose/opensearch/docker-compose-opensearch-v1.yml new file mode 100644 index 00000000000..79066b60042 --- /dev/null +++ b/docker-compose/opensearch/docker-compose-opensearch-v1.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + opensearch: + image: opensearchproject/opensearch:1.3.9 + environment: + - discovery.type=single-node + - plugins.security.disabled=true + ports: + - "9200:9200" + - "9600:9600" diff --git a/docker-compose/opensearch/docker-compose-opensearch-v2.yml b/docker-compose/opensearch/docker-compose-opensearch-v2.yml new file mode 100644 index 00000000000..0a2dc98c6b6 --- /dev/null +++ b/docker-compose/opensearch/docker-compose-opensearch-v2.yml @@ -0,0 +1,11 @@ +version: '3.8' + +services: + opensearch: + image: opensearchproject/opensearch:2.5.0 + environment: + - discovery.type=single-node + - plugins.security.disabled=true + ports: + - "9200:9200" + - "9600:9600" diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index f4f11d4be6a..0ded6753f3c 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -12,60 +12,46 @@ usage() { } check_arg() { - if [ ! $# -eq 2 ]; then - echo "ERROR: need exactly two arguments, " + if [ ! $# -eq 3 ]; then + echo "ERROR: need exactly two arguments, " usage fi } setup_es() { local tag=$1 - local image=docker.elastic.co/elasticsearch/elasticsearch - local params=( - --detach - --publish 9200:9200 - --env "http.host=0.0.0.0" - --env "transport.host=127.0.0.1" - --env "xpack.security.enabled=false" - ) local major_version=${tag%%.*} + local compose_file + if (( major_version < 8 )); then - params+=(--env "xpack.monitoring.enabled=false") + compose_file="docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml" else - params+=(--env "xpack.monitoring.collection.enabled=false") - fi - if (( major_version > 7 )); then - params+=( - --env "action.destructive_requires_name=false" - ) + compose_file="docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml" fi - local cid - cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "cid=${cid}" >> "$GITHUB_OUTPUT" - echo "${cid}" + docker-compose -f ${compose_file} up -d + echo "${compose_file}" } setup_opensearch() { - local image=opensearchproject/opensearch local tag=$1 - local params=( - --detach - --publish 9200:9200 - --env "http.host=0.0.0.0" - --env "transport.host=127.0.0.1" - --env "plugins.security.disabled=true" - ) - local cid - cid=$(docker run "${params[@]}" "${image}:${tag}") - echo "cid=${cid}" >> "$GITHUB_OUTPUT" - echo "${cid}" + local major_version=${tag%%.*} + local compose_file + + if (( major_version < 2 )); then + compose_file="docker-compose/opensearch/docker-compose-opensearch-v1.yml" + else + compose_file="docker-compose/opensearch/docker-compose-opensearch-v2.yml" + fi + + docker-compose -f ${compose_file} up -d + echo "${compose_file}" } wait_for_storage() { local distro=$1 local url=$2 - local cid=$3 + local compose_file=$3 local params=( --silent --output @@ -73,22 +59,22 @@ wait_for_storage() { --write-out "%{http_code}" ) - local counter=0 - local max_counter=60 - while [[ "$(curl "${params[@]}" "${url}")" != "200" && ${counter} -le ${max_counter} ]]; do - docker inspect "${cid}" | jq '.[].State' - echo "waiting for ${url} to be up..." + local max_attempts=60 + local attempt=0 + echo "Waiting for ${distro} to be available at ${url}..." + until [[ "$(curl "${params[@]}" "${url}")" == "200" ]] || (( attempt >= max_attempts )); do + echo "Attempt $(( attempt + 1 )): ${distro} is not yet available at ${url}..." sleep 10 - counter=$((counter+1)) + attempt=$(( attempt + 1 )) done - # after the loop, do final verification and set status as global var + if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then - echo "ERROR: ${distro} is not ready" - docker logs "${cid}" - docker kill "${cid}" - db_is_up=0 + echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" + docker-compose -f ${compose_file} logs + docker-compose -f ${compose_file} down + ds_is_up=0 else - echo "SUCCESS: ${distro} is ready" + echo "SUCCESS: ${distro} is available at ${url}" db_is_up=1 fi } @@ -103,21 +89,21 @@ bring_up_storage() { do echo "attempt $retry" if [ "${distro}" = "elasticsearch" ]; then - cid=$(setup_es "${version}") + compose_file=$(setup_es "${version}") elif [ "${distro}" == "opensearch" ]; then - cid=$(setup_opensearch "${version}") + compose_file=$(setup_opensearch "${version}") else echo "Unknown distribution $distro. Valid options are opensearch or elasticsearch" usage fi - wait_for_storage "${distro}" "http://localhost:9200" "${cid}" + wait_for_storage "${distro}" "http://localhost:9200" "${compose_file}" if [ ${db_is_up} = "1" ]; then break fi done if [ ${db_is_up} = "1" ]; then # shellcheck disable=SC2064 - trap "teardown_storage ${cid}" EXIT + trap "teardown_storage ${compose_file}" EXIT else echo "ERROR: unable to start ${distro}" exit 1 @@ -125,20 +111,25 @@ bring_up_storage() { } teardown_storage() { - local cid=$1 - docker kill "${cid}" + local compose_file=$1 + docker-compose -f ${compose_file} down } main() { check_arg "$@" local distro=$1 - local version=$2 + local es_version=$2 + local j_version=$2 + + bring_up_storage "${distro}" "${es_version}" - bring_up_storage "${distro}" "${version}" - STORAGE=${distro} make storage-integration-test - STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test - make index-cleaner-integration-test - make index-rollover-integration-test + if [[ "${j_version}" == "v2" ]]; then + STORAGE=${distro} SPAN_STORAGE_TYPE=${distro} make jaeger-v2-storage-integration-test + else + STORAGE=${distro} make storage-integration-test + make index-cleaner-integration-test + make index-rollover-integration-test + fi } -main "$@" +main "$@" \ No newline at end of file From 3530702f9edb448a0cc0ae9c03ac8733923c208b Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 May 2024 23:14:13 +0530 Subject: [PATCH 03/11] made changes Signed-off-by: Your Name --- .../docker-compose-elasticsearch-v8.yml | 10 ---------- ...er-compose-elasticsearch-v7.yml => v7.yml} | 2 ++ docker-compose/elasticsearch/v8.yml | 14 +++++++++++++ ...ocker-compose-opensearch-v1.yml => v1.yml} | 5 +++-- ...ocker-compose-opensearch-v2.yml => v2.yml} | 6 ++++-- scripts/es-integration-test.sh | 20 +++---------------- 6 files changed, 26 insertions(+), 31 deletions(-) delete mode 100644 docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml rename docker-compose/elasticsearch/{docker-compose-elasticsearch-v7.yml => v7.yml} (65%) create mode 100644 docker-compose/elasticsearch/v8.yml rename docker-compose/opensearch/{docker-compose-opensearch-v1.yml => v1.yml} (69%) rename docker-compose/opensearch/{docker-compose-opensearch-v2.yml => v2.yml} (68%) diff --git a/docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml b/docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml deleted file mode 100644 index b8453a47194..00000000000 --- a/docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml +++ /dev/null @@ -1,10 +0,0 @@ -version: '3.8' - -services: - elasticsearch: - image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2 - environment: - - discovery.type=single-node - ports: - - "9200:9200" - - "9300:9300" diff --git a/docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml b/docker-compose/elasticsearch/v7.yml similarity index 65% rename from docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml rename to docker-compose/elasticsearch/v7.yml index edf45199c05..1bddbd9f057 100644 --- a/docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml +++ b/docker-compose/elasticsearch/v7.yml @@ -7,5 +7,7 @@ services: - discovery.type=single-node - http.host=0.0.0.0 - transport.host=127.0.0.1 + - xpack.security.enabled=false # Disable security features + - xpack.security.http.ssl.enabled=false # Disable HTTPS ports: - "9200:9200" \ No newline at end of file diff --git a/docker-compose/elasticsearch/v8.yml b/docker-compose/elasticsearch/v8.yml new file mode 100644 index 00000000000..5f4b97f52da --- /dev/null +++ b/docker-compose/elasticsearch/v8.yml @@ -0,0 +1,14 @@ +version: '3.8' + +services: + elasticsearch: + image: docker.elastic.co/elasticsearch/elasticsearch:8.8.2 + environment: + - discovery.type=single-node + - http.host=0.0.0.0 + - transport.host=127.0.0.1 + - xpack.security.enabled=false # Disable security features + - xpack.security.http.ssl.enabled=false # Disable HTTPS + ports: + - "9200:9200" + diff --git a/docker-compose/opensearch/docker-compose-opensearch-v1.yml b/docker-compose/opensearch/v1.yml similarity index 69% rename from docker-compose/opensearch/docker-compose-opensearch-v1.yml rename to docker-compose/opensearch/v1.yml index 79066b60042..2fdbe34b0cb 100644 --- a/docker-compose/opensearch/docker-compose-opensearch-v1.yml +++ b/docker-compose/opensearch/v1.yml @@ -6,6 +6,7 @@ services: environment: - discovery.type=single-node - plugins.security.disabled=true + - http.host=0.0.0.0 + - transport.host=127.0.0.1 ports: - - "9200:9200" - - "9600:9600" + - "9200:9200" diff --git a/docker-compose/opensearch/docker-compose-opensearch-v2.yml b/docker-compose/opensearch/v2.yml similarity index 68% rename from docker-compose/opensearch/docker-compose-opensearch-v2.yml rename to docker-compose/opensearch/v2.yml index 0a2dc98c6b6..41b152784e2 100644 --- a/docker-compose/opensearch/docker-compose-opensearch-v2.yml +++ b/docker-compose/opensearch/v2.yml @@ -6,6 +6,8 @@ services: environment: - discovery.type=single-node - plugins.security.disabled=true + - http.host=0.0.0.0 + - transport.host=127.0.0.1 ports: - - "9200:9200" - - "9600:9600" + - "9200:9200" + diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 0ded6753f3c..58034441a82 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -20,30 +20,16 @@ check_arg() { setup_es() { local tag=$1 - local major_version=${tag%%.*} local compose_file - - if (( major_version < 8 )); then - compose_file="docker-compose/elasticsearch/docker-compose-elasticsearch-v7.yml" - else - compose_file="docker-compose/elasticsearch/docker-compose-elasticsearch-v8.yml" - fi - + compose_file="docker-compose/elasticsearch/v${tag}.yml" docker-compose -f ${compose_file} up -d echo "${compose_file}" } setup_opensearch() { local tag=$1 - local major_version=${tag%%.*} local compose_file - - if (( major_version < 2 )); then - compose_file="docker-compose/opensearch/docker-compose-opensearch-v1.yml" - else - compose_file="docker-compose/opensearch/docker-compose-opensearch-v2.yml" - fi - + compose_file="docker-compose/opensearch/v${tag}.yml" docker-compose -f ${compose_file} up -d echo "${compose_file}" } @@ -72,7 +58,7 @@ wait_for_storage() { echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" docker-compose -f ${compose_file} logs docker-compose -f ${compose_file} down - ds_is_up=0 + db_is_up=0 else echo "SUCCESS: ${distro} is available at ${url}" db_is_up=1 From dcdc168c5c1e72ca5a240b433937193a50d05b43 Mon Sep 17 00:00:00 2001 From: Your Name Date: Mon, 27 May 2024 23:41:38 +0530 Subject: [PATCH 04/11] fixed minor issue Signed-off-by: Your Name --- scripts/es-integration-test.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 58034441a82..f46bb9de240 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -20,16 +20,18 @@ check_arg() { setup_es() { local tag=$1 + local major_version=${tag%%.*} local compose_file - compose_file="docker-compose/elasticsearch/v${tag}.yml" + compose_file="docker-compose/elasticsearch/v${major_verison}.yml" docker-compose -f ${compose_file} up -d echo "${compose_file}" } setup_opensearch() { local tag=$1 + local major_version=${tag%%.*} local compose_file - compose_file="docker-compose/opensearch/v${tag}.yml" + compose_file="docker-compose/opensearch/v${major_version}.yml" docker-compose -f ${compose_file} up -d echo "${compose_file}" } From c58d624c45e6d1da3de192b33a60f7205d3d5092 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 May 2024 01:40:55 +0530 Subject: [PATCH 05/11] fixed es-integration.sh Signed-off-by: Your Name --- scripts/es-integration-test.sh | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index f46bb9de240..fd811dc3c80 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -22,8 +22,8 @@ setup_es() { local tag=$1 local major_version=${tag%%.*} local compose_file - compose_file="docker-compose/elasticsearch/v${major_verison}.yml" - docker-compose -f ${compose_file} up -d + compose_file="docker-compose/elasticsearch/v${major_version}.yml" + docker-compose -f "${compose_file}" up -d echo "${compose_file}" } @@ -32,7 +32,7 @@ setup_opensearch() { local major_version=${tag%%.*} local compose_file compose_file="docker-compose/opensearch/v${major_version}.yml" - docker-compose -f ${compose_file} up -d + docker-compose -f "${compose_file}" up -d echo "${compose_file}" } @@ -58,8 +58,8 @@ wait_for_storage() { if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" - docker-compose -f ${compose_file} logs - docker-compose -f ${compose_file} down + docker-compose -f "${compose_file}" logs + docker-compose -f "${compose_file}" down db_is_up=0 else echo "SUCCESS: ${distro} is available at ${url}" @@ -70,7 +70,6 @@ wait_for_storage() { bring_up_storage() { local distro=$1 local version=$2 - local cid echo "starting ${distro} ${version}" for retry in 1 2 3 @@ -100,7 +99,7 @@ bring_up_storage() { teardown_storage() { local compose_file=$1 - docker-compose -f ${compose_file} down + docker-compose -f "${compose_file}" down } main() { From 76462faac5f162f750a855c764fc65eaced14aea Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 May 2024 12:55:22 +0530 Subject: [PATCH 06/11] added flags in elasticsearch docker compose Signed-off-by: Your Name --- docker-compose/elasticsearch/v7.yml | 1 + docker-compose/elasticsearch/v8.yml | 2 ++ 2 files changed, 3 insertions(+) diff --git a/docker-compose/elasticsearch/v7.yml b/docker-compose/elasticsearch/v7.yml index 1bddbd9f057..035ec129f44 100644 --- a/docker-compose/elasticsearch/v7.yml +++ b/docker-compose/elasticsearch/v7.yml @@ -9,5 +9,6 @@ services: - transport.host=127.0.0.1 - xpack.security.enabled=false # Disable security features - xpack.security.http.ssl.enabled=false # Disable HTTPS + - xpack.monitoring.enabled=false # Disable monitoring features ports: - "9200:9200" \ No newline at end of file diff --git a/docker-compose/elasticsearch/v8.yml b/docker-compose/elasticsearch/v8.yml index 5f4b97f52da..89b895e513a 100644 --- a/docker-compose/elasticsearch/v8.yml +++ b/docker-compose/elasticsearch/v8.yml @@ -9,6 +9,8 @@ services: - transport.host=127.0.0.1 - xpack.security.enabled=false # Disable security features - xpack.security.http.ssl.enabled=false # Disable HTTPS + - action.destructive_requires_name=false + - xpack.monitoring.collection.enabled=false # Disable monitoring features ports: - "9200:9200" From a1db51616a88199430261aa3ddcebc5e0ce1cd43 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 May 2024 14:29:13 +0530 Subject: [PATCH 07/11] fixed test Signed-off-by: Your Name --- scripts/es-integration-test.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index fd811dc3c80..127558eea82 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -24,7 +24,7 @@ setup_es() { local compose_file compose_file="docker-compose/elasticsearch/v${major_version}.yml" docker-compose -f "${compose_file}" up -d - echo "${compose_file}" + } setup_opensearch() { @@ -33,7 +33,6 @@ setup_opensearch() { local compose_file compose_file="docker-compose/opensearch/v${major_version}.yml" docker-compose -f "${compose_file}" up -d - echo "${compose_file}" } wait_for_storage() { @@ -70,15 +69,17 @@ wait_for_storage() { bring_up_storage() { local distro=$1 local version=$2 + local major_version=${version%%.*} + local compose_file="docker-compose/${distro}/v${major_version}.yml" echo "starting ${distro} ${version}" for retry in 1 2 3 do echo "attempt $retry" if [ "${distro}" = "elasticsearch" ]; then - compose_file=$(setup_es "${version}") + setup_es "${version}" elif [ "${distro}" == "opensearch" ]; then - compose_file=$(setup_opensearch "${version}") + setup_opensearch "${version}" else echo "Unknown distribution $distro. Valid options are opensearch or elasticsearch" usage From d986b1a3666e08148d9739e32c86ecc9d0a2ba3a Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 May 2024 16:38:46 +0530 Subject: [PATCH 08/11] fixed es-integration-test.sh Signed-off-by: Your Name --- scripts/es-integration-test.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 127558eea82..6576d72b7db 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -23,8 +23,10 @@ setup_es() { local major_version=${tag%%.*} local compose_file compose_file="docker-compose/elasticsearch/v${major_version}.yml" - docker-compose -f "${compose_file}" up -d - + docker compose -f "${compose_file}" up -d + local cid + cid=$(docker compose -f ./docker-compose/elasticsearch/v"${major_version}".yml ps -q elasticsearch) + echo "cid=${cid}" >> "$GITHUB_OUTPUT" } setup_opensearch() { @@ -32,7 +34,10 @@ setup_opensearch() { local major_version=${tag%%.*} local compose_file compose_file="docker-compose/opensearch/v${major_version}.yml" - docker-compose -f "${compose_file}" up -d + docker compose -f "${compose_file}" up -d + local cid + cid=$(docker compose -f ./docker-compose/opensearch/v"${major_version}".yml ps -q opensearch) + echo "cid=${cid}" >> "$GITHUB_OUTPUT" } wait_for_storage() { @@ -57,8 +62,8 @@ wait_for_storage() { if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" - docker-compose -f "${compose_file}" logs - docker-compose -f "${compose_file}" down + docker compose -f "${compose_file}" logs + docker compose -f "${compose_file}" down db_is_up=0 else echo "SUCCESS: ${distro} is available at ${url}" @@ -100,7 +105,7 @@ bring_up_storage() { teardown_storage() { local compose_file=$1 - docker-compose -f "${compose_file}" down + docker compose -f "${compose_file}" down } main() { From 631f0be33621300e080f6a48c548724ee4cb504d Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 28 May 2024 23:59:55 +0530 Subject: [PATCH 09/11] updated es-integration-test.sh Signed-off-by: Your Name --- scripts/es-integration-test.sh | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 6576d72b7db..357924c6249 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -19,24 +19,19 @@ check_arg() { } setup_es() { - local tag=$1 - local major_version=${tag%%.*} - local compose_file - compose_file="docker-compose/elasticsearch/v${major_version}.yml" + local compose_file=$1 docker compose -f "${compose_file}" up -d local cid - cid=$(docker compose -f ./docker-compose/elasticsearch/v"${major_version}".yml ps -q elasticsearch) + cid=$(docker compose -f "${compose_file}" ps -q elasticsearch) echo "cid=${cid}" >> "$GITHUB_OUTPUT" } setup_opensearch() { - local tag=$1 - local major_version=${tag%%.*} - local compose_file + local compose_file=$1 compose_file="docker-compose/opensearch/v${major_version}.yml" docker compose -f "${compose_file}" up -d local cid - cid=$(docker compose -f ./docker-compose/opensearch/v"${major_version}".yml ps -q opensearch) + cid=$(docker compose -f "${compose_file}" ps -q opensearch) echo "cid=${cid}" >> "$GITHUB_OUTPUT" } @@ -82,9 +77,9 @@ bring_up_storage() { do echo "attempt $retry" if [ "${distro}" = "elasticsearch" ]; then - setup_es "${version}" + setup_es "${compose_file}" elif [ "${distro}" == "opensearch" ]; then - setup_opensearch "${version}" + setup_opensearch "${compose_file}" else echo "Unknown distribution $distro. Valid options are opensearch or elasticsearch" usage From 9abe2fecff96ff3212b444345bb55b0496db85ec Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 May 2024 03:55:50 +0530 Subject: [PATCH 10/11] fixing Signed-off-by: Your Name --- scripts/es-integration-test.sh | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index 357924c6249..e332d13e02b 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -18,20 +18,12 @@ check_arg() { fi } -setup_es() { - local compose_file=$1 - docker compose -f "${compose_file}" up -d - local cid - cid=$(docker compose -f "${compose_file}" ps -q elasticsearch) - echo "cid=${cid}" >> "$GITHUB_OUTPUT" -} - -setup_opensearch() { - local compose_file=$1 - compose_file="docker-compose/opensearch/v${major_version}.yml" +setup_db() { + local distro=$1 + local compose_file=$2 docker compose -f "${compose_file}" up -d local cid - cid=$(docker compose -f "${compose_file}" ps -q opensearch) + cid=$(docker compose -f "${compose_file}" ps -q "${distro}") echo "cid=${cid}" >> "$GITHUB_OUTPUT" } @@ -49,11 +41,13 @@ wait_for_storage() { local max_attempts=60 local attempt=0 echo "Waiting for ${distro} to be available at ${url}..." + echo "::group::Waiting for ${distro} availability" until [[ "$(curl "${params[@]}" "${url}")" == "200" ]] || (( attempt >= max_attempts )); do - echo "Attempt $(( attempt + 1 )): ${distro} is not yet available at ${url}..." - sleep 10 attempt=$(( attempt + 1 )) + echo "Attempt: ${attempt} ${distro} is not yet available at ${url}..." + sleep 10 done + echo "::endgroup::" if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" @@ -76,10 +70,8 @@ bring_up_storage() { for retry in 1 2 3 do echo "attempt $retry" - if [ "${distro}" = "elasticsearch" ]; then - setup_es "${compose_file}" - elif [ "${distro}" == "opensearch" ]; then - setup_opensearch "${compose_file}" + if [ "${distro}" = "elasticsearch" ] || [ "${distro}" = "opensearch" ]; then + setup_db "${distro}" "${compose_file}" else echo "Unknown distribution $distro. Valid options are opensearch or elasticsearch" usage From 4c872850a5a1df61c026b6ee9894f617b9295929 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 29 May 2024 04:37:20 +0530 Subject: [PATCH 11/11] updated Signed-off-by: Your Name --- scripts/es-integration-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/es-integration-test.sh b/scripts/es-integration-test.sh index e332d13e02b..0539d08ea3a 100755 --- a/scripts/es-integration-test.sh +++ b/scripts/es-integration-test.sh @@ -41,17 +41,17 @@ wait_for_storage() { local max_attempts=60 local attempt=0 echo "Waiting for ${distro} to be available at ${url}..." - echo "::group::Waiting for ${distro} availability" until [[ "$(curl "${params[@]}" "${url}")" == "200" ]] || (( attempt >= max_attempts )); do attempt=$(( attempt + 1 )) echo "Attempt: ${attempt} ${distro} is not yet available at ${url}..." sleep 10 done - echo "::endgroup::" if [[ "$(curl "${params[@]}" "${url}")" != "200" ]]; then echo "ERROR: ${distro} is not ready at ${url} after $(( attempt * 10 )) seconds" + echo "::group::${distro} logs" docker compose -f "${compose_file}" logs + echo "::endgroup::" docker compose -f "${compose_file}" down db_is_up=0 else