From 3434d63252051f756098266de9acac529ab8c2bf Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 14 Dec 2022 15:17:24 -0500 Subject: [PATCH 01/76] CI refactoring for support Windows runner Signed-off-by: Ryan Liang --- .github/actions/install-dashboards/action.yml | 54 ++++++++++++++++--- .github/workflows/cypress-test.yml | 25 +++++++-- .github/workflows/integration-test.yml | 47 ++++++++++++++-- 3 files changed, 110 insertions(+), 16 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index d9b7d9eb0..5e1f2e6d0 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -14,6 +14,7 @@ outputs: plugin-directory: description: "The directory where the plugin has been configured" value: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} + runs: using: "composite" @@ -33,28 +34,53 @@ runs: ref: 'main' fetch-depth: 0 - - run: mkdir -p plugins + - name: Setup plugin directory for Linux + if: ${{ runner.os == 'Linux' }} + run: mkdir -p plugins working-directory: OpenSearch-Dashboards shell: bash + - name: Setup plugin directory for Windows + if: ${{ runner.os == 'Windows' }} + run: mkdir -p plugins + working-directory: OpenSearch-Dashboards + shell: pwsh + - uses: actions/checkout@v2 with: path: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} - - id: osd-version + - id: osd-version-linux + if: ${{ runner.os == 'Linux' }} continue-on-error: true run: | - echo "::set-output name=osd-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" + echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} shell: bash - - id: branch-switch-if-possible + - id: osd-version-windows + if: ${{ runner.os == 'Windows' }} + continue-on-error: true + run: | + echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" + echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" + working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} + shell: pwsh + + - id: branch-switch-if-possible-linux continue-on-error: true # Defaults onto main if the branch switch doesn't work - if: ${{ steps.osd-version.outputs.osd-version }} - run: git checkout ${{ steps.osd-version.outputs.osd-version }} || git checkout ${{ steps.osd-version.outputs.osd-x-version }}x + if: ${{ runner.os == 'Linux' && steps.osd-version-linux.outputs.osd-version-linux }} + run: git checkout ${{ steps.osd-version-linux.outputs.osd-version }} || git checkout ${{ steps.osd-version-linux.outputs.osd-x-version }}x working-directory: ./OpenSearch-Dashboards shell: bash + + - id: branch-switch-if-possible-windows + continue-on-error: true # Defaults onto main if the branch switch doesn't work + if: ${{ runner.os == 'Windows' && steps.osd-version-linux.outputs.osd-version-windows }} + run: git checkout ${{ steps.osd-version-windows.outputs.osd-version }} || git checkout ${{ steps.osd-version-windows.outputs.osd-x-version }}x + working-directory: ./OpenSearch-Dashboards + shell: pwsh - id: tool-versions run: | @@ -68,14 +94,26 @@ runs: node-version: ${{ steps.tool-versions.outputs.node_version }} registry-url: 'https://registry.npmjs.org' - - run: | + - name: Setup Opensearch Dashboards on Linux + if: ${{ runner.os == 'Linux' }} + run: | npm uninstall -g yarn echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} working-directory: OpenSearch-Dashboards shell: bash - - uses: nick-fields/retry@v2 + - name: Setup Opensearch Dashboards on Windows + if: ${{ runner.os == 'Windows' }} + run: | + npm uninstall -g yarn + echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" + npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} + working-directory: OpenSearch-Dashboards + shell: pwsh + + - name: Bootstrap the OpenSearch Dashboard + uses: nick-fields/retry@v2 with: timeout_minutes: 20 max_attempts: 2 diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 51cf78bbc..4c611b0fd 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -16,15 +16,27 @@ env: jobs: tests: name: Run Cypress tests - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + #os: [ ubuntu-latest , windows-latest ] + #os: [ windows-latest ] + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: - name: Checkout Branch uses: actions/checkout@v2 - - name: Download OpenSearch Security Plugin + - name: Download OpenSearch Security Plugin on Linux + if: ${{ runner.os == 'Linux' }} run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - - name: Create Setup Script + - name: Download OpenSearch Security Plugin on Windows + if: ${{ runner.os == 'Windows' }} + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + + - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} run: | cat > setup.sh <<'EOF' @@ -32,6 +44,13 @@ jobs: /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" EOF + - name: Create Setup Script for Windows + if: ${{ runner.os == 'Windows' }} + run: | + New-Item .\setup.bat -type file + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" + Get-Content .\setup.bat + - name: Run Opensearch with A Single Plugin uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main with: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2b692ef5d..d3beec6a7 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -12,7 +12,14 @@ env: jobs: tests: name: Run integration tests - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + #os: [ ubuntu-latest , windows-latest ] + #os: [ windows-latest ] + os: [ ubuntu-latest ] + runs-on: ${{ matrix.os }} + steps: - name: Checkout Branch uses: actions/checkout@v2 @@ -23,10 +30,21 @@ jobs: - uses: browser-actions/setup-firefox@latest - run: firefox --version - - name: Download OpenSearch Security Plugin + - name: Download OpenSearch Security Plugin on Linux + if: ${{ runner.os == 'Linux' }} run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - - name: Create Setup Script + - name: Download OpenSearch Security Plugin on Windows + if: ${{ runner.os == 'Windows' }} + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + + - name: Download OpenSearch Security for Windows + uses: peternied/download-file@v2 + if: ${{ runner.os == 'Windows' }} + with: + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + + - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} run: | cat > setup.sh <<'EOF' @@ -35,6 +53,15 @@ jobs: echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml EOF + - name: Create Setup Script for Windows + if: ${{ runner.os == 'Windows' }} + run: | + New-Item .\setup.bat -type file + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" + Get-Content .\setup.bat + + #TODO: Translate ln:53 to pwsh command and add to Windows Setup ^ + - name: Run Opensearch with A Single Plugin uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main with: @@ -47,13 +74,23 @@ jobs: with: plugin_name: security-dashboards-plugin - - name: Start Dashboards in background + - name: Start Dashboards in background on Linux + if: ${{ runner.os == 'Linux' }} run: node scripts/build_opensearch_dashboards_platform_plugins.js working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} - - name: Run integration tests + - name: Run integration tests on Linux + if: ${{ runner.os == 'Linux' }} run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} + + - name: Run integration tests on Windows + if: ${{ runner.os == 'Windows' }} + run: | + echo "check if opensearch is ready" + curl -XGET https://localhost:9200 -u 'admin:admin' -k + yarn test:jest_server --coverage + working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} \ No newline at end of file From 59e6a36539c159fdc3b60077481966cf5127a552 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 14 Dec 2022 15:37:51 -0500 Subject: [PATCH 02/76] Change the distribution build version to 6705 for linux runner Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- .github/workflows/integration-test.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 4c611b0fd..008e5e3c8 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -30,7 +30,7 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6705/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index d3beec6a7..f98797881 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,7 +32,7 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6705/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} From 2e3aae4fa5bfd76127a2534c3e0614e16467691c Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 14 Dec 2022 16:08:37 -0500 Subject: [PATCH 03/76] Change the distribution build version to 6708 for both linux and windows runner Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 4 ++-- .github/workflows/integration-test.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 008e5e3c8..cccb3a3dd 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -30,11 +30,11 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6705/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index f98797881..eabe58285 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -32,11 +32,11 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6705/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security for Windows uses: peternied/download-file@v2 From 02f785c117957853849c16bd26c1c3ab6e91cb38 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:27:58 -0500 Subject: [PATCH 04/76] test updated versions Signed-off-by: Stephen Crawford --- .github/workflows/cypress-test.yml | 2 +- .github/workflows/integration-test.yml | 10 +++++++--- .github/workflows/unit-test.yml | 2 +- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index cccb3a3dd..21e0b993d 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -1,6 +1,6 @@ name: Cypress Tests -on: [push, pull_request] +on: [] #push, pull_request env: TEST_BROWSER_HEADLESS: 1 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index eabe58285..47596d4a3 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,7 +29,7 @@ jobs: - uses: browser-actions/setup-firefox@latest - run: firefox --version - + - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip @@ -60,7 +60,12 @@ jobs: Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" Get-Content .\setup.bat - #TODO: Translate ln:53 to pwsh command and add to Windows Setup ^ + - name: Run Opensearch with A Single Plugin + uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main + with: + opensearch-version: ${{ env.OPENSEARCH_VERSION }} + plugin-name: ${{ env.PLUGIN_NAME }} + setup-script-name: setup - name: Run Opensearch with A Single Plugin uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main @@ -75,7 +80,6 @@ jobs: plugin_name: security-dashboards-plugin - name: Start Dashboards in background on Linux - if: ${{ runner.os == 'Linux' }} run: node scripts/build_opensearch_dashboards_platform_plugins.js working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 8b8dd02cf..68af86133 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,6 +1,6 @@ name: Unit Tests -on: [push, pull_request] +on: [] #push, pull_request jobs: unit-tests: From ba4f77453caa89eb827b67ae27fba7ad004f8139 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:29:16 -0500 Subject: [PATCH 05/76] test updated versions Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 47596d4a3..1c74c046a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: #os: [ ubuntu-latest , windows-latest ] - #os: [ windows-latest ] - os: [ ubuntu-latest ] + os: [ windows-latest ] + #os: [ ubuntu-latest ] runs-on: ${{ matrix.os }} steps: From 8c6162d302d994598d301e8539a6435b2de991ca Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:30:15 -0500 Subject: [PATCH 06/76] test updated versions Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 1c74c046a..46548f5a7 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -67,13 +67,6 @@ jobs: plugin-name: ${{ env.PLUGIN_NAME }} setup-script-name: setup - - name: Run Opensearch with A Single Plugin - uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main - with: - opensearch-version: ${{ env.OPENSEARCH_VERSION }} - plugin-name: ${{ env.PLUGIN_NAME }} - setup-script-name: setup - - id: install-dashboards uses: ./.github/actions/install-dashboards with: From 58dbad113c67a0d9f1fd787d7102006a6d2af20f Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:37:21 -0500 Subject: [PATCH 07/76] swap firefox install Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 46548f5a7..f79dc4270 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -27,8 +27,12 @@ jobs: - uses: browser-actions/setup-geckodriver@latest - run: geckodriver --version - - uses: browser-actions/setup-firefox@latest - - run: firefox --version + # Browser-action version does not work on Windows + - name: Set up Firefox browser + uses: abhi1693/setup-browser@latest + with: + browser: firefox + version: latest - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} From ad6fe0f216c1dc81f81b0080625d5e0bf42db957 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:39:59 -0500 Subject: [PATCH 08/76] swap firefox install Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index f79dc4270..2e4e9e993 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,7 +29,7 @@ jobs: # Browser-action version does not work on Windows - name: Set up Firefox browser - uses: abhi1693/setup-browser@latest + uses: abhi1693/setup-browser@v0.1.1 with: browser: firefox version: latest From 10691831c7ef5a9ef498129651184ac47aecf547 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:41:58 -0500 Subject: [PATCH 09/76] swap firefox install Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2e4e9e993..a8b0ce362 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -29,7 +29,7 @@ jobs: # Browser-action version does not work on Windows - name: Set up Firefox browser - uses: abhi1693/setup-browser@v0.1.1 + uses: abhi1693/setup-browser@main with: browser: firefox version: latest From 8b216d9a7cb6d27a1991f843e048a68cce243676 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:48:08 -0500 Subject: [PATCH 10/76] Swap to invoke Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a8b0ce362..88148b29a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -40,13 +40,7 @@ jobs: - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - - - name: Download OpenSearch Security for Windows - uses: peternied/download-file@v2 - if: ${{ runner.os == 'Windows' }} - with: - url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: Invoke-WebRequest -URI https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} From 864bdd7da6ce8dd5381a71397e109be2a6017747 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 16:58:57 -0500 Subject: [PATCH 11/76] Swap to zip Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 88148b29a..2c3e05921 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -40,7 +40,7 @@ jobs: - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -URI https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip + run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} From 0a95a68f59f58c41be97254ddec6742c741b6082 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 17:13:17 -0500 Subject: [PATCH 12/76] SPecify jdk Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2c3e05921..fcc603769 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -18,12 +18,18 @@ jobs: #os: [ ubuntu-latest , windows-latest ] os: [ windows-latest ] #os: [ ubuntu-latest ] + jdk: [11] #17 runs-on: ${{ matrix.os }} steps: - name: Checkout Branch uses: actions/checkout@v2 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} + - uses: browser-actions/setup-geckodriver@latest - run: geckodriver --version From 235ca60900fb51884f3977a09af049bc522863db Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Wed, 14 Dec 2022 17:17:36 -0500 Subject: [PATCH 13/76] swap to new setup Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index fcc603769..3bb34dde3 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -53,7 +53,7 @@ jobs: run: | cat > setup.sh <<'EOF' chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh - /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" + /bin/bash -c "./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh -y" echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml EOF @@ -61,7 +61,7 @@ jobs: if: ${{ runner.os == 'Windows' }} run: | New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" + Set-Content .\setup.bat -Value "powershell.exe .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y" Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin From 3b3f1e8c76e85affec944d73a950b68464461d35 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 09:17:08 -0500 Subject: [PATCH 14/76] Remove second mkdir Signed-off-by: Stephen Crawford --- .github/actions/install-dashboards/action.yml | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index 5e1f2e6d0..edbd22fdc 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -34,18 +34,6 @@ runs: ref: 'main' fetch-depth: 0 - - name: Setup plugin directory for Linux - if: ${{ runner.os == 'Linux' }} - run: mkdir -p plugins - working-directory: OpenSearch-Dashboards - shell: bash - - - name: Setup plugin directory for Windows - if: ${{ runner.os == 'Windows' }} - run: mkdir -p plugins - working-directory: OpenSearch-Dashboards - shell: pwsh - - uses: actions/checkout@v2 with: path: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} From 93e73c777532cfdbfbcf00dc1a27034a5a1e82c3 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 10:04:36 -0500 Subject: [PATCH 15/76] upload coverage Signed-off-by: Stephen Crawford --- .github/actions/install-dashboards/action.yml | 4 ++++ .github/workflows/integration-test.yml | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index edbd22fdc..79136bb2c 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -88,6 +88,8 @@ runs: npm uninstall -g yarn echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} + yarn cache clean + yarn add sha.js working-directory: OpenSearch-Dashboards shell: bash @@ -97,6 +99,8 @@ runs: npm uninstall -g yarn echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} + yarn cache clean + yarn add sha.js working-directory: OpenSearch-Dashboards shell: pwsh diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 3bb34dde3..ce6713d4b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -76,7 +76,7 @@ jobs: with: plugin_name: security-dashboards-plugin - - name: Start Dashboards in background on Linux + - name: Start Dashboards in background run: node scripts/build_opensearch_dashboards_platform_plugins.js working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} @@ -94,4 +94,9 @@ jobs: echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k yarn test:jest_server --coverage - working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} \ No newline at end of file + working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} + + - name: Uploads coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 6284ec47b79dcdacfbc0ef73c9d0d29b68203738 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 10:05:12 -0500 Subject: [PATCH 16/76] remove coverage checkc Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 7 ------- 1 file changed, 7 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ce6713d4b..4a9b4634d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -85,7 +85,6 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - name: Run integration tests on Windows @@ -93,10 +92,4 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - - - name: Uploads coverage - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 4387414f44b9ecc0790c9cbf776711a3b922acd0 Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 12:05:42 -0500 Subject: [PATCH 17/76] Run in band Signed-off-by: Stephen Crawford --- .github/workflows/cypress-test.yml | 2 +- .github/workflows/integration-test.yml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 21e0b993d..ffbc962c4 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -21,7 +21,7 @@ jobs: matrix: #os: [ ubuntu-latest , windows-latest ] #os: [ windows-latest ] - os: [ ubuntu-latest ] + # os: [ ubuntu-latest ] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4a9b4634d..975ec0e3f 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -85,6 +85,7 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k + yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - name: Run integration tests on Windows @@ -92,4 +93,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k + yarn test:jest_server --runInBand working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From 236ad9533456be321f7782693b8686f19519e3ee Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 12:08:25 -0500 Subject: [PATCH 18/76] Make not background Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 975ec0e3f..1f3c00c4c 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -93,5 +93,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --runInBand + yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} diff --git a/package.json b/package.json index 37d0dce36..0ee237804 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "lint:es": "node ../../scripts/eslint", "lint:style": "node ../../scripts/stylelint", "lint": "yarn run lint:es && yarn run lint:style", - "pretest:jest_server": "node ./test/jest_integration/runIdpServer.js &", + "pretest:jest_server": "node ./test/jest_integration/runIdpServer.js", "test:jest_server": "node ./test/run_jest_tests.js --config ./test/jest.config.server.js", "test:jest_ui": "node ./test/run_jest_tests.js --config ./test/jest.config.ui.js" }, From 1a6def334026c7adf4029f076800c10ed32a198c Mon Sep 17 00:00:00 2001 From: Stephen Crawford Date: Thu, 15 Dec 2022 12:56:21 -0500 Subject: [PATCH 19/76] Revert resolved conflict Signed-off-by: Stephen Crawford --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 1f3c00c4c..4f85dad5d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -93,5 +93,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage + node .\test\run_jest_tests.js --config .\test\jest.config.server.js working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From 0468402637d39638f1a4671b3fd38e2817e46970 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 15 Dec 2022 13:53:39 -0500 Subject: [PATCH 20/76] Add specification for firefox driver on different os runners Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 4f85dad5d..e2ef0114d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -33,8 +33,16 @@ jobs: - uses: browser-actions/setup-geckodriver@latest - run: geckodriver --version + - name: Set up Firefox browser for Linux + if: ${{ runner.os == 'Linux' }} + uses: browser-actions/setup-firefox@latest + with: + browser: firefox + version: latest + # Browser-action version does not work on Windows - - name: Set up Firefox browser + - name: Set up Firefox browser for Windows + if: ${{ runner.os == 'Windows' }} uses: abhi1693/setup-browser@main with: browser: firefox From 2b117aed9425a1d56401217be2b79e1d28799d40 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 15 Dec 2022 14:06:12 -0500 Subject: [PATCH 21/76] Reference the firefox setup for windows to RyanL1997 Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e2ef0114d..a95014cbe 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -43,7 +43,7 @@ jobs: # Browser-action version does not work on Windows - name: Set up Firefox browser for Windows if: ${{ runner.os == 'Windows' }} - uses: abhi1693/setup-browser@main + uses: RyanL1997/setup-browser@main with: browser: firefox version: latest From 6ad568bb9834b1c07dc10f5335906eed85d26e13 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 16 Dec 2022 13:12:27 -0500 Subject: [PATCH 22/76] Add config for opensearch.yml for windows setup Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a95014cbe..96168e7dd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -70,6 +70,7 @@ jobs: run: | New-Item .\setup.bat -type file Set-Content .\setup.bat -Value "powershell.exe .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y" + Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin @@ -79,6 +80,10 @@ jobs: plugin-name: ${{ env.PLUGIN_NAME }} setup-script-name: setup + - name: Show Opensearch.yml + if: ${{ runner.os == 'Windows' }} + run: Get-Content .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml + - id: install-dashboards uses: ./.github/actions/install-dashboards with: From 4a62d9fa7ebb3a7cc513cda3a2e3070fc1eefd5f Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 16 Dec 2022 13:40:16 -0500 Subject: [PATCH 23/76] Switch back to yarn for integ test Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 96168e7dd..975a8de33 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -106,5 +106,6 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node .\test\run_jest_tests.js --config .\test\jest.config.server.js + yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} + #node .\test\run_jest_tests.js --config .\test\jest.config.server.js From f7dba319b0dc607c42fcde1bfd240835766367b4 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 16 Dec 2022 14:53:58 -0500 Subject: [PATCH 24/76] Add run IDP server command for Windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 975a8de33..13c17b543 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -106,6 +106,6 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage + node .\test\jest_integration\runIdpServer.js & + node .\test\run_jest_tests.js --config .\test\jest.config.server.js working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - #node .\test\run_jest_tests.js --config .\test\jest.config.server.js diff --git a/package.json b/package.json index 0ee237804..37d0dce36 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "lint:es": "node ../../scripts/eslint", "lint:style": "node ../../scripts/stylelint", "lint": "yarn run lint:es && yarn run lint:style", - "pretest:jest_server": "node ./test/jest_integration/runIdpServer.js", + "pretest:jest_server": "node ./test/jest_integration/runIdpServer.js &", "test:jest_server": "node ./test/run_jest_tests.js --config ./test/jest.config.server.js", "test:jest_ui": "node ./test/run_jest_tests.js --config ./test/jest.config.ui.js" }, From 82e3a9cdee01eb7694a2991a803d405349473dfe Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Sat, 17 Dec 2022 00:08:23 -0500 Subject: [PATCH 25/76] Switch back to yarn for Windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 13c17b543..ff9cb84cb 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -106,6 +106,7 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node .\test\jest_integration\runIdpServer.js & - node .\test\run_jest_tests.js --config .\test\jest.config.server.js + yarn test:jest_server working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} + #node .\test\jest_integration\runIdpServer.js & + #node .\test\run_jest_tests.js --config .\test\jest.config.server.js From a7cd2b2665964284549ab22c8728f29884bb4d5c Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 5 Jan 2023 10:55:10 -0800 Subject: [PATCH 26/76] Switch back to yarn for Windows runner Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 20 ++++++++++++++------ .github/workflows/integration-test.yml | 3 ++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index ffbc962c4..377bf9c7b 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -1,6 +1,6 @@ name: Cypress Tests -on: [] #push, pull_request +on: [ push, pull_request ] env: TEST_BROWSER_HEADLESS: 1 @@ -20,11 +20,17 @@ jobs: fail-fast: false matrix: #os: [ ubuntu-latest , windows-latest ] - #os: [ windows-latest ] - # os: [ ubuntu-latest ] + os: [ windows-latest ] + #os: [ ubuntu-latest ] + jdk: [11] #17 runs-on: ${{ matrix.os }} steps: + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} + - name: Checkout Branch uses: actions/checkout@v2 @@ -34,7 +40,7 @@ jobs: - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} @@ -78,8 +84,10 @@ jobs: echo 'opensearch_security.readonly_mode.roles: ["kibana_read_only"]' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.cookie.secure: false' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml - yarn start --no-base-path --no-watch & - sleep 300 + cat ./config/opensearch_dashboards.yml + run node ../../scripts/opensearch-dashboards --dev --no-base-path & + sleep 500 +#yarn start --no-base-path --no-watch & - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ff9cb84cb..e4079ca60 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -106,7 +106,8 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server + Start-Process yarn -ArgumentList 'pretest:jest_server' + node .\test\run_jest_tests.js --config .\test\jest.config.server.js working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} #node .\test\jest_integration\runIdpServer.js & #node .\test\run_jest_tests.js --config .\test\jest.config.server.js From 00986d24292499ee9471db68f59f7c88cd5c1778 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 6 Jan 2023 07:59:03 -0800 Subject: [PATCH 27/76] Enable both Linux and windows runner Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 6 +++--- .github/workflows/integration-test.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 377bf9c7b..3d5d2bfb2 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -19,10 +19,10 @@ jobs: strategy: fail-fast: false matrix: - #os: [ ubuntu-latest , windows-latest ] - os: [ windows-latest ] + os: [ ubuntu-latest , windows-latest ] + #os: [ windows-latest ] #os: [ ubuntu-latest ] - jdk: [11] #17 + jdk: [11, 17] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index e4079ca60..60380452c 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -15,10 +15,10 @@ jobs: strategy: fail-fast: false matrix: - #os: [ ubuntu-latest , windows-latest ] - os: [ windows-latest ] + os: [ ubuntu-latest , windows-latest ] + #os: [ windows-latest ] #os: [ ubuntu-latest ] - jdk: [11] #17 + jdk: [11, 17] runs-on: ${{ matrix.os }} steps: From 787c9babf5c755bafb9225ac345f1c4b7c898b6b Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 6 Jan 2023 10:13:10 -0800 Subject: [PATCH 28/76] Change the cypress test script to support both linux and windows runners Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 60380452c..6975d9214 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -94,20 +94,20 @@ jobs: working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} - name: Run integration tests on Linux - if: ${{ runner.os == 'Linux' }} + #if: ${{ runner.os == 'Linux' }} run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - - name: Run integration tests on Windows - if: ${{ runner.os == 'Windows' }} - run: | - echo "check if opensearch is ready" - curl -XGET https://localhost:9200 -u 'admin:admin' -k - Start-Process yarn -ArgumentList 'pretest:jest_server' - node .\test\run_jest_tests.js --config .\test\jest.config.server.js - working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} + #- name: Run integration tests on Windows + # if: ${{ runner.os == 'Windows' }} + # run: | + # echo "check if opensearch is ready" + # curl -XGET https://localhost:9200 -u 'admin:admin' -k + # Start-Process yarn -ArgumentList 'pretest:jest_server' + # node .\test\run_jest_tests.js --config .\test\jest.config.server.js + # working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} #node .\test\jest_integration\runIdpServer.js & #node .\test\run_jest_tests.js --config .\test\jest.config.server.js From facdfe5f8900cd369f0c5841bfab26dfe7e2eeb2 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 6 Jan 2023 14:47:10 -0800 Subject: [PATCH 29/76] Switch back to yarn and extend sleep time to 800 seconds for cypress test Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 3d5d2bfb2..bfe3ac6f4 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -85,9 +85,9 @@ jobs: echo 'opensearch_security.cookie.secure: false' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml - run node ../../scripts/opensearch-dashboards --dev --no-base-path & - sleep 500 -#yarn start --no-base-path --no-watch & + yarn start --no-base-path --no-watch & + sleep 800 + #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - name: Checkout uses: actions/checkout@v2 From 9326f3f44451b65139842a591f094f6f55186e9d Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 09:44:07 -0800 Subject: [PATCH 30/76] Change the distribution build version back to 'latest' Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 7 ++++--- .github/workflows/integration-test.yml | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index bfe3ac6f4..439825e5d 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -36,11 +36,11 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip + run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} @@ -86,7 +86,7 @@ jobs: echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml yarn start --no-base-path --no-watch & - sleep 800 + sleep 500 #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - name: Checkout @@ -106,3 +106,4 @@ jobs: with: working-directory: ${{ env.FTR_PATH }} command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} + wait-on: 'http://localhost:5601' diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 6975d9214..6e27e794d 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -50,11 +50,11 @@ jobs: - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - name: Download OpenSearch Security Plugin on Windows if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/6708/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip + run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} From 5edfd44b6e59e29de6bf71c98eddc5cb8b1eec50 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 13:41:51 -0800 Subject: [PATCH 31/76] Add log for osd set up Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 439825e5d..4e7fb3854 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -84,9 +84,12 @@ jobs: echo 'opensearch_security.readonly_mode.roles: ["kibana_read_only"]' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.cookie.secure: false' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml + echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml yarn start --no-base-path --no-watch & sleep 500 + ls + cat osd.log #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - name: Checkout From 6204d6a2fbf4eadf50d0b2aa0e5906bddd5d3ed7 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 14:48:12 -0800 Subject: [PATCH 32/76] Add flags for yarn command of OSD setup Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 4e7fb3854..002e1916d 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -86,9 +86,8 @@ jobs: echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml - yarn start --no-base-path --no-watch & + yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch --oss & sleep 500 - ls cat osd.log #run node ../../scripts/opensearch-dashboards --dev --no-base-path & From 07a2f8594b73097942f0cf66757e3ff96c712e36 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 14:59:25 -0800 Subject: [PATCH 33/76] Add curl command to see if OSD runs up Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 002e1916d..72e398110 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -89,6 +89,8 @@ jobs: yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch --oss & sleep 500 cat osd.log + curl -XGET http://localhost:5601 -L + #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - name: Checkout @@ -102,10 +104,11 @@ jobs: id: cypress_version run: | echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" + curl -XGET http://localhost:5601 -L - name: Run tests uses: cypress-io/github-action@v2 with: working-directory: ${{ env.FTR_PATH }} command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} - wait-on: 'http://localhost:5601' + #wait-on: 'http://localhost:5601' From b66d2561ef99236928362da5ea1141ec642f3fef Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 15:19:24 -0800 Subject: [PATCH 34/76] Remove cat for OSD logs Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 72e398110..af3314380 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -88,7 +88,7 @@ jobs: cat ./config/opensearch_dashboards.yml yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch --oss & sleep 500 - cat osd.log + #cat osd.log curl -XGET http://localhost:5601 -L #run node ../../scripts/opensearch-dashboards --dev --no-base-path & From 9fcb57efdd7ab8d8026b51010702ddc574d14f66 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 15:20:42 -0800 Subject: [PATCH 35/76] Remove cat for OSD logs attempt 2 Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index af3314380..1873df050 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -88,9 +88,10 @@ jobs: cat ./config/opensearch_dashboards.yml yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch --oss & sleep 500 - #cat osd.log curl -XGET http://localhost:5601 -L - + + #cat osd.log + #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - name: Checkout From e0880e7a370f2ffe83c0ad8125f326fdf4f2f2f9 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 15:43:57 -0800 Subject: [PATCH 36/76] remove oss flag for OSD setup command Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 1873df050..3279f8e52 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -86,7 +86,7 @@ jobs: echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml - yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch --oss & + yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch & sleep 500 curl -XGET http://localhost:5601 -L From 9ea17464c67498766fe692578b612b3f8b2c4eea Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 16:37:34 -0800 Subject: [PATCH 37/76] Remove the cwd flag for OSD setup Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 3279f8e52..8460cc94d 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -86,7 +86,7 @@ jobs: echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml - yarn --cwd OpenSearch-Dashboards start --no-base-path --no-watch & + yarn start --no-base-path --no-watch & sleep 500 curl -XGET http://localhost:5601 -L From 8c7111ee7784360ffa00aff71e2ceb165a895d24 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 20:15:54 -0800 Subject: [PATCH 38/76] Add cat osd.log back Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 8460cc94d..845cd04d4 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -88,6 +88,7 @@ jobs: cat ./config/opensearch_dashboards.yml yarn start --no-base-path --no-watch & sleep 500 + cat osd.log curl -XGET http://localhost:5601 -L #cat osd.log From 068373d6886496765cde8d3fe49850e4851c77a8 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 9 Jan 2023 20:21:56 -0800 Subject: [PATCH 39/76] Change to 0.0.0.0 after checkout to ftr Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 845cd04d4..14e7f0dcc 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -106,7 +106,7 @@ jobs: id: cypress_version run: | echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" - curl -XGET http://localhost:5601 -L + curl -XGET http://0.0.0.0:5601 -L - name: Run tests uses: cypress-io/github-action@v2 From af37758d611254a4035cb7e61c0a8077eeca6208 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 12 Jan 2023 12:18:29 -0800 Subject: [PATCH 40/76] Enable unit test Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 6 ++---- .github/workflows/integration-test.yml | 4 +--- .github/workflows/unit-test.yml | 2 +- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 14e7f0dcc..8d449887c 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -20,9 +20,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - #os: [ windows-latest ] - #os: [ ubuntu-latest ] - jdk: [11, 17] + jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: @@ -113,4 +111,4 @@ jobs: with: working-directory: ${{ env.FTR_PATH }} command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} - #wait-on: 'http://localhost:5601' + wait-on: 'http://localhost:5601' diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 6e27e794d..61084f4eb 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -16,9 +16,7 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - #os: [ windows-latest ] - #os: [ ubuntu-latest ] - jdk: [11, 17] + jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 68af86133..de2572654 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,6 +1,6 @@ name: Unit Tests -on: [] #push, pull_request +on: [ push, pull_request ] jobs: unit-tests: From aed95c29564f82e134cd88a353a947b1adac56b6 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 20 Jan 2023 11:57:16 -0800 Subject: [PATCH 41/76] Use nohup for osd setup Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 8d449887c..317b65eef 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -84,12 +84,12 @@ jobs: echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml cat ./config/opensearch_dashboards.yml - yarn start --no-base-path --no-watch & + nohup yarn start --no-base-path --no-watch & sleep 500 cat osd.log - curl -XGET http://localhost:5601 -L - + #cat osd.log + #curl -XGET http://localhost:5601 -L #run node ../../scripts/opensearch-dashboards --dev --no-base-path & @@ -104,7 +104,8 @@ jobs: id: cypress_version run: | echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" - curl -XGET http://0.0.0.0:5601 -L + + #curl -XGET http://0.0.0.0:5601 -L - name: Run tests uses: cypress-io/github-action@v2 From 95c793f5172a908af07ef1a6a3076a87864ea4c1 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 20 Jan 2023 12:37:45 -0800 Subject: [PATCH 42/76] Modify create setup script for windows Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 61084f4eb..2f3119db1 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -63,11 +63,19 @@ jobs: echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml EOF + #- name: Create Setup Script for Windows + # if: ${{ runner.os == 'Windows' }} + # run: | + # New-Item .\setup.bat -type file + # Set-Content .\setup.bat -Value "powershell.exe .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y" + # Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" + # Get-Content .\setup.bat + - name: Create Setup Script for Windows if: ${{ runner.os == 'Windows' }} run: | New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y" + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" Get-Content .\setup.bat From 722851faa6cec8b3acb3b6c83bf5b3a682452c69 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 20 Jan 2023 13:48:28 -0800 Subject: [PATCH 43/76] Add working dir to Cypress workflow Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 317b65eef..b67a148d9 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -87,6 +87,7 @@ jobs: nohup yarn start --no-base-path --no-watch & sleep 500 cat osd.log + working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} #cat osd.log #curl -XGET http://localhost:5601 -L From 50c48f243bcbaa558f472c8f00483595eba90eac Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Fri, 20 Jan 2023 14:16:16 -0800 Subject: [PATCH 44/76] Check 9200 status before and after checkout to ftr Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index b67a148d9..38297096e 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -94,6 +94,11 @@ jobs: #run node ../../scripts/opensearch-dashboards --dev --no-base-path & + - name: Check if 9200 is ready before checkout to ftr + run: | + echo "check if opensearch is ready" + curl -XGET https://localhost:9200 -u 'admin:admin' -k + - name: Checkout uses: actions/checkout@v2 with: @@ -106,8 +111,13 @@ jobs: run: | echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" - #curl -XGET http://0.0.0.0:5601 -L - + #curl -XGET http://0.0.0.0:5601 -L + ##### + - name: Check if 9200 is ready after checkout to ftr + run: | + echo "check if opensearch is ready" + curl -XGET https://localhost:9200 -u 'admin:admin' -k + - name: Run tests uses: cypress-io/github-action@v2 with: From fc015425fe33215012e7e633ba881a12fa9e2bc7 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 10:51:54 -0800 Subject: [PATCH 45/76] Change the demo config installation command for linux Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2f3119db1..6556a6cb8 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -59,7 +59,7 @@ jobs: run: | cat > setup.sh <<'EOF' chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh - /bin/bash -c "./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh -y" + /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml EOF From d6966e98d7cbcfb6ce92195339cc8539b12440db Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 13:25:47 -0800 Subject: [PATCH 46/76] checkout with v3 Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 38297096e..415d92abe 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -100,7 +100,7 @@ jobs: curl -XGET https://localhost:9200 -u 'admin:admin' -k - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: ${{ env.FTR_PATH }} repository: opensearch-project/opensearch-dashboards-functional-test From 869cf3bd0071df1d8c8898112aa77d92dd9a0336 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 14:38:53 -0800 Subject: [PATCH 47/76] Merge the ftr checkout into one step Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 61 ++++++++++++++++-------------- 1 file changed, 33 insertions(+), 28 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 415d92abe..06b7c208e 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -30,7 +30,7 @@ jobs: java-version: ${{ matrix.jdk }} - name: Checkout Branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Download OpenSearch Security Plugin on Linux if: ${{ runner.os == 'Linux' }} @@ -87,6 +87,11 @@ jobs: nohup yarn start --no-base-path --no-watch & sleep 500 cat osd.log + git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git + ls + cd opensearch-dashboards-functional-test + npm install cypress --save-dev + yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} #cat osd.log @@ -94,33 +99,33 @@ jobs: #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - - name: Check if 9200 is ready before checkout to ftr - run: | - echo "check if opensearch is ready" - curl -XGET https://localhost:9200 -u 'admin:admin' -k - - - name: Checkout - uses: actions/checkout@v3 - with: - path: ${{ env.FTR_PATH }} - repository: opensearch-project/opensearch-dashboards-functional-test - ref: 'main' - - - name: Get Cypress version - id: cypress_version - run: | - echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" + #- name: Check if 9200 is ready before checkout to ftr + # run: | + # echo "check if opensearch is ready" + # curl -XGET https://localhost:9200 -u 'admin:admin' -k +# + #- name: Checkout + # uses: actions/checkout@v3 + # with: + # path: ${{ env.FTR_PATH }} + # repository: opensearch-project/opensearch-dashboards-functional-test + # ref: 'main' +# + #- name: Get Cypress version + # id: cypress_version + # run: | + # echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" #curl -XGET http://0.0.0.0:5601 -L ##### - - name: Check if 9200 is ready after checkout to ftr - run: | - echo "check if opensearch is ready" - curl -XGET https://localhost:9200 -u 'admin:admin' -k - - - name: Run tests - uses: cypress-io/github-action@v2 - with: - working-directory: ${{ env.FTR_PATH }} - command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} - wait-on: 'http://localhost:5601' + # - name: Check if 9200 is ready after checkout to ftr + # run: | + # echo "check if opensearch is ready" + # curl -XGET https://localhost:9200 -u 'admin:admin' -k +# + # - name: Run tests + # uses: cypress-io/github-action@v2 + # with: + # working-directory: ${{ env.FTR_PATH }} + # command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} + # wait-on: 'http://localhost:5601' From cc596f4afc21b34b2f9d52edbb31cc91861b1f23 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 15:07:59 -0800 Subject: [PATCH 48/76] Switch the test browser from chromium to chrome for Cypress test Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 06b7c208e..3bbb596b3 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -91,7 +91,7 @@ jobs: ls cd opensearch-dashboards-functional-test npm install cypress --save-dev - yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} + yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec ${{ env.SPEC }} working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} #cat osd.log From ca7c6dd4a920e859c6ac2c683d34e912ea68c6ce Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 15:59:59 -0800 Subject: [PATCH 49/76] Extract the test into another step Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 7 +++++-- .github/workflows/integration-test.yml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 3bbb596b3..9fc9f0bef 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -88,11 +88,14 @@ jobs: sleep 500 cat osd.log git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git + + - name: Clone Functional Test Repository and run Cypress test + run: | + git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git ls cd opensearch-dashboards-functional-test npm install cypress --save-dev - yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec ${{ env.SPEC }} - working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} + yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" #cat osd.log #curl -XGET http://localhost:5601 -L diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 6556a6cb8..a2a539a7b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -21,7 +21,7 @@ jobs: steps: - name: Checkout Branch - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up JDK uses: actions/setup-java@v1 From c619e88bd58f3621b8a5ed8a5f095f6400da280e Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 16:36:47 -0800 Subject: [PATCH 50/76] Merge the clone step back to setup Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 9fc9f0bef..d957b48b4 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -88,15 +88,19 @@ jobs: sleep 500 cat osd.log git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git - - - name: Clone Functional Test Repository and run Cypress test - run: | - git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git ls cd opensearch-dashboards-functional-test npm install cypress --save-dev yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" + #- name: Clone Functional Test Repository and run Cypress test + # run: | + # git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git + # ls + # cd opensearch-dashboards-functional-test + # npm install cypress --save-dev + # yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" + #cat osd.log #curl -XGET http://localhost:5601 -L From 9a9b362ae11d98adfe2ff07fbcd478e972ccc64a Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 21:06:09 -0800 Subject: [PATCH 51/76] Refactor Cypress workflow Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 49 ++---------------------------- 1 file changed, 2 insertions(+), 47 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index d957b48b4..777f333d0 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -67,8 +67,8 @@ jobs: with: plugin_name: security-dashboards-plugin - - name: Configure and Run OpenSearch Dashboards - continue-on-error: false + # TODO: Switch back to action for checkout after the fix of windows runner. + - name: Configure and Run OpenSearch Dashboards with Cypress Test Cases run: | cd ./OpenSearch-Dashboards echo 'server.host: "0.0.0.0"' >> ./config/opensearch_dashboards.yml @@ -88,51 +88,6 @@ jobs: sleep 500 cat osd.log git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git - ls cd opensearch-dashboards-functional-test npm install cypress --save-dev yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" - - #- name: Clone Functional Test Repository and run Cypress test - # run: | - # git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git - # ls - # cd opensearch-dashboards-functional-test - # npm install cypress --save-dev - # yarn cypress:run-with-security-and-aggregation-view --browser chrome --spec "cypress/integration/plugins/security-dashboards-plugin/aggregation_view.js" - - #cat osd.log - #curl -XGET http://localhost:5601 -L - - #run node ../../scripts/opensearch-dashboards --dev --no-base-path & - - #- name: Check if 9200 is ready before checkout to ftr - # run: | - # echo "check if opensearch is ready" - # curl -XGET https://localhost:9200 -u 'admin:admin' -k -# - #- name: Checkout - # uses: actions/checkout@v3 - # with: - # path: ${{ env.FTR_PATH }} - # repository: opensearch-project/opensearch-dashboards-functional-test - # ref: 'main' -# - #- name: Get Cypress version - # id: cypress_version - # run: | - # echo "::set-output name=cypress_version::$(cat ./${{ env.FTR_PATH }}/package.json | jq '.devDependencies.cypress' | tr -d '"')" - - #curl -XGET http://0.0.0.0:5601 -L - ##### - # - name: Check if 9200 is ready after checkout to ftr - # run: | - # echo "check if opensearch is ready" - # curl -XGET https://localhost:9200 -u 'admin:admin' -k -# - # - name: Run tests - # uses: cypress-io/github-action@v2 - # with: - # working-directory: ${{ env.FTR_PATH }} - # command: yarn cypress:run-with-security-and-aggregation-view --browser chromium --spec ${{ env.SPEC }} - # wait-on: 'http://localhost:5601' From bb352bbd5587ed8748d12dd2e818046ac321e383 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Mon, 23 Jan 2023 21:51:13 -0800 Subject: [PATCH 52/76] Hook to RyanL1997 for testing proper timeout gap Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 777f333d0..a6f882058 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -56,7 +56,8 @@ jobs: Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin - uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main + #uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main + uses: RyanL1997/security/.github/actions/start-opensearch-with-one-plugin@extend-sleep-time with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} plugin-name: ${{ env.PLUGIN_NAME }} From b3dc3584bacc7230e041db405a60463218bc1b9a Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 10:29:54 -0800 Subject: [PATCH 53/76] Fix the setup script for windows with correct flags Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index a6f882058..5827f8a94 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -52,7 +52,7 @@ jobs: if: ${{ runner.os == 'Windows' }} run: | New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin From 8b798ebed777fc2e64fd32f36f1e7a6b933c9d39 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 10:37:15 -0800 Subject: [PATCH 54/76] Switch back to original repo Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 5827f8a94..f69875ab4 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -56,8 +56,7 @@ jobs: Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin - #uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main - uses: RyanL1997/security/.github/actions/start-opensearch-with-one-plugin@extend-sleep-time + uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} plugin-name: ${{ env.PLUGIN_NAME }} From a11e5ae7e797c2008864e7a3a49cc5e814c9ade5 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 11:06:27 -0800 Subject: [PATCH 55/76] Fix the setup command for integ test with correct flags Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a2a539a7b..3e54391da 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -63,19 +63,11 @@ jobs: echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml EOF - #- name: Create Setup Script for Windows - # if: ${{ runner.os == 'Windows' }} - # run: | - # New-Item .\setup.bat -type file - # Set-Content .\setup.bat -Value "powershell.exe .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y" - # Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" - # Get-Content .\setup.bat - - name: Create Setup Script for Windows if: ${{ runner.os == 'Windows' }} run: | New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe -noexit -command `"echo 'y' | .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat`"" + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" Get-Content .\setup.bat From 57b9c58bdd3a1742e4d2318064288b2b14bf938f Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 13:24:51 -0800 Subject: [PATCH 56/76] Move idp setup inside the saml integ test Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- test/jest_integration/runIdpServer.js | 34 ++++++++++++------------- test/jest_integration/saml_auth.test.ts | 18 +++++++++++++ 3 files changed, 36 insertions(+), 18 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 3e54391da..2970e9cae 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -96,7 +96,7 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage + node ./test/run_jest_tests.js --config ./test/jest.config.server.js working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} #- name: Run integration tests on Windows diff --git a/test/jest_integration/runIdpServer.js b/test/jest_integration/runIdpServer.js index 35533ae6c..057012293 100644 --- a/test/jest_integration/runIdpServer.js +++ b/test/jest_integration/runIdpServer.js @@ -13,20 +13,20 @@ * permissions and limitations under the License. */ -const { runServer } = require('saml-idp'); - -const { generate } = require('selfsigned'); - -const pems = generate(null, { - keySize: 2048, - clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', - days: 7300, -}); - -// Create certificate pair on the fly and pass it to runServer -runServer({ - acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', - audience: 'https://localhost:9200', - cert: pems.cert, - key: pems.private.toString().replace(/\r\n/, '\n'), -}); +//const { runServer } = require('saml-idp'); +// +//const { generate } = require('selfsigned'); +// +//const pems = generate(null, { +// keySize: 2048, +// clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', +// days: 7300, +//}); +// +//// Create certificate pair on the fly and pass it to runServer +//runServer({ +// acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', +// audience: 'https://localhost:9200', +// cert: pems.cert, +// key: pems.private.toString().replace(/\r\n/, '\n'), +//}); diff --git a/test/jest_integration/saml_auth.test.ts b/test/jest_integration/saml_auth.test.ts index f12143fbe..57d03d68c 100644 --- a/test/jest_integration/saml_auth.test.ts +++ b/test/jest_integration/saml_auth.test.ts @@ -42,6 +42,24 @@ describe('start OpenSearch Dashboards server', () => { const options = new Options().headless(); beforeAll(async () => { + const { runServer } = require('saml-idp'); + + const { generate } = require('selfsigned'); + + const pems = generate(null, { + keySize: 2048, + clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', + days: 7300, + }); + + // Create certificate pair on the fly and pass it to runServer + runServer({ + acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', + audience: 'https://localhost:9200', + cert: pems.cert, + key: pems.private.toString().replace(/\r\n/, '\n'), + }); + root = osdTestServer.createRootWithSettings( { plugins: { From 8dde5098ab89775e6ceca86ce0705552f7b608b5 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 15:21:56 -0800 Subject: [PATCH 57/76] Set up a seprate integ test sets for windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 21 +++++++-------- test/jest_integration/runIdpServer.js | 34 ++++++++++++------------- test/jest_integration/saml_auth.test.ts | 18 ------------- 3 files changed, 26 insertions(+), 47 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2970e9cae..ce02e9dcf 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -92,20 +92,17 @@ jobs: working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} - name: Run integration tests on Linux - #if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' }} run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node ./test/run_jest_tests.js --config ./test/jest.config.server.js + yarn test:jest_server --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - #- name: Run integration tests on Windows - # if: ${{ runner.os == 'Windows' }} - # run: | - # echo "check if opensearch is ready" - # curl -XGET https://localhost:9200 -u 'admin:admin' -k - # Start-Process yarn -ArgumentList 'pretest:jest_server' - # node .\test\run_jest_tests.js --config .\test\jest.config.server.js - # working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} - #node .\test\jest_integration\runIdpServer.js & - #node .\test\run_jest_tests.js --config .\test\jest.config.server.js + - name: Run integration tests on Windows + if: ${{ runner.os == 'Windows' }} + run: | + echo "check if opensearch is ready" + curl -XGET https://localhost:9200 -u 'admin:admin' -k + yarn test:jest_server --coverage --testPathIgnorePatterns=saml_auth.test.ts + working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} diff --git a/test/jest_integration/runIdpServer.js b/test/jest_integration/runIdpServer.js index 057012293..35533ae6c 100644 --- a/test/jest_integration/runIdpServer.js +++ b/test/jest_integration/runIdpServer.js @@ -13,20 +13,20 @@ * permissions and limitations under the License. */ -//const { runServer } = require('saml-idp'); -// -//const { generate } = require('selfsigned'); -// -//const pems = generate(null, { -// keySize: 2048, -// clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', -// days: 7300, -//}); -// -//// Create certificate pair on the fly and pass it to runServer -//runServer({ -// acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', -// audience: 'https://localhost:9200', -// cert: pems.cert, -// key: pems.private.toString().replace(/\r\n/, '\n'), -//}); +const { runServer } = require('saml-idp'); + +const { generate } = require('selfsigned'); + +const pems = generate(null, { + keySize: 2048, + clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', + days: 7300, +}); + +// Create certificate pair on the fly and pass it to runServer +runServer({ + acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', + audience: 'https://localhost:9200', + cert: pems.cert, + key: pems.private.toString().replace(/\r\n/, '\n'), +}); diff --git a/test/jest_integration/saml_auth.test.ts b/test/jest_integration/saml_auth.test.ts index 57d03d68c..f12143fbe 100644 --- a/test/jest_integration/saml_auth.test.ts +++ b/test/jest_integration/saml_auth.test.ts @@ -42,24 +42,6 @@ describe('start OpenSearch Dashboards server', () => { const options = new Options().headless(); beforeAll(async () => { - const { runServer } = require('saml-idp'); - - const { generate } = require('selfsigned'); - - const pems = generate(null, { - keySize: 2048, - clientCertificateCN: '/C=US/ST=California/L=San Francisco/O=JankyCo/CN=Test Identity Provider', - days: 7300, - }); - - // Create certificate pair on the fly and pass it to runServer - runServer({ - acsUrl: 'http://localhost:5601/_opendistro/_security/saml/acs', - audience: 'https://localhost:9200', - cert: pems.cert, - key: pems.private.toString().replace(/\r\n/, '\n'), - }); - root = osdTestServer.createRootWithSettings( { plugins: { From af67535794bb73238b15dfff075094595e234d62 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 16:21:42 -0800 Subject: [PATCH 58/76] Switch to node command for integ test windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ce02e9dcf..1e07dfcb8 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -104,5 +104,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - yarn test:jest_server --coverage --testPathIgnorePatterns=saml_auth.test.ts + node ./test/run_jest_tests.js --coverage --testPathIgnorePatterns=saml_auth.test.ts working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From 84dd9984c68fe4b034dfcca828a37253e389a103 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 17:20:26 -0800 Subject: [PATCH 59/76] Remove the ignore flag Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 1e07dfcb8..2491394bd 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -104,5 +104,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node ./test/run_jest_tests.js --coverage --testPathIgnorePatterns=saml_auth.test.ts + node ./test/run_jest_tests.js --coverage working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From 99543250db2c5c745e67faf064a7f7b74d2fa8a6 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 17:26:38 -0800 Subject: [PATCH 60/76] Add ingnore flag back Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 2491394bd..9ebfcffc1 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -104,5 +104,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node ./test/run_jest_tests.js --coverage + node ./test/run_jest_tests.js --coverage --testPathIgnorePatterns=**/test/jest_integration/**/saml_auth.test.ts working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From 1836b5b2f529428aaa6ea7d3005ce027769fd44c Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 19:22:44 -0800 Subject: [PATCH 61/76] Switch to node for integ windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 9ebfcffc1..3ae1f9886 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -88,6 +88,7 @@ jobs: plugin_name: security-dashboards-plugin - name: Start Dashboards in background +# if: ${{ runner.os == 'Linux' }} run: node scripts/build_opensearch_dashboards_platform_plugins.js working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} @@ -104,5 +105,6 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node ./test/run_jest_tests.js --coverage --testPathIgnorePatterns=**/test/jest_integration/**/saml_auth.test.ts + node .\test\jest_integration\runIdpServer.js & + node .\test\run_jest_tests.js --config .\test\jest.config.server.js working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From dc40463eb873d8fd75875456a8689479936cfc9a Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 20:01:15 -0800 Subject: [PATCH 62/76] Remove idp server command for integ windows runner Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 3ae1f9886..ca3d07167 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -105,6 +105,5 @@ jobs: run: | echo "check if opensearch is ready" curl -XGET https://localhost:9200 -u 'admin:admin' -k - node .\test\jest_integration\runIdpServer.js & - node .\test\run_jest_tests.js --config .\test\jest.config.server.js + node .\test\run_jest_tests.js --config .\test\jest.config.server.js --testPathIgnorePatterns saml_auth.test.ts working-directory: ${{ steps.install-dashboards.outputs.plugin-directory }} From a304c2cb416e3092d56cd8c8fd828e449902720b Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 24 Jan 2023 21:38:14 -0800 Subject: [PATCH 63/76] Change jwt auth testing output format Signed-off-by: Ryan Liang --- test/jest_integration/jwt_auth.test.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index 371abe961..a6bd5a4f5 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -284,9 +284,8 @@ describe('start OpenSearch Dashboards server', () => { await driver.get(`http://localhost:5601/app/opensearch_dashboards_overview?token=${token}`); const rep = await driver.getPageSource(); - expect(rep).toContain( - '"statusCode":401,"error":"Unauthorized","message":"Authentication Exception"' - ); + expect(rep).toContain('401'); + expect(rep).toContain('Unauthorized'); const cookie = await driver.manage().getCookies(); expect(cookie.length).toEqual(0); @@ -311,9 +310,8 @@ describe('start OpenSearch Dashboards server', () => { await driver.get(`http://localhost:5601/app/dev_tools?token=${token}`); const rep = await driver.getPageSource(); - expect(rep).toContain( - '"statusCode":401,"error":"Unauthorized","message":"Authentication Exception"' - ); + expect(rep).toContain('401'); + expect(rep).toContain('Unauthorized'); const cookie = await driver.manage().getCookies(); expect(cookie.length).toEqual(0); From 5e4542bdfba7bcacc88d222a6dd45849db8c1db7 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 25 Jan 2023 10:24:39 -0800 Subject: [PATCH 64/76] Solving comments and try jwt output Signed-off-by: Ryan Liang --- .github/actions/install-dashboards/action.yml | 2 -- .github/workflows/cypress-test.yml | 4 ---- .github/workflows/integration-test.yml | 5 ----- test/jest_integration/jwt_auth.test.ts | 2 ++ 4 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index 79136bb2c..712625306 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -40,7 +40,6 @@ runs: - id: osd-version-linux if: ${{ runner.os == 'Linux' }} - continue-on-error: true run: | echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" @@ -49,7 +48,6 @@ runs: - id: osd-version-windows if: ${{ runner.os == 'Windows' }} - continue-on-error: true run: | echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index f69875ab4..5fe2843bd 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -67,7 +67,6 @@ jobs: with: plugin_name: security-dashboards-plugin - # TODO: Switch back to action for checkout after the fix of windows runner. - name: Configure and Run OpenSearch Dashboards with Cypress Test Cases run: | cd ./OpenSearch-Dashboards @@ -82,11 +81,8 @@ jobs: echo 'opensearch_security.readonly_mode.roles: ["kibana_read_only"]' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.cookie.secure: false' >> ./config/opensearch_dashboards.yml echo 'opensearch_security.multitenancy.enable_aggregation_view: true' >> ./config/opensearch_dashboards.yml - echo 'logging.dest: osd.log' >> ./config/opensearch_dashboards.yml - cat ./config/opensearch_dashboards.yml nohup yarn start --no-base-path --no-watch & sleep 500 - cat osd.log git clone https://github.com/opensearch-project/opensearch-dashboards-functional-test.git cd opensearch-dashboards-functional-test npm install cypress --save-dev diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index ca3d07167..f3d262aaf 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -78,17 +78,12 @@ jobs: plugin-name: ${{ env.PLUGIN_NAME }} setup-script-name: setup - - name: Show Opensearch.yml - if: ${{ runner.os == 'Windows' }} - run: Get-Content .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml - - id: install-dashboards uses: ./.github/actions/install-dashboards with: plugin_name: security-dashboards-plugin - name: Start Dashboards in background -# if: ${{ runner.os == 'Linux' }} run: node scripts/build_opensearch_dashboards_platform_plugins.js working-directory: ${{ steps.install-dashboards.outputs.dashboards-directory }} diff --git a/test/jest_integration/jwt_auth.test.ts b/test/jest_integration/jwt_auth.test.ts index a6bd5a4f5..12c6d3ccc 100644 --- a/test/jest_integration/jwt_auth.test.ts +++ b/test/jest_integration/jwt_auth.test.ts @@ -286,6 +286,7 @@ describe('start OpenSearch Dashboards server', () => { const rep = await driver.getPageSource(); expect(rep).toContain('401'); expect(rep).toContain('Unauthorized'); + expect(rep).toContain('Authentication Exception'); const cookie = await driver.manage().getCookies(); expect(cookie.length).toEqual(0); @@ -312,6 +313,7 @@ describe('start OpenSearch Dashboards server', () => { const rep = await driver.getPageSource(); expect(rep).toContain('401'); expect(rep).toContain('Unauthorized'); + expect(rep).toContain('Authentication Exception'); const cookie = await driver.manage().getCookies(); expect(cookie.length).toEqual(0); From 895c627c2bb3306935812b0d2aa102a1c0de89d4 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 25 Jan 2023 15:43:07 -0800 Subject: [PATCH 65/76] Try reusable action for security plugin downloads Signed-off-by: Ryan Liang --- .../download-security-plugin/action.yml | 59 +++++++++++++++++++ .github/workflows/cypress-test.yml | 49 ++++++++------- 2 files changed, 87 insertions(+), 21 deletions(-) create mode 100644 .github/actions/download-security-plugin/action.yml diff --git a/.github/actions/download-security-plugin/action.yml b/.github/actions/download-security-plugin/action.yml new file mode 100644 index 000000000..eff7ac314 --- /dev/null +++ b/.github/actions/download-security-plugin/action.yml @@ -0,0 +1,59 @@ +name: 'Download Security Plugin' +description: 'Installs OpenSearch Dashboard with a Plugin from github, then checkouts the correct dashboards version for the plugin, configures npm/yarn, and bootstraps Dashboards' + +inputs: + opensearch-version: + description: 'The version of OpenSearch that should be used, e.g "3.0.0"' + required: true + + plugin-name: + description: 'The the name of the plugin to use, such as opensearch-security' + required: true + + plugin-version: + description: 'The version of security plugin that should be used, e.g "3.0.0.0"' + required: true + +runs: + using: "composite" + steps: + #- name: Download OpenSearch for Linux + # uses: peternied/download-file@v2 + # if: ${{ runner.os == 'Linux' }} + # with: + # url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip +# + #- name: Download OpenSearch for Windows + # uses: peternied/download-file@v2 + # if: ${{ runner.os == 'Windows' }} + # with: + # url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip + + - name: Download OpenSearch Security Plugin on Linux + if: ${{ runner.os == 'Linux' }} + run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + shell: bash + + - name: Download OpenSearch Security Plugin on Windows + if: ${{ runner.os == 'Windows' }} + run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip + shell: pwsh + + - name: Create Setup Script for Linux + if: ${{ runner.os == 'Linux' }} + run: | + cat > setup.sh <<'EOF' + chmod +x ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/plugins/${{ inputs.plugin-name }}/tools/install_demo_configuration.sh + /bin/bash -c "yes | ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/plugins/${{ inputs.plugin-name }}/tools/install_demo_configuration.sh" + echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/config/opensearch.yml + EOF + shell: bash + + - name: Create Setup Script for Windows + if: ${{ runner.os == 'Windows' }} + run: | + New-Item .\setup.bat -type file + Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ inputs.opensearch-version}}-SNAPSHOT\plugins\${{ inputs.plugin-name }}\tools\install_demo_configuration.bat -y -i -c`"" + Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ inputs.opensearch-version}}-SNAPSHOT\config\opensearch.yml" + Get-Content .\setup.bat + shell: pwsh diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 5fe2843bd..27714eb9b 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -32,28 +32,35 @@ jobs: - name: Checkout Branch uses: actions/checkout@v3 - - name: Download OpenSearch Security Plugin on Linux - if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - - - name: Download OpenSearch Security Plugin on Windows - if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - - - name: Create Setup Script for Linux - if: ${{ runner.os == 'Linux' }} - run: | - cat > setup.sh <<'EOF' - chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh - /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" - EOF +# - name: Download OpenSearch Security Plugin on Linux +# if: ${{ runner.os == 'Linux' }} +# run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip +# +# - name: Download OpenSearch Security Plugin on Windows +# if: ${{ runner.os == 'Windows' }} +# run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip +# +# - name: Create Setup Script for Linux +# if: ${{ runner.os == 'Linux' }} +# run: | +# cat > setup.sh <<'EOF' +# chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh +# /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" +# EOF +# +# - name: Create Setup Script for Windows +# if: ${{ runner.os == 'Windows' }} +# run: | +# New-Item .\setup.bat -type file +# Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" +# Get-Content .\setup.bat - - name: Create Setup Script for Windows - if: ${{ runner.os == 'Windows' }} - run: | - New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" - Get-Content .\setup.bat + - name: Download security plugin and create setup scripts + uses: ./.github/actions/download-security-plugin + with: + opensearch-version: ${{ env.OPENSEARCH_VERSION }} + plugin-name: ${{ env.PLUGIN_NAME }} + plugin-version: ${{ env.PLUGIN_VERSION }} - name: Run Opensearch with A Single Plugin uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main From 6ae66d6e81912ef0d763ca2ecc89ad43822fba82 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 25 Jan 2023 16:05:23 -0800 Subject: [PATCH 66/76] Apply reusable action for integ test workflow Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 23 -------------------- .github/workflows/integration-test.yml | 30 ++++++-------------------- 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 27714eb9b..34df7697d 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -31,29 +31,6 @@ jobs: - name: Checkout Branch uses: actions/checkout@v3 - -# - name: Download OpenSearch Security Plugin on Linux -# if: ${{ runner.os == 'Linux' }} -# run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -# -# - name: Download OpenSearch Security Plugin on Windows -# if: ${{ runner.os == 'Windows' }} -# run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip -# -# - name: Create Setup Script for Linux -# if: ${{ runner.os == 'Linux' }} -# run: | -# cat > setup.sh <<'EOF' -# chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh -# /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" -# EOF -# -# - name: Create Setup Script for Windows -# if: ${{ runner.os == 'Windows' }} -# run: | -# New-Item .\setup.bat -type file -# Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" -# Get-Content .\setup.bat - name: Download security plugin and create setup scripts uses: ./.github/actions/download-security-plugin diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index f3d262aaf..7446b046b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -46,30 +46,12 @@ jobs: browser: firefox version: latest - - name: Download OpenSearch Security Plugin on Linux - if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip - - - name: Download OpenSearch Security Plugin on Windows - if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.OPENSEARCH_VERSION }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ env.PLUGIN_NAME }}-${{ env.PLUGIN_VERSION }}.zip -Outfile opensearch-security.zip - - - name: Create Setup Script for Linux - if: ${{ runner.os == 'Linux' }} - run: | - cat > setup.sh <<'EOF' - chmod +x ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh - /bin/bash -c "yes | ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/plugins/${{ env.PLUGIN_NAME }}/tools/install_demo_configuration.sh" - echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT/config/opensearch.yml - EOF - - - name: Create Setup Script for Windows - if: ${{ runner.os == 'Windows' }} - run: | - New-Item .\setup.bat -type file - Set-Content .\setup.bat -Value "powershell.exe -noexit -command `".\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\plugins\${{ env.PLUGIN_NAME }}\tools\install_demo_configuration.bat -y -i -c`"" - Add-Content -Path .\setup.bat -Value "echo plugins.security.unsupported.restapi.allow_securityconfig_modification: true >> .\opensearch-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT\config\opensearch.yml" - Get-Content .\setup.bat + - name: Download security plugin and create setup scripts + uses: ./.github/actions/download-security-plugin + with: + opensearch-version: ${{ env.OPENSEARCH_VERSION }} + plugin-name: ${{ env.PLUGIN_NAME }} + plugin-version: ${{ env.PLUGIN_VERSION }} - name: Run Opensearch with A Single Plugin uses: opensearch-project/security/.github/actions/start-opensearch-with-one-plugin@main From 91da0461e2b676e7aaade4d26fe7f6906972a439 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 25 Jan 2023 23:19:03 -0800 Subject: [PATCH 67/76] rename setup action directory Signed-off-by: Ryan Liang --- .../{download-security-plugin => download-plugin}/action.yml | 0 .github/workflows/cypress-test.yml | 2 +- .github/workflows/integration-test.yml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename .github/actions/{download-security-plugin => download-plugin}/action.yml (100%) diff --git a/.github/actions/download-security-plugin/action.yml b/.github/actions/download-plugin/action.yml similarity index 100% rename from .github/actions/download-security-plugin/action.yml rename to .github/actions/download-plugin/action.yml diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index 34df7697d..ec59fb200 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -33,7 +33,7 @@ jobs: uses: actions/checkout@v3 - name: Download security plugin and create setup scripts - uses: ./.github/actions/download-security-plugin + uses: ./.github/actions/download-plugin with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} plugin-name: ${{ env.PLUGIN_NAME }} diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 7446b046b..a21c352a4 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -47,7 +47,7 @@ jobs: version: latest - name: Download security plugin and create setup scripts - uses: ./.github/actions/download-security-plugin + uses: ./.github/actions/download-plugin with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} plugin-name: ${{ env.PLUGIN_NAME }} From f49f3d641e74ca0a756c20ffab3e17c8facc0ed3 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 26 Jan 2023 10:53:25 -0800 Subject: [PATCH 68/76] Switch to new action with rename steps Signed-off-by: Ryan Liang --- .github/actions/download-plugin/action.yml | 40 ++++++++++++---------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/.github/actions/download-plugin/action.yml b/.github/actions/download-plugin/action.yml index eff7ac314..2d7af9ed6 100644 --- a/.github/actions/download-plugin/action.yml +++ b/.github/actions/download-plugin/action.yml @@ -17,27 +17,31 @@ inputs: runs: using: "composite" steps: - #- name: Download OpenSearch for Linux - # uses: peternied/download-file@v2 + - name: Download OpenSearch for Linux + uses: peternied/download-file@v2 + if: ${{ runner.os == 'Linux' }} + with: + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + + - name: Download OpenSearch for Windows + uses: peternied/download-file@v2 + if: ${{ runner.os == 'Windows' }} + with: + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + + #- name: Download OpenSearch Security Plugin on Linux # if: ${{ runner.os == 'Linux' }} - # with: - # url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + # run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + # shell: bash # - #- name: Download OpenSearch for Windows - # uses: peternied/download-file@v2 + #- name: Download OpenSearch Security Plugin on Windows # if: ${{ runner.os == 'Windows' }} - # with: - # url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip - - - name: Download OpenSearch Security Plugin on Linux - if: ${{ runner.os == 'Linux' }} - run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - shell: bash + # run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip + # shell: pwsh - - name: Download OpenSearch Security Plugin on Windows - if: ${{ runner.os == 'Windows' }} - run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip - shell: pwsh + - name: Rename the Plugin Files + run: mv opensearch-security-${{ inputs.plugin-version }}.zip opensearch-security.zip + shell: bash - name: Create Setup Script for Linux if: ${{ runner.os == 'Linux' }} @@ -45,7 +49,7 @@ runs: cat > setup.sh <<'EOF' chmod +x ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/plugins/${{ inputs.plugin-name }}/tools/install_demo_configuration.sh /bin/bash -c "yes | ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/plugins/${{ inputs.plugin-name }}/tools/install_demo_configuration.sh" - echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ inputs.opensearch-version}}-SNAPSHOT/config/opensearch.yml + echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> ./opensearch-${{ inputs.opensearch-version }}-SNAPSHOT/config/opensearch.yml EOF shell: bash From 6100ab81e6cbf85bbc284bd87e93a9b2744ab283 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 26 Jan 2023 11:27:01 -0800 Subject: [PATCH 69/76] Remove comments Signed-off-by: Ryan Liang --- .github/actions/download-plugin/action.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/actions/download-plugin/action.yml b/.github/actions/download-plugin/action.yml index 2d7af9ed6..0b5473a1e 100644 --- a/.github/actions/download-plugin/action.yml +++ b/.github/actions/download-plugin/action.yml @@ -28,16 +28,6 @@ runs: if: ${{ runner.os == 'Windows' }} with: url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - - #- name: Download OpenSearch Security Plugin on Linux - # if: ${{ runner.os == 'Linux' }} - # run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - # shell: bash -# - #- name: Download OpenSearch Security Plugin on Windows - # if: ${{ runner.os == 'Windows' }} - # run: Invoke-WebRequest -Uri https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip -Outfile opensearch-security.zip - # shell: pwsh - name: Rename the Plugin Files run: mv opensearch-security-${{ inputs.plugin-version }}.zip opensearch-security.zip From c4f2472923c25bc863265fa2ef846cc117c939c3 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 26 Jan 2023 15:02:34 -0800 Subject: [PATCH 70/76] Trim the install dashboards action Signed-off-by: Ryan Liang --- .github/actions/install-dashboards/action.yml | 38 +++---------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index 712625306..c6f84362c 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -38,35 +38,19 @@ runs: with: path: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} - - id: osd-version-linux - if: ${{ runner.os == 'Linux' }} + - id: osd-version run: | - echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" + echo "::set-output name=osd-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} shell: bash - - id: osd-version-windows - if: ${{ runner.os == 'Windows' }} - run: | - echo "::set-output name=osd-version-linux::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-4)" - echo "::set-output name=osd-x-version::$(cat package.json | jq '.opensearchDashboards.version' | cut -c 2-3)" - working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} - shell: pwsh - - id: branch-switch-if-possible-linux continue-on-error: true # Defaults onto main if the branch switch doesn't work - if: ${{ runner.os == 'Linux' && steps.osd-version-linux.outputs.osd-version-linux }} - run: git checkout ${{ steps.osd-version-linux.outputs.osd-version }} || git checkout ${{ steps.osd-version-linux.outputs.osd-x-version }}x + if: ${{ steps.osd-version-linux.outputs.osd-version }} + run: git checkout ${{ steps.osd-version.outputs.osd-version }} || git checkout ${{ steps.osd-version.outputs.osd-x-version }}x working-directory: ./OpenSearch-Dashboards shell: bash - - - id: branch-switch-if-possible-windows - continue-on-error: true # Defaults onto main if the branch switch doesn't work - if: ${{ runner.os == 'Windows' && steps.osd-version-linux.outputs.osd-version-windows }} - run: git checkout ${{ steps.osd-version-windows.outputs.osd-version }} || git checkout ${{ steps.osd-version-windows.outputs.osd-x-version }}x - working-directory: ./OpenSearch-Dashboards - shell: pwsh - id: tool-versions run: | @@ -80,8 +64,7 @@ runs: node-version: ${{ steps.tool-versions.outputs.node_version }} registry-url: 'https://registry.npmjs.org' - - name: Setup Opensearch Dashboards on Linux - if: ${{ runner.os == 'Linux' }} + - name: Setup Opensearch Dashboards run: | npm uninstall -g yarn echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" @@ -91,17 +74,6 @@ runs: working-directory: OpenSearch-Dashboards shell: bash - - name: Setup Opensearch Dashboards on Windows - if: ${{ runner.os == 'Windows' }} - run: | - npm uninstall -g yarn - echo "Installing yarn ${{ steps.tool-versions.outputs.yarn_version }}" - npm i -g yarn@${{ steps.tool-versions.outputs.yarn_version }} - yarn cache clean - yarn add sha.js - working-directory: OpenSearch-Dashboards - shell: pwsh - - name: Bootstrap the OpenSearch Dashboard uses: nick-fields/retry@v2 with: From 3dbbe4d6bfe287626fb08f2512f7da270c508bb7 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 31 Jan 2023 10:20:44 -0800 Subject: [PATCH 71/76] Switch to build id 7028 for security plugin Signed-off-by: Ryan Liang --- .github/actions/download-plugin/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/download-plugin/action.yml b/.github/actions/download-plugin/action.yml index 0b5473a1e..021df02a5 100644 --- a/.github/actions/download-plugin/action.yml +++ b/.github/actions/download-plugin/action.yml @@ -21,13 +21,13 @@ runs: uses: peternied/download-file@v2 if: ${{ runner.os == 'Linux' }} with: - url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/7028/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - name: Download OpenSearch for Windows uses: peternied/download-file@v2 if: ${{ runner.os == 'Windows' }} with: - url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/7028/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - name: Rename the Plugin Files run: mv opensearch-security-${{ inputs.plugin-version }}.zip opensearch-security.zip From 9da6a34d2dee2fb740f463a769b1f0e3a16b0654 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 31 Jan 2023 11:24:02 -0800 Subject: [PATCH 72/76] Refactor selenium driver setup Signed-off-by: Ryan Liang --- .github/workflows/integration-test.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index a21c352a4..39c1eafb8 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -31,12 +31,19 @@ jobs: - uses: browser-actions/setup-geckodriver@latest - run: geckodriver --version - - name: Set up Firefox browser for Linux + - name: Set up Firefox browser if: ${{ runner.os == 'Linux' }} - uses: browser-actions/setup-firefox@latest - with: - browser: firefox - version: latest + uses: browser-actions/setup-firefox@v1 + + - run: firefox --version + if: ${{ runner.os == 'Linux' }} + + #- name: Set up Firefox browser for Linux + # if: ${{ runner.os == 'Linux' }} + # uses: browser-actions/setup-firefox@latest + # with: + # browser: firefox + # version: latest # Browser-action version does not work on Windows - name: Set up Firefox browser for Windows From 0c95b14c1c108e8515d16c0b443a3e0f5da01452 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 31 Jan 2023 20:42:55 -0800 Subject: [PATCH 73/76] Try gecko driver commit id and remove jdk in cypress Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 10 +++++----- .github/workflows/integration-test.yml | 9 +-------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index ec59fb200..e2cd3e8eb 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -20,14 +20,14 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - jdk: [ 11, 17 ] + #jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: - - name: Set up JDK - uses: actions/setup-java@v1 - with: - java-version: ${{ matrix.jdk }} + #- name: Set up JDK + # uses: actions/setup-java@v1 + # with: + # java-version: ${{ matrix.jdk }} - name: Checkout Branch uses: actions/checkout@v3 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 39c1eafb8..8dd59c23a 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -28,7 +28,7 @@ jobs: with: java-version: ${{ matrix.jdk }} - - uses: browser-actions/setup-geckodriver@latest + - uses: browser-actions/setup-geckodriver@3570fb - run: geckodriver --version - name: Set up Firefox browser @@ -38,13 +38,6 @@ jobs: - run: firefox --version if: ${{ runner.os == 'Linux' }} - #- name: Set up Firefox browser for Linux - # if: ${{ runner.os == 'Linux' }} - # uses: browser-actions/setup-firefox@latest - # with: - # browser: firefox - # version: latest - # Browser-action version does not work on Windows - name: Set up Firefox browser for Windows if: ${{ runner.os == 'Windows' }} From 677e6c13f59b0db5b3da5d85527801729d920470 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Tue, 31 Jan 2023 21:08:43 -0800 Subject: [PATCH 74/76] Fix the osd-version naming and revert back Signed-off-by: Ryan Liang --- .github/actions/install-dashboards/action.yml | 4 ++-- .github/workflows/cypress-test.yml | 10 +++++----- .github/workflows/integration-test.yml | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/actions/install-dashboards/action.yml b/.github/actions/install-dashboards/action.yml index c6f84362c..d314c40f7 100644 --- a/.github/actions/install-dashboards/action.yml +++ b/.github/actions/install-dashboards/action.yml @@ -45,9 +45,9 @@ runs: working-directory: ${{ steps.determine-plugin-directory.outputs.plugin-directory }} shell: bash - - id: branch-switch-if-possible-linux + - id: branch-switch-if-possible continue-on-error: true # Defaults onto main if the branch switch doesn't work - if: ${{ steps.osd-version-linux.outputs.osd-version }} + if: ${{ steps.osd-version.outputs.osd-version }} run: git checkout ${{ steps.osd-version.outputs.osd-version }} || git checkout ${{ steps.osd-version.outputs.osd-x-version }}x working-directory: ./OpenSearch-Dashboards shell: bash diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index e2cd3e8eb..ec59fb200 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -20,14 +20,14 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - #jdk: [ 11, 17 ] + jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: - #- name: Set up JDK - # uses: actions/setup-java@v1 - # with: - # java-version: ${{ matrix.jdk }} + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.jdk }} - name: Checkout Branch uses: actions/checkout@v3 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 8dd59c23a..87091ba5f 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -28,7 +28,7 @@ jobs: with: java-version: ${{ matrix.jdk }} - - uses: browser-actions/setup-geckodriver@3570fb + - uses: browser-actions/setup-geckodriver@latest - run: geckodriver --version - name: Set up Firefox browser From 6a6c6e200119738b9cbd0fa5137a0cf3c2c49d3e Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 1 Feb 2023 09:32:59 -0800 Subject: [PATCH 75/76] Fix gecko branch and jdk 11 only Signed-off-by: Ryan Liang --- .github/workflows/cypress-test.yml | 3 +-- .github/workflows/integration-test.yml | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cypress-test.yml b/.github/workflows/cypress-test.yml index ec59fb200..10099fa47 100644 --- a/.github/workflows/cypress-test.yml +++ b/.github/workflows/cypress-test.yml @@ -20,14 +20,13 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: ${{ matrix.jdk }} + java-version: 11 - name: Checkout Branch uses: actions/checkout@v3 diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 87091ba5f..e445fa0af 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -16,7 +16,6 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest , windows-latest ] - jdk: [ 11, 17 ] runs-on: ${{ matrix.os }} steps: @@ -26,9 +25,9 @@ jobs: - name: Set up JDK uses: actions/setup-java@v1 with: - java-version: ${{ matrix.jdk }} + java-version: 11 - - uses: browser-actions/setup-geckodriver@latest + - uses: browser-actions/setup-geckodriver@v0.0.0 - run: geckodriver --version - name: Set up Firefox browser From e9fcee46cae4e5d687645f2287759247425c5069 Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Thu, 2 Feb 2023 13:25:41 -0800 Subject: [PATCH 76/76] Switch back to 'latest' for distribution build version Signed-off-by: Ryan Liang --- .github/actions/download-plugin/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/download-plugin/action.yml b/.github/actions/download-plugin/action.yml index 021df02a5..0b5473a1e 100644 --- a/.github/actions/download-plugin/action.yml +++ b/.github/actions/download-plugin/action.yml @@ -21,13 +21,13 @@ runs: uses: peternied/download-file@v2 if: ${{ runner.os == 'Linux' }} with: - url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/7028/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/linux/x64/tar/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - name: Download OpenSearch for Windows uses: peternied/download-file@v2 if: ${{ runner.os == 'Windows' }} with: - url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/7028/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip + url: https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ inputs.opensearch-version }}/latest/windows/x64/zip/builds/opensearch/plugins/${{ inputs.plugin-name }}-${{ inputs.plugin-version }}.zip - name: Rename the Plugin Files run: mv opensearch-security-${{ inputs.plugin-version }}.zip opensearch-security.zip