diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 196211451..c964c6adf 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -48,51 +48,50 @@ jobs: - name: Multi Nodes Integration Testing run: | ./gradlew integTest -PnumNodes=3 -# ToDo: Check infra team for 2.0 docker availability and re-enable -# - name: Pull and Run Docker -# run: | -# plugin=`basename $(ls plugin/build/distributions/*.zip)` -# version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3` -# plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4` -# qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1` -# candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1` -# docker_version=$version-$qualifier -# -# [[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier="" -# -# echo plugin version plugin_version qualifier candidate_version docker_version -# echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)" -# -# cd .. -# if docker pull opensearchstaging/opensearch:$docker_version -# then -# echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile -# echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-anomaly-detection ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-anomaly-detection; fi" >> Dockerfile -# echo "ADD anomaly-detection/build/distributions/$plugin /tmp/" >> Dockerfile -# echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile -# docker build -t opensearch-ad:test . -# echo "imagePresent=true" >> $GITHUB_ENV -# else -# echo "imagePresent=false" >> $GITHUB_ENV -# fi -# - name: Run Docker Image -# if: env.imagePresent == 'true' -# run: | -# cd .. -# docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-ad:test -# sleep 90 -# - name: Run AD Test -# if: env.imagePresent == 'true' -# run: | -# security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opensearch-security|wc -l` -# if [ $security -gt 0 ] -# then -# echo "Security plugin is available" -# ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin -# else -# echo "Security plugin is NOT available" -# ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -# fi + - name: Pull and Run Docker + run: | + plugin=`basename $(ls build/distributions/*.zip)` + version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3` + plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4` + qualifier=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1` + candidate_version=`echo $plugin|awk -F- '{print $5}'| cut -d. -f 1-1` + docker_version=$version-$qualifier + + [[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier="" + + echo plugin version plugin_version qualifier candidate_version docker_version + echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)" + + cd .. + if docker pull opensearchstaging/opensearch:$docker_version + then + echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile + echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-anomaly-detection ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-anomaly-detection; fi" >> Dockerfile + echo "ADD anomaly-detection/build/distributions/$plugin /tmp/" >> Dockerfile + echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile + docker build -t opensearch-ad:test . + echo "imagePresent=true" >> $GITHUB_ENV + else + echo "imagePresent=false" >> $GITHUB_ENV + fi + - name: Run Docker Image + if: env.imagePresent == 'true' + run: | + cd .. + docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-ad:test + sleep 90 + - name: Run AD Test + if: env.imagePresent == 'true' + run: | + security=`curl -XGET https://localhost:9200/_cat/plugins?v -u admin:admin --insecure |grep opensearch-security|wc -l` + if [ $security -gt 0 ] + then + echo "Security plugin is available" + ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" -Dhttps=true -Duser=admin -Dpassword=admin + else + echo "Security plugin is NOT available" + ./gradlew integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername="docker-cluster" + fi - name: Run AD Backwards Compatibility Tests run: | echo "Running backwards compatibility tests ..."