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

feat(generate): restructure file generation of conf and spec files #1299

Closed
wants to merge 26 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1d08b35
feat(restructure): add new build method for web, restmap, server conf…
hetangmodi-crest Jul 16, 2024
27cdc43
doc: add auto doc generation method
hetangmodi-crest Jul 16, 2024
7b0c6a1
feat: add new logic for inputs, alert, tags, eventtypes conf file
hetangmodi-crest Jul 18, 2024
57ba4d4
fix: add changes for app.conf file
hetangmodi-crest Jul 18, 2024
0d1c91d
chore: fix lint failures
hetangmodi-crest Jul 18, 2024
b3bff0e
chore: merge branch 'develop' into feat/restructure-file-generation
hetangmodi-crest Jul 18, 2024
675b7fe
feat: add migrated code for account, settings conf and spec file
hetangmodi-crest Jul 23, 2024
f59a028
test(smoke): fix smoke test for globalConfig everything
hetangmodi-crest Jul 23, 2024
f43d8a7
test(smoke): update smoke tests as per new design
hetangmodi-crest Jul 24, 2024
6c2475e
fix(alerts): update logic to avoid creating empty files
hetangmodi-crest Jul 24, 2024
c9a5c8d
chore: fix mypy and flake8 failures
hetangmodi-crest Jul 24, 2024
eabd032
chore: merge branch 'develop' into feat/restructure-file-generation
hetangmodi-crest Jul 24, 2024
66644e0
ci: fix missing license failure
hetangmodi-crest Jul 24, 2024
6fef598
fix: omit file creation if configs do not exist
hetangmodi-crest Jul 26, 2024
fd0e8b1
feat(generate): generation of XML files
hetangmodi-crest Jul 31, 2024
cd48a8c
ci: add auto updates of docs
hetangmodi-crest Jul 31, 2024
2a152a0
ci: update workflow calls
hetangmodi-crest Jul 31, 2024
22ab4b0
ci:auto updates of docs using ucc-gen-docs command
hetangmodi-crest Aug 1, 2024
f0c4044
ci: updated workflow action
hetangmodi-crest Aug 1, 2024
4db6be8
feat(generate):generation of html files for alerts
hetangmodi-crest Aug 2, 2024
5854ae7
ci: added license in html files
hetangmodi-crest Aug 2, 2024
d1d8880
doc: updated docs regarding generated conf, xml and html files
srv-rr-github-token Aug 2, 2024
250b444
deps: update addonfactory-splunk-conf-parser-lib and add lxml
hetangmodi-crest Aug 5, 2024
cfac087
chore: merge branch 'develop' into feat/restructure-file-generation
hetangmodi-crest Aug 5, 2024
3e4c4a3
chore(html): fix minor syntax and optimization
hetangmodi-crest Aug 8, 2024
2915f28
test(unit): add unit test case for html generation
hetangmodi-crest Aug 8, 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
48 changes: 48 additions & 0 deletions .github/workflows/automatic_doc_generation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: "Automatic doc generation"
on:
workflow_call:
inputs:
python-version:
required: true
type: string

jobs:
generate-docs:
runs-on: ubuntu-latest
env:
isPR: ${{ github.event.pull_request.base.ref == 'develop' || github.event.pull_request.base.ref == 'main' }}
steps:
- uses: actions/checkout@v4
with:
lfs: true
ref: ${{ github.event.pull_request.head.ref }}
- uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install poetry
poetry install

- name: Generate docs
run: |
poetry run ucc-gen-docs

- name: Importing GPG key
if: ${{ env.isPR }}
uses: crazy-max/ghaction-import-gpg@v6
with:
git_committer_name: ${{ secrets.SA_GH_USER_NAME }}
git_committer_email: ${{ secrets.SA_GH_USER_EMAIL }}
gpg_private_key: ${{ secrets.SA_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.SA_GPG_PASSPHRASE }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Push updated screenshots
if: ${{ env.isPR }}
run: |
git add \*.md
git diff --staged --exit-code || (git commit -S -m "doc: updated docs regarding generated conf, xml and html files" && git push)

10 changes: 10 additions & 0 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,15 @@ jobs:
with:
node-version: "20"

bot-updates:
name: Generates Documentation
permissions:
contents: write
secrets: inherit
uses: ./.github/workflows/automatic_doc_generation.yml
with:
python-version: "3.7"

build:
needs:
- fossa-scan
Expand Down Expand Up @@ -327,6 +336,7 @@ jobs:
- test-ui
- build-test-addon-openapi-client
- storybook-screenshots
- bot-updates
runs-on: ubuntu-latest
env:
NEEDS: ${{ toJson(needs) }}
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ init_addon_for_ucc_package/
# UI build
# ignore everything except redirect_page.js
splunk_add_on_ucc_framework/package/appserver/static/js/build/
!splunk_add_on_ucc_framework/package/appserver/static/js/build/redirect_page.js
!splunk_add_on_ucc_framework/package/appserver/static/js/build/redirect_page.js
coverage.xml
.coverage
2 changes: 1 addition & 1 deletion .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ header:
- "poetry.lock"
- "ui/yarn.lock"
- "docs/**"
- "splunk_add_on_ucc_framework/templates/*"
- "splunk_add_on_ucc_framework/templates/**"
- "splunk_add_on_ucc_framework/commands/modular_alert_builder/arf_template/**"
- "tests/**"
- "README.md"
Expand Down
27 changes: 27 additions & 0 deletions docs/generated_files.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
hetangmodi-crest marked this conversation as resolved.
Show resolved Hide resolved
title: UCC framework generated files
---

Below table describes the files generated by UCC framework

## File Description

| File Name | File Location | File Description |
| ------------ | ------------ | ----------------- |
| app.conf | output/<YOUR_ADDON_NAME>/default | Generates `app.conf` with the details mentioned in globalConfig[meta] |
| inputs.conf | output/<YOUR_ADDON_NAME>/default | Generates `inputs.conf` and `inputs.conf.spec` file for the services mentioned in globalConfig |
| server.conf | output/<YOUR_ADDON_NAME>/default | Generates `server.conf` for the custom conf files created as per configurations in globalConfig |
| restmap.conf | output/<YOUR_ADDON_NAME>/default | Generates `restmap.conf` for the custom REST handlers that are generated based on configs from globalConfig |
| web.conf | output/<YOUR_ADDON_NAME>/default | Generates `web.conf` to expose the endpoints generated in `restmap.conf` which is generated based on configurations from globalConfig. |
| alert_actions.conf | output/<YOUR_ADDON_NAME>/default | Generates `alert_actions.conf` and `alert_actions.conf.spec` file for the custom alert actions defined in globalConfig |
| eventtypes.conf | output/<YOUR_ADDON_NAME>/default | Generates `eventtypes.conf` file if the sourcetype is mentioned in Adaptive Response of custom alert action in globalConfig |
| tags.conf | output/<YOUR_ADDON_NAME>/default | Generates `tags.conf` file based on the `eventtypes.conf` created for custom alert actions. |
| _account.conf | output/&lt;YOUR_ADDON_NAME&gt;/README | Generates `<YOUR_ADDON_NAME>_account.conf.spec` file for the configuration mentioned in globalConfig |
| _settings.conf | output/&lt;YOUR_ADDON_NAME&gt;/README | Generates `<YOUR_ADDON_NAME>_settings.conf.spec` file for the Proxy, Logging or Custom Tab mentioned in globalConfig |
| configuration.xml | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/views | Generates configuration.xml file in `default/data/ui/views/` folder if globalConfig is present. |
| dashboard.xml | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/views | Generates dashboard.xml file based on dashboard configuration present in globalConfig in `default/data/ui/views` folder. |
| default.xml | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/nav | Generates default.xml file based on configs present in globalConfigin in `default/data/ui/nav` folder. |
| inputs.xml | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/views | Generates inputs.xml based on inputs configuration present in globalConfig, in `default/data/ui/views/inputs.xml` folder |
| _redirect.xml | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/views | Generates ta_name_redirect.xml file, if oauth is mentioned in globalConfig,in `default/data/ui/views/` folder. |
| _.html | output/&lt;YOUR_ADDON_NAME&gt;/default/data/ui/alerts | Generates `alert_name.html` file based on alerts configuration present in globalConfig in `default/data/ui/alerts` folder. |

5 changes: 3 additions & 2 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ nav:
- Home: "index.md"
- Quickstart: "quickstart.md"
- ".conf files": "dot_conf_files.md"
- Generated Files: "generated_files.md"
- Inputs:
- "inputs/index.md"
- Introduction: "inputs/index.md"
Expand Down Expand Up @@ -91,9 +92,9 @@ nav:
- Custom Warning: "advanced/custom_warning.md"
- Troubleshooting: "troubleshooting.md"
- Contributing: "contributing.md"
- Changelog: "CHANGELOG.md"
- Metadata: "metadata.md"
- Storybook: "storybook/index.html"
- Changelog: "CHANGELOG.md"
- UI Tests:
- Configuration Page:
- General: "ui_tests_config_page_general.md"
Expand All @@ -102,4 +103,4 @@ nav:
- Logging: "ui_tests_config_page_logging.md"
- Proxy: "ui_tests_config_page_proxy.md"
- Alert Action Page: "ui_tests_alert_actions_page.md"
- Input Page: "ui_tests_inputs_page.md"
- Input Page: "ui_tests_inputs_page.md"
28 changes: 23 additions & 5 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ classifiers = [
[tool.poetry.dependencies]
python = "^3.7"
jinja2 = ">=2,<4"
addonfactory-splunk-conf-parser-lib = "*"
addonfactory-splunk-conf-parser-lib = "^0.4.1"
dunamai = "^1.9.0"
jsonschema = "^4.4.0"
PyYAML = "^6.0"
defusedxml = "^0.7.1"
lxml = "^4.9.4"
colorama = "^0.4.6"

[tool.poetry.group.dev.dependencies]
Expand All @@ -63,6 +63,7 @@ xmldiff = "^2.6.3"

[tool.poetry.scripts]
ucc-gen="splunk_add_on_ucc_framework.main:main"
ucc-gen-docs="splunk_add_on_ucc_framework.generators.doc_generator:main"

[build-system]
requires = ["poetry>=1.0.2"]
Expand Down
75 changes: 0 additions & 75 deletions splunk_add_on_ucc_framework/app_conf.py

This file was deleted.

Loading
Loading