Skip to content

Commit

Permalink
chore: merge develop into main (#1490)
Browse files Browse the repository at this point in the history
  • Loading branch information
soleksy-splunk authored Nov 27, 2024
2 parents 577bc9d + e8d03bb commit 4f336c0
Show file tree
Hide file tree
Showing 82 changed files with 1,937 additions and 216 deletions.
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ omit =
splunk_add_on_ucc_framework/templates/input.module-template

[report]
fail_under = 81
fail_under = 81.5
3 changes: 1 addition & 2 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -325,8 +325,7 @@ jobs:
needs: build-test-addon
if: |
!cancelled() &&
needs.build-test-addon.result == 'success' &&
( github.base_ref == 'main' || github.ref_name == 'main' )
needs.build-test-addon.result == 'success'
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ site/
assets/
Splunk_TA_Dynatrace/*
Splunk_TA_Dynatrace_ucc/*
demo_addon_for_splunk/
demo_addon_for_splunk_already_exists/
demo_addon_for_splunk_license/
addon_name
init_addon_for_ucc_package/

# UI build
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# splunk-add-on-ucc-framework
# UCC

![PyPI](https://img.shields.io/pypi/v/splunk-add-on-ucc-framework)
![Python](https://img.shields.io/pypi/pyversions/splunk-add-on-ucc-framework.svg)
![PyPI monthly downloads](https://img.shields.io/pypi/dm/splunk-add-on-ucc-framework)

## What is UCC?

Expand Down
4 changes: 2 additions & 2 deletions docs/additional_packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

To extend the build process, you can create a `additional_packaging.py` file in the same file level where you have your globalConfig file.

This file should at least have:
This file should have either of the below two functions:

- the `cleanup_output_files` function, which accepts `output_path` (str), `add-on name` (str) as its arguments.
- the `additional_packaging` function, which accepts `add-on name` (str) as its only argument.
Expand All @@ -19,5 +19,5 @@ See the following example for proper usage:
Below is an example of additional_packaging.py containing both the implementations of functions.

```python
--8<-- "tests/testdata/test_addons/package_global_config_everything_uccignore/additional_packaging.py"
--8<-- "tests/testdata/test_addons/package_global_config_everything/additional_packaging.py"
```
7 changes: 5 additions & 2 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,11 @@ It takes the following parameters:
* `--addon-display-name` - [required] add-on "official" name.
* `--addon-input-name` - [required] name of the generated input.
* `--addon-version` - [optional] version of the generated add-on, with `0.0.1` by default.
* `--overwrite` - [optional] overwrites the already existing folder.
By default, you can't generate a new add-on to an already existing folder.
* `--overwrite` - [optional] overwrites the already existing folder. By default, you can't generate a new add-on to an already existing folder.
* `--add-license` - [optional] Adds license agreement such as [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.txt), [MIT License](https://mit-license.org/), or
[SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT](https://www.splunk.com/en_us/legal/splunk-pre-release-software-license-agreement.html) in your `package/LICENSES` directory. If not mentioned an empty License.txt will be generated.

> **Note:** The add-on will not build if the input for `--add-license` is not one of the following: `Apache License 2.0`, `MIT License`, or `SPLUNK PRE-RELEASE SOFTWARE LICENSE AGREEMENT`. If you want to keep another license in your add-on, place it in `package/LICENSES` directory and it will be shipped
## `ucc-gen import-from-aob`

Expand Down
Binary file modified docs/images/inputs/Tabs_Output.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ Universal Configuration Console (UCC) is a framework that simplifies the process

The UCC framework helps you to maintain consistency and a uniform look and feel across different add-ons. You can easily update and modify your add-ons.

The UCC framework is available as a GitHub action. See <https://github.com/splunk/addonfactory-ucc-generator-action>.

To work with UCC framework, you can also use Splunk Extension. It helps you to create, test, and debug the add-ons in a simple way. For more information, see [Visual Studio Code Extension for Splunk](https://marketplace.visualstudio.com/items?itemName=Splunk.splunk).

To see how UCC can be used in an add-on, see [Example TA](https://github.com/splunk/splunk-example-ta).

## Libraries

UCC-based add-ons are powered by the following Splunk libraries:
Expand Down
23 changes: 12 additions & 11 deletions docs/inputs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ provided, a dropdown field will appear on the Inputs page. In contrast, a button

### Properties

| Property | Type | Description |
| ------------------------------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| title<span class="required-asterisk">\*</span> | string | - |
| description | string | It provides a brief summary of an inputs page. |
| [subDescription](../advanced/sub_description.md) | object | It provides broader description of an inputs page. |
| menu | object | This property allows you to enable the [custom menu](../custom_ui_extensions/custom_menu.md) feature. |
| [table](../table.md) | object | It displays input stanzas in a tabular format. |
| groupsMenu | array | This property allows you to enable the [multi-level menu](./multilevel_menu.md) feature. |
| [services](#services-properties)<span class="required-asterisk">\*</span> | array | It specifies a list of modular inputs. |
| readonlyFieldId | string | A field of the boolean entity that UCC checks for each input. If the field's value is [truthful](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ListOfDataTypes), the corresponding input cannot be edited from the UI. There is no way to change this from the UI; it is supposed to be changed via REST. |
| hideFieldId | string | A field of the boolean entity that UCC checks for each input. If the field's value is [truthful](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ListOfDataTypes), the corresponding input is hidden from the UI. There is no way to change this from the UI; it is supposed to be changed via REST. Check out an example below. |
| Property | Type | Description |
| ------------------------------------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| title<span class="required-asterisk">\*</span> | string | - |
| description | string | It provides a brief summary of an inputs page. |
| [subDescription](../advanced/sub_description.md) | object | It provides broader description of an inputs page. |
| menu | object | This property allows you to enable the [custom menu](../custom_ui_extensions/custom_menu.md) feature. |
| [table](../table.md) | object | It displays input stanzas in a tabular format. |
| groupsMenu | array | This property allows you to enable the [multi-level menu](./multilevel_menu.md) feature. |
| [services](#services-properties)<span class="required-asterisk">\*</span> | array | It specifies a list of modular inputs. |
| readonlyFieldId | string | A field of the boolean entity that UCC checks for each input. If the field's value is [truthful](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ListOfDataTypes), the corresponding input cannot be edited from the UI. There is no way to change this from the UI; it is supposed to be changed via REST. |
| hideFieldId | string | A field of the boolean entity that UCC checks for each input. If the field's value is [truthful](https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/ListOfDataTypes), the corresponding input is hidden from the UI. There is no way to change this from the UI; it is supposed to be changed via REST. Check out an example below. |
| useInputToggleConfirmation | boolean | When true, displays a confirmation modal before toggling an input's status between active and inactive. |

### Services Properties

Expand Down
8 changes: 4 additions & 4 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Depending on which operating system you use, follow one of the procedures:
Set up the Python virtual environment:

```bash
python3 -m venv .venv
python3 -m venv .venv
```

If you use cmd.exe, activate the virtual environment with the following command:
Expand All @@ -42,8 +42,8 @@ If you use PowerShell, activate the virtual environment with the following comma
Set up and activate the Python virtual environment:

```bash
python3 -m venv .venv
source .venv/bin/activate
python3 -m venv .venv
source .venv/bin/activate
```

### Install UCC package
Expand Down Expand Up @@ -75,7 +75,7 @@ ucc-gen build --source demo_addon_for_splunk/package
### Package the add-on

```bash
ucc-gen package --path output/<add-on-name>
ucc-gen package --path output/demo_addon_for_splunk
```

The archive is created on the same level as your `globalConfig.json` file.
Expand Down
8 changes: 4 additions & 4 deletions poetry.lock

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

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ jsonschema = "^4.4.0"
PyYAML = "^6.0"
defusedxml = "^0.7.1"
colorama = "^0.4.6"
packaging = "24.0"
packaging = ">=23.0"

[tool.poetry.group.dev.dependencies]
mkdocs = "^1.4.2"
importlib-metadata = {version="*", python="<3.8"}
pytest = "^7.2.1"
pytest-splunk-addon = "^5.4.0"
pytest-splunk-addon-ui-smartx = "^5.3.0"
pytest-splunk-addon-ui-smartx = "^5.3.1"
pytest-rerunfailures = "^11.1.1"
mkdocs-material = "^9.1.3"
mkdocstrings = {version=">=0", extras=["python"]}
Expand Down
19 changes: 18 additions & 1 deletion renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"matchManagers": [
"poetry"
],
"matchPackagePrefixes": [
"matchPackageNames": [
"importlib-metadata",
"pytest",
"pytest-cov",
Expand All @@ -35,6 +35,23 @@
],
"enabled": false
},
{
"description": "Ignore Python version updates",
"matchManagers": ["poetry"],
"matchPackageNames": ["python"],
"enabled": false
},
{
"description": "Ignore mkdocs and its plugins that drop Python 3.7 support",
"matchPackageNames": [
"/^mkdocs"
],
"matchUpdateTypes": [
"major",
"minor"
],
"enabled": false
},
{
"matchPackageNames": ["urllib3"],
"allowedVersions": "<2.0.0"
Expand Down
2 changes: 2 additions & 0 deletions splunk_add_on_ucc_framework/commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ def generate(
"additional_packaging.py is present but does not have `additional_packaging`. "
"Skipping additional packaging."
)
# clean-up sys.path manipulation
sys.path.pop(0)

if global_config:
logger.info("Generating OpenAPI file")
Expand Down
29 changes: 22 additions & 7 deletions splunk_add_on_ucc_framework/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def _generate_addon(
addon_version: str,
addon_rest_root: str | None = None,
overwrite: bool = False,
add_license: str | None = None,
) -> str:
generated_addon_path = os.path.join(
os.getcwd(),
Expand Down Expand Up @@ -103,9 +104,21 @@ def _generate_addon(
_f.write(global_config_rendered_content)
package_path = os.path.join(generated_addon_path, "package")
os.makedirs(package_path)
package_license_path = os.path.join(package_path, "LICENSE.txt")
with open(package_license_path, "w") as _f:
pass
package_license_dir = os.path.join(package_path, "LICENSES")
os.makedirs(package_license_dir)

if add_license:
package_license_path = os.path.join(package_license_dir, f"{add_license}.txt")
template_path = utils.get_license_path(add_license)
with open(template_path) as content:
license_content = content.read()
with open(package_license_path, "w") as _f:
_f.write(license_content)
else:
# add-on licenses are to be kept in package/LICENSES directory only
package_license_path = os.path.join(package_license_dir, "LICENSE.txt")
with open(package_license_path, "w") as _f:
pass
package_readme_path = os.path.join(package_path, "README.txt")
with open(package_readme_path, "w") as _f:
pass
Expand All @@ -117,6 +130,7 @@ def _generate_addon(
addon_name=addon_name,
addon_version=addon_version,
addon_display_name=addon_display_name,
add_license=add_license,
)
)
with open(package_app_manifest_path, "w") as _f:
Expand Down Expand Up @@ -160,6 +174,7 @@ def init(
addon_version: str,
addon_rest_root: str | None = None,
overwrite: bool = False,
add_license: str | None = None,
) -> str:
if not _is_valid_addon_name(addon_name):
logger.error(
Expand Down Expand Up @@ -199,12 +214,12 @@ def init(
addon_version,
addon_rest_root,
overwrite,
add_license,
)
logger.info(f"Generated add-on is located here {generated_addon_path}")
logger.info(
"LICENSE.txt and README.txt are empty, "
"you may need to modify the content of those files\n"
)
if add_license:
logger.info(f"Specified {add_license} has been added to Licenses directory.")
logger.info("README.txt is empty, you may need to modify the content of this file.")
logger.info(
f"""You have generated your add-on and are wondering what to do next? \
UCC offers many solutions to improve add-ons!
Expand Down
Loading

0 comments on commit 4f336c0

Please sign in to comment.