From 00b070bdef2a8586c71a5eacd6f2f21a3a5a47e8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Apr 2024 14:47:14 +0000 Subject: [PATCH] Add verify binary installation workflow and add loose to bootstrapping (#891) * Add verify binary installation workflow and add loose to bootstrapping Signed-off-by: Derek Ho * Fix built zip name Signed-off-by: Derek Ho * Remove references to security Signed-off-by: Derek Ho * Add loose Signed-off-by: Derek Ho --------- Signed-off-by: Derek Ho (cherry picked from commit 06fa15506842bc325367ebc808ee01f955250e53) Signed-off-by: github-actions[bot] --- .github/workflows/cypress-workflow.yml | 2 +- .github/workflows/release-workflow.yml | 2 +- .github/workflows/unit-tests-workflow.yml | 4 +- .../workflows/verify-binary-installation.yml | 55 +++++++++++++++++++ 4 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/verify-binary-installation.yml diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 5d3638a4e..5280eda5a 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -62,7 +62,7 @@ jobs: - name: Bootstrap OpenSearch Dashboards with plugin run: | cd OpenSearch-Dashboards/plugins/alerting-dashboards-plugin - yarn osd bootstrap + yarn osd bootstrap --single-version=loose - name: Run OpenSearch Dashboards server run: | cd OpenSearch-Dashboards diff --git a/.github/workflows/release-workflow.yml b/.github/workflows/release-workflow.yml index 01f035e78..f50a6e7e3 100644 --- a/.github/workflows/release-workflow.yml +++ b/.github/workflows/release-workflow.yml @@ -44,7 +44,7 @@ jobs: mkdir -p Opensearch-Dashboards/plugins mv alerting-dashboards-plugin Opensearch-Dashboards/plugins cd Opensearch-Dashboards/plugins/alerting-dashboards-plugin - yarn osd bootstrap + yarn osd bootstrap --single-version=loose - name: Build plugin id: build_zip run: | diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index ac4fcb10c..08e98a99f 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -42,7 +42,7 @@ jobs: cd ./OpenSearch-Dashboards/ su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && cd ./plugins/alerting-dashboards-plugin && - whoami && yarn osd bootstrap && yarn build && yarn run test:jest --coverage" + whoami && yarn osd bootstrap --single-version=loose && yarn build && yarn run test:jest --coverage" - name: Uploads coverage uses: codecov/codecov-action@v1 @@ -84,7 +84,7 @@ jobs: - name: Bootstrap plugin/opensearch-dashboards run: | cd OpenSearch-Dashboards/plugins/alerting-dashboards-plugin - yarn osd bootstrap + yarn osd bootstrap --single-version=loose - name: Run window tests if: ${{ matrix.os == 'windows-latest' }} run: | diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml new file mode 100644 index 000000000..885765f4a --- /dev/null +++ b/.github/workflows/verify-binary-installation.yml @@ -0,0 +1,55 @@ +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: alerting-dashboards-plugin + built_plugin_name: alertingDashboards + 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 +