Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Security dashboards plugin from binary #1726

Merged
merged 36 commits into from
Jan 16, 2024
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
ba3fb93
Try building OSD core
derek-ho Jan 4, 2024
0d54567
Fix path
derek-ho Jan 4, 2024
d27c98b
Try changing pwd
derek-ho Jan 4, 2024
e3f4b31
try
derek-ho Jan 4, 2024
7992e96
Build both
derek-ho Jan 4, 2024
545eb2d
Fix syntax
derek-ho Jan 4, 2024
71584b4
provide shell
derek-ho Jan 4, 2024
8d14f97
successfully install
derek-ho Jan 4, 2024
d2f02af
successfully install
derek-ho Jan 4, 2024
e15d301
Merge branch 'main' of https://github.com/opensearch-project/security…
derek-ho Jan 12, 2024
fdb0dbf
try to get it working for linux
derek-ho Jan 12, 2024
84abba5
Fix path to linux build
derek-ho Jan 12, 2024
2f965c5
Fix capital
derek-ho Jan 12, 2024
44f5563
double check env variable
derek-ho Jan 12, 2024
3636e2b
Fix name
derek-ho Jan 12, 2024
d6e7999
try different syntax
derek-ho Jan 12, 2024
c212378
change to same command for both platform
derek-ho Jan 12, 2024
00da94a
Get actual name
derek-ho Jan 12, 2024
28e08fc
fix unit test workflow for windows
derek-ho Jan 12, 2024
6cdb7d0
Move to new workflow
derek-ho Jan 12, 2024
c3e6ead
fix
derek-ho Jan 12, 2024
7936e49
indentation
derek-ho Jan 14, 2024
9949f5b
Add env
derek-ho Jan 14, 2024
6e1082f
remove dupe
derek-ho Jan 14, 2024
22ee8a8
fix path
derek-ho Jan 15, 2024
7f4b512
fix path
derek-ho Jan 15, 2024
bee18f9
Finalize workflow
derek-ho Jan 16, 2024
2f16e4e
add admin creds
derek-ho Jan 16, 2024
2de58e3
Revert "fix Cannot find module when import ResourceType in server fro…
derek-ho Jan 16, 2024
be162f8
Revert "Revert "fix Cannot find module when import ResourceType in se…
derek-ho Jan 16, 2024
ed9c66d
fix indentation
derek-ho Jan 16, 2024
6db26c9
Remove bash
derek-ho Jan 16, 2024
320cd65
try removing line
derek-ho Jan 16, 2024
54ca1f9
Add security settings into OSD
derek-ho Jan 16, 2024
623dcb3
Apply PR feedback
derek-ho Jan 16, 2024
7932eb6
add a TODO
derek-ho Jan 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions .github/workflows/verify-binary-installation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
name: 'Install Dashboards with Plugin via Binary'

on: [push, pull_request]
env:
OPENSEARCH_VERSION: '3.0.0'
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
PLUGIN_NAME: opensearch-security
OPENSEARCH_INITIAL_ADMIN_PASSWORD: myStrongPassword123!

jobs:
verify-binary-installation:
name: Run binary installation
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
# TODO: add windows support when OSD core is stable on windows
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Branch
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 11

- name: Set env
run: |
opensearch_version=$(node -p "require('./package.json').opensearchDashboards.version")
plugin_version=$(node -p "require('./package.json').version")
echo "OPENSEARCH_VERSION=$opensearch_version" >> $GITHUB_ENV
echo "PLUGIN_VERSION=$plugin_version" >> $GITHUB_ENV
shell: bash

- 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 }}

- 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
admin-password: ${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }}

- uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards
repository: opensearch-project/OpenSearch-Dashboards
ref: 'main'
fetch-depth: 0
filter: |
cypress
test

- id: branch-switch-if-possible
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 }}
working-directory: ./OpenSearch-Dashboards
shell: bash

- id: tool-versions
run: |
echo "node_version=$(cat .node-version)" >> $GITHUB_OUTPUT
echo "yarn_version=$(jq -r '.engines.yarn' package.json)" >> $GITHUB_OUTPUT
working-directory: OpenSearch-Dashboards
shell: bash

- uses: actions/setup-node@v1
with:
node-version: ${{ steps.tool-versions.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'

- name: Setup Opensearch Dashboards
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
DarshitChanpura marked this conversation as resolved.
Show resolved Hide resolved
yarn osd bootstrap
scripts/use_node scripts/build
working-directory: OpenSearch-Dashboards
shell: bash

- uses: actions/checkout@v2
with:
path: OpenSearch-Dashboards/plugins/security-dashboards-plugin

- name: Build Plugin Zip
run: |
yarn build
working-directory: OpenSearch-Dashboards/plugins/security-dashboards-plugin
shell: bash

- name: Install plugin to OSD Linux
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
run: |
build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64/bin/opensearch-dashboards-plugin install file:$(pwd)/plugins/security-dashboards-plugin/build/security-dashboards-${{env.PLUGIN_VERSION}}.zip
working-directory: OpenSearch-Dashboards
shell: bash

- name: Write security settings into OSD yml file
run: |
rm -rf ./config/opensearch_dashboards.yml
cat << 'EOT' > ./config/opensearch_dashboards.yml
server.host: "0.0.0.0"
opensearch.hosts: ["https://localhost:9200"]
opensearch.ssl.verificationMode: none
opensearch.username: "kibanaserver"
opensearch.password: "kibanaserver"
opensearch.requestHeadersWhitelist: [ authorization,securitytenant ]
opensearch_security.multitenancy.enabled: true
opensearch_security.multitenancy.tenants.preferred: ["Private", "Global"]
opensearch_security.readonly_mode.roles: ["kibana_read_only"]

# Use this setting if you are running opensearch-dashboards without https
opensearch_security.cookie.secure: false
working-directory: OpenSearch-Dashboards/build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64


- name: Start the binary
run: |
nohup ./bin/opensearch-dashboards &
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
working-directory: OpenSearch-Dashboards/build/opensearch-dashboards-${{ env.OPENSEARCH_VERSION }}-SNAPSHOT-linux-x64
shell: bash

- name: Health check
run: |
timeout 300 bash -c 'while [[ "$(curl -u admin:${{ env.OPENSEARCH_INITIAL_ADMIN_PASSWORD }} -k http://localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
shell: bash

Loading