forked from opensearch-project/dashboards-reporting
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable notifications plugins in reporting (#2)
* Add docker * Enable notifications plugins * Add notifications settings create report * Add edit notifications settings * Add details notifications settings * Add information in the table * Fix notebooks selector * Update actions/upload-artifact version * Fix tests * Fix lint * Remove build windows and macos * Bump OPENSEARCH_PLUGIN_VERSION on action * Updates actions * Add workflow_dispatch, workflow_call on action * Add wazuh version and revision package.json * Change action build * Add manual-build action * Remove console.log * Fix edit notification --------- Co-authored-by: Federico Rodriguez <[email protected]>
- Loading branch information
1 parent
41815cb
commit d5b6ad0
Showing
56 changed files
with
4,902 additions
and
488 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
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,96 @@ | ||
# This workflow downloads the source code at the given git reference | ||
# (branch, tag or commit), an sets up an environment (Kibana or OpenSearch) | ||
# to run this code and a command (build, test, ...). | ||
# | ||
# This workflow is used as a base for other workflows. | ||
|
||
name: Base workflow - Environment | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
reference: | ||
required: true | ||
type: string | ||
default: master | ||
description: Source code reference (branch, tag or commit SHA). | ||
command: | ||
required: true | ||
type: string | ||
default: 'yarn build' | ||
description: Command to run in the environment | ||
docker_run_extra_args: | ||
type: string | ||
default: '' | ||
description: Additional paramaters for the docker run command. | ||
required: false | ||
artifact_name: | ||
type: string | ||
default: '' | ||
description: Artifact name (will be automatically suffixed with .zip) | ||
required: false | ||
artifact_path: | ||
type: string | ||
default: '' | ||
description: Folder to include in the archive. | ||
required: false | ||
notify_jest_coverage_summary: | ||
type: boolean | ||
default: false | ||
required: false | ||
|
||
jobs: | ||
# Deploy the plugin in a development environment and run a command | ||
# using a pre-built Docker image, hosted in Quay.io. | ||
deploy_and_run_command: | ||
name: Deploy and run command | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Step 01 - Download the plugin's source code | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: yenienserrano/wazuh-dashboards-reporting | ||
ref: ${{ inputs.reference }} | ||
path: wazuh-dashboards-reporting | ||
|
||
# Fix source code ownership so the internal user of the Docker | ||
# container is also owner. | ||
- name: Step 02 - Change code ownership | ||
run: sudo chown 1000:1000 -R wazuh-dashboards-reporting; | ||
|
||
- name: Step 03 - Set up the environment and run the command | ||
run: | | ||
# Read the platform version from the package.json file | ||
echo "Reading the platform version from the package.json..."; | ||
platform_version=$(jq -r '.opensearchDashboards.version | select(. != null)' wazuh-dashboards-reporting/package.json); | ||
echo "Plugin platform version: $platform_version"; | ||
# Up the environment and run the command | ||
docker run -t --rm \ | ||
-e OPENSEARCH_DASHBOARDS_VERSION=${platform_version} \ | ||
-v `pwd`/wazuh-dashboards-reporting:/home/node/kbn/plugins/wazuh-dashboards-reporting \ | ||
${{ inputs.docker_run_extra_args }} \ | ||
quay.io/wazuh/osd-dev:${platform_version} \ | ||
bash -c ' | ||
yarn config set registry https://registry.yarnpkg.com; | ||
cd /home/node/kbn/plugins/wazuh-dashboards-reporting && yarn && ${{ inputs.command }}; | ||
' | ||
- name: Get the plugin version | ||
run: | | ||
echo "version=$(jq -r '.wazuh.version' $(pwd)/wazuh-dashboards-reporting/package.json)" >> $GITHUB_ENV | ||
echo "revision=$(jq -r '.wazuh.revision' $(pwd)/wazuh-dashboards-reporting/package.json)" >> $GITHUB_ENV | ||
- name: Step 04 - Upload artifact to GitHub | ||
if: ${{ inputs.artifact_name && inputs.artifact_path }} | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ inputs.artifact_name }}_${{ env.version }}-${{ env.revision }}_${{ inputs.reference }}.zip | ||
path: ${{ inputs.artifact_path }} | ||
|
||
- name: Step 05 - Upload coverage results to GitHub | ||
if: ${{ inputs.notify_jest_coverage_summary && github.event_name == 'pull_request' }} | ||
uses: AthleticNet/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
path: ./wazuh-dashboards-reporting/target/test-coverage/coverage-summary.json | ||
title: "Code coverage (Jest)" |
Oops, something went wrong.