-
Notifications
You must be signed in to change notification settings - Fork 164
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit of windows ci support for 2.x branch (#1320)
Signed-off-by: Ryan Liang <[email protected]>
- Loading branch information
Showing
6 changed files
with
159 additions
and
152 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 "2.6.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 "2.6.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 | ||
|
||
- 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' }} | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,65 +5,81 @@ on: [push, pull_request] | |
env: | ||
TEST_BROWSER_HEADLESS: 1 | ||
CI: 1 | ||
OPENSEARCH_VERSION: 2.6.0 | ||
PLUGIN_NAME: opensearch-security | ||
PLUGIN_VERSION: 2.6.0.0 | ||
|
||
jobs: | ||
tests: | ||
name: Run integration tests | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest , windows-latest ] | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: browser-actions/setup-geckodriver@latest | ||
- name: Checkout Branch | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
|
||
- uses: browser-actions/[email protected] | ||
- run: geckodriver --version | ||
|
||
- uses: browser-actions/setup-firefox@latest | ||
- name: Set up Firefox browser | ||
if: ${{ runner.os == 'Linux' }} | ||
uses: browser-actions/setup-firefox@v1 | ||
|
||
- run: firefox --version | ||
if: ${{ runner.os == 'Linux' }} | ||
|
||
- name: Download OpenSearch Core | ||
run: | | ||
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.6.0/latest/linux/x64/tar/builds/opensearch/dist/opensearch-min-2.6.0-linux-x64.tar.gz | ||
tar -xzf opensearch-*.tar.gz | ||
rm -f opensearch-*.tar.gz | ||
- name: Download OpenSearch Security Plugin | ||
run: wget -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.6.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-security-2.6.0.0.zip | ||
|
||
# Browser-action version does not work on Windows | ||
- name: Set up Firefox browser for Windows | ||
if: ${{ runner.os == 'Windows' }} | ||
uses: RyanL1997/setup-browser@main | ||
with: | ||
browser: firefox | ||
version: latest | ||
|
||
- name: Run OpenSearch with plugin | ||
run: | | ||
cat > os-ep.sh <<EOF | ||
yes | opensearch-plugin install file:///docker-host/security-plugin.zip | ||
chmod +x plugins/opensearch-security/tools/install_demo_configuration.sh | ||
yes | plugins/opensearch-security/tools/install_demo_configuration.sh | ||
echo "plugins.security.unsupported.restapi.allow_securityconfig_modification: true" >> /opensearch/config/opensearch.yml | ||
chown 1001:1001 -R /opensearch | ||
su -c "/opensearch/bin/opensearch" -s /bin/bash opensearch | ||
EOF | ||
docker build -t opensearch-test:latest -f- . <<EOF | ||
FROM ubuntu:latest | ||
COPY --chown=1001:1001 os-ep.sh /docker-host/ | ||
COPY --chown=1001:1001 opensearch-security.zip /docker-host/security-plugin.zip | ||
COPY --chown=1001:1001 opensearch* /opensearch/ | ||
RUN chmod +x /docker-host/os-ep.sh | ||
RUN useradd -u 1001 -s /sbin/nologin opensearch | ||
ENV PATH="/opensearch/bin:${PATH}" | ||
WORKDIR /opensearch/ | ||
ENTRYPOINT /docker-host/os-ep.sh | ||
EOF | ||
docker run -d --network=host -i opensearch-test:latest | ||
- name: Download security plugin and create setup scripts | ||
uses: ./.github/actions/download-plugin | ||
with: | ||
opensearch-version: ${{ env.OPENSEARCH_VERSION }} | ||
plugin-name: ${{ env.PLUGIN_NAME }} | ||
plugin-version: ${{ env.PLUGIN_VERSION }} | ||
|
||
- uses: actions/checkout@v2 | ||
- 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: | ||
plugin_name: security-dashboards-plugin | ||
plugin_name: security-dashboards-plugin | ||
|
||
- name: Start Dashboards in background | ||
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 | ||
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 }} |
Oops, something went wrong.