-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:opensearch-project/alerting into lo…
…caluri-debug
- Loading branch information
Showing
28 changed files
with
1,593 additions
and
244 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,37 @@ | ||
name: BWC Test Workflow | ||
# This workflow is triggered on pull requests and pushes to main or an OpenSearch release branch | ||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [ 14 ] | ||
# Job name | ||
name: Build and test Alerting | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
# This step uses the checkout Github action: https://github.com/actions/checkout | ||
- name: Checkout Branch | ||
uses: actions/checkout@v2 | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK 14 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 14 | ||
- name: Run Alerting Backwards Compatibility Tests | ||
run: | | ||
echo "Running backwards compatibility tests..." | ||
./gradlew bwcTestSuite |
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 |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: Security Test Workflow | ||
# This workflow is triggered on pull requests and pushes to main or an OpenSearch release branch | ||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
push: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
strategy: | ||
matrix: | ||
java: [ 14 ] | ||
# Job name | ||
name: Build and test Alerting | ||
# This job runs on Linux | ||
runs-on: ubuntu-latest | ||
steps: | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK ${{ matrix.java }} | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: ${{ matrix.java }} | ||
# This step uses the checkout Github action: https://github.com/actions/checkout | ||
- name: Checkout Branch | ||
uses: actions/checkout@v2 | ||
# This step uses the setup-java Github action: https://github.com/actions/setup-java | ||
- name: Set Up JDK 14 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 14 | ||
- name: Build Alerting | ||
# Only assembling since the full build is governed by other workflows | ||
run: ./gradlew assemble -Dopensearch.version=1.3.0-SNAPSHOT | ||
- name: Pull and Run Docker | ||
run: | | ||
plugin=`ls alerting/build/distributions/*.zip` | ||
list_of_files=`ls` | ||
list_of_all_files=`ls alerting/build/distributions/` | ||
version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-3` | ||
plugin_version=`echo $plugin|awk -F- '{print $3}'| cut -d. -f 1-4` | ||
candidate_version=`echo $plugin|awk -F- '{print $4}'| cut -d. -f 1-1` | ||
echo $version $plugin_version $candidate_version | ||
echo $ls $list_of_all_files | ||
if docker pull opensearchstaging/opensearch:$version | ||
then | ||
echo "FROM opensearchstaging/opensearch:$version" >> Dockerfile | ||
echo "RUN if [ -d /usr/share/opensearch/plugins/opensearch-alerting ]; then /usr/share/opensearch/bin/opensearch-plugin remove opensearch-alerting; fi" >> Dockerfile | ||
echo "ADD alerting/build/distributions/opensearch-alerting-$plugin_version-$candidate_version.zip /tmp/" >> Dockerfile | ||
echo "RUN /usr/share/opensearch/bin/opensearch-plugin install --batch file:/tmp/opensearch-alerting-$plugin_version-$candidate_version.zip" >> Dockerfile | ||
docker build -t opensearch-alerting:test . | ||
echo "imagePresent=true" >> $GITHUB_ENV | ||
else | ||
echo "imagePresent=false" >> $GITHUB_ENV | ||
fi | ||
- name: Run Docker Image | ||
if: env.imagePresent == 'true' | ||
run: | | ||
cd .. | ||
docker run -p 9200:9200 -d -p 9600:9600 -e "discovery.type=single-node" opensearch-alerting:test | ||
sleep 120 | ||
- name: Run Alerting Test for security enabled test cases | ||
if: env.imagePresent == 'true' | ||
run: | | ||
cluster_running=`curl -XGET https://localhost:9200/_cat/plugins -u admin:admin --insecure` | ||
echo $cluster_running | ||
security=`curl -XGET https://localhost:9200/_cat/plugins -u admin:admin --insecure |grep opensearch-security|wc -l` | ||
echo $security | ||
if [ $security -gt 0 ] | ||
then | ||
echo "Security plugin is available" | ||
./gradlew :alerting:integTest -Dtests.rest.cluster=localhost:9200 -Dtests.cluster=localhost:9200 -Dtests.clustername=docker-cluster -Dsecurity=true -Dhttps=true -Duser=admin -Dpassword=admin | ||
else | ||
echo "Security plugin is NOT available skipping this run as tests without security have already been run" | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"scanSettings": { | ||
"configMode": "AUTO", | ||
"configExternalURL": "", | ||
"projectToken": "", | ||
"baseBranches": [] | ||
}, | ||
"checkRunSettings": { | ||
"vulnerableCheckRunConclusionLevel": "failure", | ||
"displayMode": "diff" | ||
}, | ||
"issueSettings": { | ||
"minSeverityLevel": "LOW" | ||
} | ||
} |
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
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
44 changes: 44 additions & 0 deletions
44
alerting/src/test/kotlin/org/opensearch/alerting/AccessRoles.kt
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,44 @@ | ||
package org.opensearch.alerting | ||
|
||
val ALL_ACCESS_ROLE = "all_access" | ||
val ALERTING_FULL_ACCESS_ROLE = "alerting_full_access" | ||
val ALERTING_READ_ONLY_ACCESS = "alerting_read_access" | ||
val ALERTING_NO_ACCESS_ROLE = "no_access" | ||
val ALERTING_INDEX_EMAIL_ACCOUNT_ACCESS = "alerting_index_email_account_access" | ||
val ALERTING_GET_EMAIL_ACCOUNT_ACCESS = "alerting_get_email_account_access" | ||
val ALERTING_SEARCH_EMAIL_ACCOUNT_ACCESS = "alerting_search_email_account_access" | ||
val ALERTING_DELETE_EMAIL_ACCOUNT_ACCESS = "alerting_delete_email_account_access" | ||
val ALERTING_INDEX_EMAIL_GROUP_ACCESS = "alerting_index_email_group_access" | ||
val ALERTING_GET_EMAIL_GROUP_ACCESS = "alerting_get_email_group_access" | ||
val ALERTING_SEARCH_EMAIL_GROUP_ACCESS = "alerting_search_email_group_access" | ||
val ALERTING_DELETE_EMAIL_GROUP_ACCESS = "alerting_delete_email_group_access" | ||
val ALERTING_INDEX_MONITOR_ACCESS = "alerting_index_monitor_access" | ||
val ALERTING_GET_MONITOR_ACCESS = "alerting_get_monitor_access" | ||
val ALERTING_SEARCH_MONITOR_ONLY_ACCESS = "alerting_search_monitor_access" | ||
val ALERTING_EXECUTE_MONITOR_ACCESS = "alerting_execute_monitor_access" | ||
val ALERTING_DELETE_MONITOR_ACCESS = "alerting_delete_monitor_access" | ||
val ALERTING_INDEX_DESTINATION_ACCESS = "alerting_index_destination_access" | ||
val ALERTING_GET_DESTINATION_ACCESS = "alerting_get_destination_access" | ||
val ALERTING_DELETE_DESTINATION_ACCESS = "alerting_delete_destination_access" | ||
val ALERTING_GET_ALERTS_ACCESS = "alerting_get_alerts_access" | ||
|
||
val ROLE_TO_PERMISSION_MAPPING = mapOf( | ||
ALERTING_NO_ACCESS_ROLE to "", | ||
ALERTING_INDEX_EMAIL_ACCOUNT_ACCESS to "cluster:admin/opendistro/alerting/destination/email_account/write", | ||
ALERTING_GET_EMAIL_ACCOUNT_ACCESS to "cluster:admin/opendistro/alerting/destination/email_account/get", | ||
ALERTING_SEARCH_EMAIL_ACCOUNT_ACCESS to "cluster:admin/opendistro/alerting/destination/email_account/search", | ||
ALERTING_DELETE_EMAIL_ACCOUNT_ACCESS to "cluster:admin/opendistro/alerting/destination/email_account/delete", | ||
ALERTING_INDEX_EMAIL_GROUP_ACCESS to "cluster:admin/opendistro/alerting/destination/email_group/write", | ||
ALERTING_GET_EMAIL_GROUP_ACCESS to "cluster:admin/opendistro/alerting/destination/email_group/get", | ||
ALERTING_SEARCH_EMAIL_GROUP_ACCESS to "cluster:admin/opendistro/alerting/destination/email_group/search", | ||
ALERTING_DELETE_EMAIL_GROUP_ACCESS to "cluster:admin/opendistro/alerting/destination/email_group/delete", | ||
ALERTING_INDEX_MONITOR_ACCESS to "cluster:admin/opendistro/alerting/monitor/write", | ||
ALERTING_GET_MONITOR_ACCESS to "cluster:admin/opendistro/alerting/monitor/get", | ||
ALERTING_SEARCH_MONITOR_ONLY_ACCESS to "cluster:admin/opendistro/alerting/monitor/search", | ||
ALERTING_EXECUTE_MONITOR_ACCESS to "cluster:admin/opendistro/alerting/monitor/execute", | ||
ALERTING_DELETE_MONITOR_ACCESS to "cluster:admin/opendistro/alerting/monitor/delete", | ||
ALERTING_INDEX_DESTINATION_ACCESS to "cluster:admin/opendistro/alerting/destination/write", | ||
ALERTING_GET_DESTINATION_ACCESS to "cluster:admin/opendistro/alerting/destination/get", | ||
ALERTING_DELETE_DESTINATION_ACCESS to "cluster:admin/opendistro/alerting/destination/delete", | ||
ALERTING_GET_ALERTS_ACCESS to "cluster:admin/opendistro/alerting/alerts/get" | ||
) |
Oops, something went wrong.