From ce01c59a17e4b0dd99c4e4063bcb18b891719f62 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 23 Apr 2024 22:50:03 -0400 Subject: [PATCH] =?UTF-8?q?Add=20workflow=20to=20verify=20installation=20o?= =?UTF-8?q?f=20the=20plugin=20zip=20and=20dashboards=20=E2=80=A6=20(#165)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add workflow to verify installation of the plugin zip and dashboards comes up healthy Signed-off-by: Derek Ho * Add loose Signed-off-by: Derek Ho --------- Signed-off-by: Derek Ho (cherry picked from commit 0405502f8f47e48ae7561c560da56b36215dbc09) --- ...t-and-build-workflow-prod-docker-linux.yml | 2 +- ...-notifications-test-and-build-workflow.yml | 4 +- .../workflows/verify-binary-installation.yml | 54 +++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/verify-binary-installation.yml diff --git a/.github/workflows/dashboards-notifications-test-and-build-workflow-prod-docker-linux.yml b/.github/workflows/dashboards-notifications-test-and-build-workflow-prod-docker-linux.yml index 3022999d..00fca0c6 100644 --- a/.github/workflows/dashboards-notifications-test-and-build-workflow-prod-docker-linux.yml +++ b/.github/workflows/dashboards-notifications-test-and-build-workflow-prod-docker-linux.yml @@ -92,7 +92,7 @@ jobs: cd ./OpenSearch-Dashboards/ su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && cd ./plugins/dashboards-notifications && - whoami && yarn osd bootstrap && yarn build" + whoami && yarn osd bootstrap --single-version=loose && yarn build" - name: Run unit tests uses: nick-fields/retry@v2 diff --git a/.github/workflows/dashboards-notifications-test-and-build-workflow.yml b/.github/workflows/dashboards-notifications-test-and-build-workflow.yml index 585624f7..8763a7f6 100644 --- a/.github/workflows/dashboards-notifications-test-and-build-workflow.yml +++ b/.github/workflows/dashboards-notifications-test-and-build-workflow.yml @@ -126,8 +126,8 @@ jobs: - name: OpenSearch Dashboards Plugin Bootstrap run: | - cd OpenSearch-Dashboards/plugins/dashboards-notifications - yarn osd bootstrap + cd ./OpenSearch-Dashboards/plugins/dashboards-notifications + yarn osd bootstrap --single-version=loose - name: Build Artifact run: | diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml new file mode 100644 index 00000000..fd5eebc9 --- /dev/null +++ b/.github/workflows/verify-binary-installation.yml @@ -0,0 +1,54 @@ +name: 'Install Dashboards with Plugin via Binary' + +on: [push, pull_request] +env: + OPENSEARCH_VERSION: '3.0.0' + CI: 1 + # avoid warnings like "tput: No value for $TERM and no -T specified" + TERM: xterm + +jobs: + verify-binary-installation: + name: Run binary installation + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + # TODO: add windows support when OSD core is stable on windows + runs-on: ${{ matrix.os }} + steps: + - name: Checkout Branch + uses: actions/checkout@v3 + + - name: Set env + run: | + opensearch_version=$(node -p "require('./opensearch_dashboards.json').opensearchDashboardsVersion") + plugin_version=$(node -p "require('./opensearch_dashboards.json').version") + echo "OPENSEARCH_VERSION=$opensearch_version" >> $GITHUB_ENV + echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV + shell: bash + + - name: Run Opensearch + uses: derek-ho/start-opensearch@v2 + with: + opensearch-version: ${{ env.OPENSEARCH_VERSION }} + security-enabled: false + + - name: Run Dashboard + id: setup-dashboards + uses: derek-ho/setup-opensearch-dashboards@v1 + with: + plugin_name: dashboards-notifications + built_plugin_name: notifications-dashboards + install_zip: true + + - name: Start the binary + run: | + nohup ./bin/opensearch-dashboards & + working-directory: ${{ steps.setup-dashboards.outputs.dashboards-binary-directory }} + shell: bash + + - name: Health check + run: | + timeout 300 bash -c 'while [[ "$(curl http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' + shell: bash