From ca459441a3eaa4e4ac6ac6a57d81ab923876a382 Mon Sep 17 00:00:00 2001 From: Derek Ho Date: Tue, 20 Feb 2024 12:15:38 -0500 Subject: [PATCH] Try to use outside workflow based on sha Signed-off-by: Derek Ho --- .github/actions/create-bwc-build/action.yaml | 51 ------- .github/actions/run-bwc-suite/action.yaml | 58 -------- .../action.yml | 127 ------------------ .github/workflows/plugin_install.yml | 6 +- 4 files changed, 3 insertions(+), 239 deletions(-) delete mode 100644 .github/actions/create-bwc-build/action.yaml delete mode 100644 .github/actions/run-bwc-suite/action.yaml delete mode 100644 .github/actions/start-opensearch-with-one-plugin/action.yml diff --git a/.github/actions/create-bwc-build/action.yaml b/.github/actions/create-bwc-build/action.yaml deleted file mode 100644 index 25a348bcc0..0000000000 --- a/.github/actions/create-bwc-build/action.yaml +++ /dev/null @@ -1,51 +0,0 @@ -name: 'Create a backwards compatible ready build' -description: 'Checkouts the official version of a the Security plugin and builds it so it can be used for BWC tests' - -inputs: - plugin-branch: - description: 'The branch of the plugin that should be built, e.g "2.2", "1.x"' - required: true - -outputs: - built-version: - description: 'The version of OpenSearch that was associated with this branch' - value: ${{ steps.get-opensearch-version.outputs.version }} - -runs: - using: "composite" - steps: - - name: Enable Longpaths if on Windows - if: ${{ runner.os == 'Windows' }} - run: git config --system core.longpaths true - shell: pwsh - - - name: Checkout Branch from Fork - if: ${{ inputs.plugin-branch == 'current_branch' }} - uses: actions/checkout@v2 - with: - path: ${{ inputs.plugin-branch }} - - - uses: actions/checkout@v3 - if: ${{ inputs.plugin-branch != 'current_branch' }} - with: - repository: opensearch-project/security - ref: ${{ inputs.plugin-branch }} - path: ${{ inputs.plugin-branch }} - - - name: Build - uses: gradle/gradle-build-action@v2 - with: - cache-disabled: true - arguments: assemble - build-root-directory: ${{ inputs.plugin-branch }} - - - id: get-opensearch-version - uses: peternied/get-opensearch-version@v1 - with: - working-directory: ${{ inputs.plugin-branch }} - - - name: Copy current distro into the expected folder - run: | - mkdir -p ./bwc-test/src/test/resources/${{ steps.get-opensearch-version.outputs.version }} - cp ${{ inputs.plugin-branch }}/build/distributions/opensearch-security-${{ steps.get-opensearch-version.outputs.version }}-SNAPSHOT.zip ./bwc-test/src/test/resources/${{ steps.get-opensearch-version.outputs.version }} - shell: bash diff --git a/.github/actions/run-bwc-suite/action.yaml b/.github/actions/run-bwc-suite/action.yaml deleted file mode 100644 index f05696699c..0000000000 --- a/.github/actions/run-bwc-suite/action.yaml +++ /dev/null @@ -1,58 +0,0 @@ -name: 'Runs the backward bompatiblity test suite' -description: 'Tests backwards compability between a previous and next version of this plugin' - -inputs: - plugin-previous-branch: - description: 'The branch of the plugin that should be built for the previous version, e.g "2.2", "1.x"' - required: true - - plugin-next-branch: - description: 'The branch of the plugin that should be built for the next version, e.g "2.3", "main"' - required: true - - report-artifact-name: - description: 'The name of the artifacts for this run, e.g. "BWC-2.1-to-2.4-results"' - required: true - - username: - description: 'Username to use for cluster health check in testClusters' - required: true - - password: - description: 'Password to use for cluster health check in testClusters' - required: true - -runs: - using: "composite" - steps: - - - id: build-previous - uses: ./.github/actions/create-bwc-build - with: - plugin-branch: ${{ inputs.plugin-previous-branch }} - - - id: build-next - uses: ./.github/actions/create-bwc-build - with: - plugin-branch: ${{ inputs.plugin-next-branch }} - - - name: Run BWC tests - uses: gradle/gradle-build-action@v2 - with: - cache-disabled: true - arguments: | - -p bwc-test - bwcTestSuite - -Dtests.security.manager=false - -Dtests.opensearch.secure=true - -Dtests.opensearch.username=${{ inputs.username }} - -Dtests.opensearch.password=${{ inputs.password }} - -Dbwc.version.previous=${{ steps.build-previous.outputs.built-version }} - -Dbwc.version.next=${{ steps.build-next.outputs.built-version }} -i - - - uses: alehechka/upload-tartifact@v2 - if: always() - with: - name: ${{ inputs.report-artifact-name }} - path: | - ./bwc-test/build/reports/ diff --git a/.github/actions/start-opensearch-with-one-plugin/action.yml b/.github/actions/start-opensearch-with-one-plugin/action.yml deleted file mode 100644 index e8e0f4eb77..0000000000 --- a/.github/actions/start-opensearch-with-one-plugin/action.yml +++ /dev/null @@ -1,127 +0,0 @@ -name: 'Launch OpenSearch with a single plugin installed' -description: 'Downloads latest build of OpenSearch, installs a plugin, executes a script and then starts OpenSearch on localhost:9200' - -inputs: - opensearch-version: - description: 'The version of OpenSearch that should be used, e.g "3.0.0"' - required: true - - plugin-name: - description: 'The name of the plugin to use, such as opensearch-security' - required: true - - setup-script-name: - description: 'The name of the setup script you want to run i.e. "setup" (do not include file extension). Leave empty to indicate one should not be run.' - required: false - - admin-password: - description: 'The admin password uses for the cluster' - required: true - -runs: - using: "composite" - steps: - - # Configure longpath names if on Windows - - name: Enable Longpaths if on Windows - if: ${{ runner.os == 'Windows' }} - run: git config --system core.longpaths true - shell: pwsh - - # Download OpenSearch - - name: Download OpenSearch for Windows - uses: peternied/download-file@v2 - if: ${{ runner.os == 'Windows' }} - with: - url: https://artifacts.opensearch.org/snapshots/core/opensearch/${{ inputs.opensearch-version }}-SNAPSHOT/opensearch-min-${{ inputs.opensearch-version }}-SNAPSHOT-windows-x64-latest.zip - - - - name: Download OpenSearch for Linux - uses: peternied/download-file@v2 - if: ${{ runner.os == 'Linux' }} - with: - url: https://artifacts.opensearch.org/snapshots/core/opensearch/${{ inputs.opensearch-version }}-SNAPSHOT/opensearch-min-${{ inputs.opensearch-version }}-SNAPSHOT-linux-x64-latest.tar.gz - - # Extract downloaded zip - - name: Extract downloaded tar - if: ${{ runner.os == 'Linux' }} - run: | - tar -xzf opensearch-*.tar.gz - rm -f opensearch-*.tar.gz - shell: bash - - - name: Extract downloaded zip - if: ${{ runner.os == 'Windows' }} - run: | - tar -xzf opensearch-min-${{ inputs.opensearch-version }}-SNAPSHOT-windows-x64-latest.zip - del opensearch-min-${{ inputs.opensearch-version }}-SNAPSHOT-windows-x64-latest.zip - shell: pwsh - - # Install the plugin - - name: Install Plugin into OpenSearch for Linux - if: ${{ runner.os == 'Linux'}} - run: | - chmod +x ./opensearch-${{ inputs.opensearch-version }}-SNAPSHOT/bin/opensearch-plugin - /bin/bash -c "yes | ./opensearch-${{ inputs.opensearch-version }}-SNAPSHOT/bin/opensearch-plugin install file:$(pwd)/opensearch-security.zip" - shell: bash - - - name: Install Plugin into OpenSearch for Windows - if: ${{ runner.os == 'Windows'}} - run: | - 'y' | .\opensearch-${{ inputs.opensearch-version }}-SNAPSHOT\bin\opensearch-plugin.bat install file:$(pwd)\${{ inputs.plugin-name }}.zip - shell: pwsh - - # Run any configuration scripts - - name: Run Setup Script for Linux - if: ${{ runner.os == 'Linux' && inputs.setup-script-name != '' }} - run: | - echo "running linux setup" - export OPENSEARCH_INITIAL_ADMIN_PASSWORD=${{ inputs.admin-password }} - chmod +x ./${{ inputs.setup-script-name }}.sh - ./${{ inputs.setup-script-name }}.sh - shell: bash - - - name: Run Setup Script for Windows - if: ${{ runner.os == 'Windows' && inputs.setup-script-name != '' }} - run: | - echo "running windows setup" - $env:OPENSEARCH_INITIAL_ADMIN_PASSWORD="${{ inputs.admin-password }}" - .\${{ inputs.setup-script-name }}.bat - shell: pwsh - - # Run OpenSearch - - name: Run OpenSearch with plugin on Linux - if: ${{ runner.os == 'Linux'}} - run: /bin/bash -c "./opensearch-${{ inputs.opensearch-version }}-SNAPSHOT/bin/opensearch &" - shell: bash - - - name: Run OpenSearch with plugin on Windows - if: ${{ runner.os == 'Windows'}} - run: start .\opensearch-${{ inputs.opensearch-version }}-SNAPSHOT\bin\opensearch.bat - shell: pwsh - - # Give the OpenSearch process some time to boot up before sending any requires, might need to increase the default time! - - name: Sleep while OpenSearch starts - uses: peternied/action-sleep@v1 - with: - seconds: 30 - - # Verify that the server is operational - - name: Check OpenSearch Running on Linux - if: ${{ runner.os != 'Windows'}} - run: curl https://localhost:9200/_cat/plugins -u 'admin:${{ inputs.admin-password }}' -k -v --fail-with-body - shell: bash - - - name: Check OpenSearch Running on Windows - if: ${{ runner.os == 'Windows'}} - run: | - $credentialBytes = [Text.Encoding]::ASCII.GetBytes("admin:${{ inputs.admin-password }}") - $encodedCredentials = [Convert]::ToBase64String($credentialBytes) - $baseCredentials = "Basic $encodedCredentials" - $Headers = @{ Authorization = $baseCredentials } - Invoke-WebRequest -SkipCertificateCheck -Uri 'https://localhost:9200/_cat/plugins' -Headers $Headers; - shell: pwsh - - - if: always() - run: cat ./opensearch-${{ inputs.opensearch-version }}-SNAPSHOT/logs/opensearch.log - shell: bash diff --git a/.github/workflows/plugin_install.yml b/.github/workflows/plugin_install.yml index b88cfb166f..ead3b2ba05 100644 --- a/.github/workflows/plugin_install.yml +++ b/.github/workflows/plugin_install.yml @@ -55,11 +55,11 @@ jobs: Get-Content .\setup.bat - name: Run Opensearch with A Single Plugin - uses: ./.github/actions/start-opensearch-with-one-plugin + uses: derek-ho/start-opensearch@cc6257459892289e494c08fd45eb1988db18c737 with: opensearch-version: ${{ env.OPENSEARCH_VERSION }} - plugin-name: ${{ env.PLUGIN_NAME }} - setup-script-name: setup + plugins: 'file: $(pwd)/${{ env.PLUGIN_NAME }}' + security-enabled: true admin-password: ${{ steps.random-password.outputs.generated_name }} - name: Run sanity tests