From f1be3ebb8e81fa6149a638d28956e5fa49e60d58 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 16 Feb 2024 16:27:43 -0500 Subject: [PATCH 01/12] Initial commit to try using workflow from other fork Signed-off-by: Derek Ho --- .../workflows/verify-binary-installation.yml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/verify-binary-installation.yml diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml new file mode 100644 index 000000000..36cac06b8 --- /dev/null +++ b/.github/workflows/verify-binary-installation.yml @@ -0,0 +1,65 @@ +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 + PLUGIN_NAME: opensearch-security-analytics + OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123! + +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: Download security plugin and create setup scripts + uses: derek-ho/security-dashboards-plugin/.github/actions/download-install-run-dashboards-with-plugin@generalize-binary-install-workflow + with: + opensearch-version: ${{ env.OPENSEARCH_VERSION }} + backend-plugin-name: ${{ env.PLUGIN_NAME }} + security-enabled: false + + + - uses: actions/checkout@v2 + with: + path: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin + + - name: Install dependencies + run: | + yarn osd bootstrap + working-directory: OpenSearch-Dashboards + shell: bash + + - name: Build Plugin Zip + run: | + yarn build + working-directory: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin + shell: bash + + - name: Install plugin to OSD Linux + run: | + build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64/bin/opensearch-dashboards-plugin install file:$(pwd)/plugins/security--analytics-dashboards-plugin/build/security-analytics-dashboards-${{env.PLUGIN_VERSION}}.zip + working-directory: OpenSearch-Dashboards + shell: bash + + - name: Start the binary + run: | + nohup ./bin/opensearch-dashboards & + working-directory: OpenSearch-Dashboards/build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64 + shell: bash + + - name: Health check + run: | + timeout 300 bash -c 'while [[ "$(curl -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' + shell: bash + From e7f9bce05e4eb3eba473ecffc0ad5137827d2664 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Sun, 18 Feb 2024 10:09:51 -0500 Subject: [PATCH 02/12] setup with backend or job scheduler Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index 36cac06b8..6b6ff9c71 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -26,7 +26,6 @@ jobs: uses: derek-ho/security-dashboards-plugin/.github/actions/download-install-run-dashboards-with-plugin@generalize-binary-install-workflow with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} - backend-plugin-name: ${{ env.PLUGIN_NAME }} security-enabled: false From 6878c67425d65237e7cb9a533e71e1b650f6c9fc Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 12:05:53 -0500 Subject: [PATCH 03/12] Use generalized workflows Signed-off-by: Derek Ho --- .../workflows/verify-binary-installation.yml | 47 ++++++++----------- 1 file changed, 20 insertions(+), 27 deletions(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index 6b6ff9c71..4cac63db8 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -6,7 +6,7 @@ env: CI: 1 # avoid warnings like "tput: No value for $TERM and no -T specified" TERM: xterm - PLUGIN_NAME: opensearch-security-analytics + PLUGIN_NAME: opensearch-security OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123! jobs: @@ -22,43 +22,36 @@ jobs: - name: Checkout Branch uses: actions/checkout@v3 - - name: Download security plugin and create setup scripts - uses: derek-ho/security-dashboards-plugin/.github/actions/download-install-run-dashboards-with-plugin@generalize-binary-install-workflow + - 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 with security + uses: derek-ho/start-opensearch@v2 with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} security-enabled: false - - - uses: actions/checkout@v2 + - name: Run Dashboard with Security Dashboards Plugin + id: setup-dashboards + uses: derek-ho/setup-opensearch-dashboards@main with: - path: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin - - - name: Install dependencies - run: | - yarn osd bootstrap - working-directory: OpenSearch-Dashboards - shell: bash - - - name: Build Plugin Zip - run: | - yarn build - working-directory: OpenSearch-Dashboards/plugins/security-analytics-dashboards-plugin - shell: bash - - - name: Install plugin to OSD Linux - run: | - build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64/bin/opensearch-dashboards-plugin install file:$(pwd)/plugins/security--analytics-dashboards-plugin/build/security-analytics-dashboards-${{env.PLUGIN_VERSION}}.zip - working-directory: OpenSearch-Dashboards - shell: bash - + 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: OpenSearch-Dashboards/build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64 + working-directory: ${{ steps.setup-dashboards.outputs.dashboards-directory }} shell: bash - name: Health check run: | - timeout 300 bash -c 'while [[ "$(curl -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' + timeout 300 bash -c 'while [[ "$(curl http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done' shell: bash From 222b852d923f90158ef68bd988d504891c5cec56 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 12:20:16 -0500 Subject: [PATCH 04/12] Extra dash Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index 4cac63db8..08d13278f 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -41,7 +41,7 @@ jobs: uses: derek-ho/setup-opensearch-dashboards@main with: plugin_name: security-analytics-dashboards-plugin - built_plugin_name: security--analytics-dashboards + built_plugin_name: security-analytics-dashboards install_zip: true - name: Start the binary From 3d9e2fec92bd7e45ecc14c44451c6945659960ef Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 12:46:00 -0500 Subject: [PATCH 05/12] Correct directory Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index 08d13278f..e38072f16 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -47,7 +47,7 @@ jobs: - name: Start the binary run: | nohup ./bin/opensearch-dashboards & - working-directory: ${{ steps.setup-dashboards.outputs.dashboards-directory }} + working-directory: ${{ steps.setup-dashboards.outputs.dashboards-binary-directory }} shell: bash - name: Health check From 463cc2d2b110d481ae44c48fabbe3901516b2713 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 13:10:58 -0500 Subject: [PATCH 06/12] Revert "Add missing modules common and types (#875)" This reverts commit ba9c4f66264eadb25e2f25b595e861454ad6b241. Signed-off-by: Derek Ho --- .opensearch_dashboards-plugin-helpers.json | 5 ++--- tsconfig.json | 11 +---------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/.opensearch_dashboards-plugin-helpers.json b/.opensearch_dashboards-plugin-helpers.json index d71679063..f79b1a27d 100644 --- a/.opensearch_dashboards-plugin-helpers.json +++ b/.opensearch_dashboards-plugin-helpers.json @@ -4,8 +4,7 @@ "tsconfig.json", "yarn.lock", ".yarnrc", - "{lib,public,server,webpackShims,translations,utils,models,test,common,types}/**/*", - "!__tests__", - "config.ts" + "{lib,public,server,webpackShims,translations,utils,models,test}/**/*", + "!__tests__" ] } diff --git a/tsconfig.json b/tsconfig.json index 5cdb1d22c..2bd480b10 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,16 +3,7 @@ "extends": "../../tsconfig.json", // tell the TypeScript compiler where to find your source files - "include": [ - "server/**/*", - "public/**/*", - "utils/**/*", - "models/**/*", - "test/**/*", - "common/**/*", - "types/**/*", - "config.ts" - ], + "include": ["server/**/*", "public/**/*", "utils/**/*", "models/**/*", "test/**/*"], "exclude": ["node_modules", "*/node_modules/"], "compilerOptions": { "skipLibCheck": true, From c9fe6ff16a8b70eb0b08a5363c19c7a457ec5e1a Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 13:26:34 -0500 Subject: [PATCH 07/12] Revert "Revert "Add missing modules common and types (#875)"" This reverts commit 17cff1440a188e9675241c30f7e4a429391ae5ae. Signed-off-by: Derek Ho --- .opensearch_dashboards-plugin-helpers.json | 5 +++-- tsconfig.json | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.opensearch_dashboards-plugin-helpers.json b/.opensearch_dashboards-plugin-helpers.json index f79b1a27d..d71679063 100644 --- a/.opensearch_dashboards-plugin-helpers.json +++ b/.opensearch_dashboards-plugin-helpers.json @@ -4,7 +4,8 @@ "tsconfig.json", "yarn.lock", ".yarnrc", - "{lib,public,server,webpackShims,translations,utils,models,test}/**/*", - "!__tests__" + "{lib,public,server,webpackShims,translations,utils,models,test,common,types}/**/*", + "!__tests__", + "config.ts" ] } diff --git a/tsconfig.json b/tsconfig.json index 2bd480b10..5cdb1d22c 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -3,7 +3,16 @@ "extends": "../../tsconfig.json", // tell the TypeScript compiler where to find your source files - "include": ["server/**/*", "public/**/*", "utils/**/*", "models/**/*", "test/**/*"], + "include": [ + "server/**/*", + "public/**/*", + "utils/**/*", + "models/**/*", + "test/**/*", + "common/**/*", + "types/**/*", + "config.ts" + ], "exclude": ["node_modules", "*/node_modules/"], "compilerOptions": { "skipLibCheck": true, From fbdf602db0737dc1a7ca9d31359ce63435d533e5 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 13:27:20 -0500 Subject: [PATCH 08/12] Single version loose to fix bootstrapping issues Signed-off-by: Derek Ho --- .github/workflows/cypress-workflow.yml | 2 +- .github/workflows/unit-tests-workflow.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress-workflow.yml b/.github/workflows/cypress-workflow.yml index 1fb96ea48..22085d681 100644 --- a/.github/workflows/cypress-workflow.yml +++ b/.github/workflows/cypress-workflow.yml @@ -106,7 +106,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 3ed4a3503..15d979646 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' }} From 73ddbc3283afd794ae2b58e1d36bd4a7ff4cdd2f Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 13:31:40 -0500 Subject: [PATCH 09/12] Add v1 tag Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index e38072f16..b167f5f66 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -38,7 +38,7 @@ jobs: - name: Run Dashboard with Security Dashboards Plugin id: setup-dashboards - uses: derek-ho/setup-opensearch-dashboards@main + uses: derek-ho/setup-opensearch-dashboards@v1 with: plugin_name: security-analytics-dashboards-plugin built_plugin_name: security-analytics-dashboards From b0163875f02b4ef4242b0b045ffe500408222ac0 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 13:58:01 -0500 Subject: [PATCH 10/12] Remove security specific settings Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index b167f5f66..bd606c2fc 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -6,8 +6,6 @@ env: CI: 1 # avoid warnings like "tput: No value for $TERM and no -T specified" TERM: xterm - PLUGIN_NAME: opensearch-security - OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123! jobs: verify-binary-installation: From bd0b54c440c31ebb1d63d7bc176ddd8e8a514b8f Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Fri, 23 Feb 2024 14:47:05 -0500 Subject: [PATCH 11/12] Remove references to security Signed-off-by: Derek Ho --- .github/workflows/verify-binary-installation.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/verify-binary-installation.yml b/.github/workflows/verify-binary-installation.yml index bd606c2fc..d237d4a6c 100644 --- a/.github/workflows/verify-binary-installation.yml +++ b/.github/workflows/verify-binary-installation.yml @@ -28,13 +28,13 @@ jobs: echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV shell: bash - - name: Run Opensearch with security + - name: Run Opensearch uses: derek-ho/start-opensearch@v2 with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} security-enabled: false - - name: Run Dashboard with Security Dashboards Plugin + - name: Run Dashboard id: setup-dashboards uses: derek-ho/setup-opensearch-dashboards@v1 with: From 634aae0d1675fe9fc885545855a16031da7e26ed Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Wed, 28 Feb 2024 16:33:06 -0500 Subject: [PATCH 12/12] Add loose for windows Signed-off-by: Derek Ho --- .github/workflows/unit-tests-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests-workflow.yml b/.github/workflows/unit-tests-workflow.yml index 15d979646..e55773ba2 100644 --- a/.github/workflows/unit-tests-workflow.yml +++ b/.github/workflows/unit-tests-workflow.yml @@ -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