Skip to content

Commit

Permalink
Reuse of Security repo action
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Dec 1, 2022
1 parent e1ae6b8 commit 2b88141
Showing 1 changed file with 59 additions and 42 deletions.
101 changes: 59 additions & 42 deletions .github/workflows/integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,64 +5,81 @@ on: [push, pull_request]
env:
TEST_BROWSER_HEADLESS: 1
CI: 1
OPENSEARCH_VERSION: 3.0.0
PLUGIN_NAME: opensearch-security

jobs:
tests:
name: Run integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout Branch
uses: actions/checkout@v2

- uses: browser-actions/setup-geckodriver@latest
- run: geckodriver --version

- uses: browser-actions/setup-firefox@latest
- run: firefox --version

- name: Checkout Branch
uses: actions/checkout@v2

- name: Download OpenSearch Core
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/latest/linux/x64/tar/builds/opensearch/dist/opensearch-min-3.0.0-linux-x64.tar.gz
tar -xzf opensearch-*.tar.gz
rm -f opensearch-*.tar.gz
#- name: Download OpenSearch Core
# run: |
# wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/latest/linux/x64/tar/builds/opensearch/dist/opensearch-min-3.0.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/3.0.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-security-3.0.0.0.zip

- name: Run OpenSearch with plugin
run: wget --progress=bar:force:noscroll -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/3.0.0/latest/linux/x64/tar/builds/opensearch/plugins/opensearch-security-3.0.0.0.zip

#
#- 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: Create Setup Script
if: ${{ runner.os == 'Linux' }}
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
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
docker run -d --network=host -i opensearch-test:latest
# - name: Checkout Branch
# uses: actions/checkout@v2
#
# - name: Run OpenSearch with Security Plugin
# uses: ./.github/actions/install-opensearch
# with:
# opensearch_version: 3.0.0
# security_plugin_version: 3.0.0.0
# plugin-name: opensearch-security
# plugin-start-script: install_demo_configuration
# plugin-zip: security-plugin.zip
- 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@security-reusable-action
with:
opensearch-version: ${{ env.OPENSEARCH_VERSION }}
plugin-name: ${{ env.PLUGIN_NAME }}
setup-script-name: setup

#- name: Run OpenSearch with Security Plugin
# uses: opensearch-project/security/.github/actions/install-opensearch
# with:
# opensearch_version: 3.0.0
# security_plugin_version: 3.0.0.0
# plugin-name: opensearch-security
# plugin-start-script: install_demo_configuration
# plugin-zip: security-plugin.zip

- id: install-dashboards
uses: ./.github/actions/install-dashboards
Expand Down

0 comments on commit 2b88141

Please sign in to comment.