diff --git a/.github/workflows/security-test-workflow.yml b/.github/workflows/security-test-workflow.yml index f55f14bdd..edb230122 100644 --- a/.github/workflows/security-test-workflow.yml +++ b/.github/workflows/security-test-workflow.yml @@ -36,29 +36,27 @@ jobs: run: ./gradlew assemble - name: Pull and Run Docker run: | - plugin=`ls alerting/build/distributions/*.zip` + plugin=`basename $(ls alerting/build/distributions/*.zip)` list_of_files=`ls` list_of_all_files=`ls alerting/build/distributions/` 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-candidate_version + docker_version=$version-$qualifier - if [ -z $candidate_version ]; then - candidate_version=$qualifier && qualifier="" - docker_version=$version - fi + [[ -z $candidate_version ]] && candidate_version=$qualifier && qualifier="" - echo $version $plugin_version $qualifier $candidate_version $docker_version + echo plugin version plugin_version qualifier candidate_version docker_version + echo "($plugin) ($version) ($plugin_version) ($qualifier) ($candidate_version) ($docker_version)" echo $ls $list_of_all_files if docker pull opensearchstaging/opensearch:$docker_version then echo "FROM opensearchstaging/opensearch:$docker_version" >> Dockerfile echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-alerting ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-alerting; fi" >> Dockerfile - echo "ADD alerting/build/distributions/opensearch-alerting-$plugin_version-$candidate_version.zip /tmp/" >> Dockerfile - echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/opensearch-alerting-$plugin_version-$candidate_version.zip" >> Dockerfile + echo "ADD alerting/build/distributions/$plugin /tmp/" >> Dockerfile + echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/$plugin" >> Dockerfile docker build -t opensearch-alerting:test . echo "imagePresent=true" >> $GITHUB_ENV