From 25ea113198a0bd8ee34b18772848da3eb73e48b1 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 18 Mar 2024 21:00:51 +0000 Subject: [PATCH] Add workflow to build and install security analytics dashboards plugin (#899) * Initial commit to try using workflow from other fork Signed-off-by: Derek Ho * setup with backend or job scheduler Signed-off-by: Derek Ho * Use generalized workflows Signed-off-by: Derek Ho * Extra dash Signed-off-by: Derek Ho * Correct directory Signed-off-by: Derek Ho * Revert "Add missing modules common and types (#875)" This reverts commit ba9c4f66264eadb25e2f25b595e861454ad6b241. Signed-off-by: Derek Ho * Revert "Revert "Add missing modules common and types (#875)"" This reverts commit 17cff1440a188e9675241c30f7e4a429391ae5ae. Signed-off-by: Derek Ho * Single version loose to fix bootstrapping issues Signed-off-by: Derek Ho * Add v1 tag Signed-off-by: Derek Ho * Remove security specific settings Signed-off-by: Derek Ho * Remove references to security Signed-off-by: Derek Ho * Add loose for windows Signed-off-by: Derek Ho --------- Signed-off-by: Derek Ho (cherry picked from commit 6bb078b9671280416d6f6244ce38b581cbc11618) Signed-off-by: github-actions[bot] --- .github/workflows/cypress-workflow.yml | 2 +- .github/workflows/unit-tests-workflow.yml | 4 +- .../workflows/verify-binary-installation.yml | 55 +++++++++++++++++++ 3 files changed, 58 insertions(+), 3 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 391e4a224..a81220a55 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -82,7 +82,7 @@ jobs: - name: Bootstrap plugin/OpenSearch-Dashboards run: | cd OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin - yarn osd bootstrap + yarn osd bootstrap --single-version=loose - name: Run OpenSearch-Dashboards server run: | diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 3b3c10cb9..ce58c0f3a 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -45,7 +45,7 @@ jobs: cd ./OpenSearch-Dashboards/ su `id -un 1000` -c "source $NVM_DIR/nvm.sh && nvm use && node -v && yarn -v && cd ./plugins/security-analytics-dashboards-plugin && - whoami && yarn osd bootstrap && yarn run test:jest --coverage" + whoami && yarn osd bootstrap --single-version=loose && yarn run test:jest --coverage" - name: Uploads coverage if: ${{ matrix.os == 'ubuntu-latest' }} @@ -89,7 +89,7 @@ jobs: - name: Bootstrap plugin/OpenSearch-Dashboards run: | cd OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin - yarn osd bootstrap + yarn osd bootstrap --single-version=loose - name: Run tests run: | cd OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml new file mode 100644 index 000000000..d237d4a6c --- /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: security-analytics-dashboards-plugin + built_plugin_name: security-analytics-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 +