Skip to content

Commit

Permalink
feat: release v5.24.0 (#713)
Browse files Browse the repository at this point in the history
* feat: update UCC UI to v1.24.0 (#709)

* feat: introduce ucc-gen import-from-aob (#710)

* feat: introduce ucc-gen import-from-aob

This introduces a new command to import add-on built with AoB (Addon Builder)
into the UCC-accepted structure.

* test: fix pipeline failures

* fix: use_single_instance=False by default (#711)

Docs: https://dev.splunk.com/enterprise/reference/modinputs/modinputsintrospection/

* ci: update splunk/appinspect-cli-action to v1.7 (#712)

* docs: update for import-from-aob command (#714)
  • Loading branch information
artemrys authored Apr 4, 2023
1 parent de87269 commit e5bc2f1
Show file tree
Hide file tree
Showing 20 changed files with 559 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ jobs:
- run: pip install splunk-packaging-toolkit
- name: Slim tests/expected_output_global_config_inputs_configuration_alerts/Splunk_TA_UCCExample
run: mkdir tests/slimmed; slim package tests/testdata/expected_addons/expected_output_global_config_inputs_configuration_alerts/Splunk_TA_UCCExample -o tests/slimmed
- uses: splunk/appinspect-cli-action@v1.6
- uses: splunk/appinspect-cli-action@v1.7
with:
app_path: tests/slimmed
included_tags: ${{ matrix.tags }}
Expand Down
2 changes: 2 additions & 0 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,5 @@ header:
- ".*"
- "example/**"
- "splunk_add_on_ucc_framework/commands/init_template/**"
- "splunk_add_on_ucc_framework/commands/import_from_aob.sh"
- "splunk_add_on_ucc_framework/commands/imports.py"
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ repos:
rev: v0.991
hooks:
- id: mypy
exclude: ^docs/
exclude: (^docs/|^splunk_add_on_ucc_framework/commands/imports.py)
additional_dependencies: ['types-PyYAML']
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: ^splunk_add_on_ucc_framework/commands/init_template/
exclude: (^splunk_add_on_ucc_framework/commands/init_template/|^splunk_add_on_ucc_framework/commands/imports.py)
77 changes: 52 additions & 25 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,32 +96,27 @@ use updated modular inputs from `package/bin` instead of generating new ones.

## Commands

As of now, running `ucc-gen` does the same thing as running `ucc-gen build`,
### `ucc-gen build`

Builds the add-on. As of now, running `ucc-gen` does the same thing as running `ucc-gen build`,
but eventually calling `ucc-gen` without specifying a subcommand will be
deprecated.

* `build` - build the add-on.

* `--source` - [optional] folder containing the `app.manifest` and app
source.
* `--config` - [optional] path to the configuration file, defaults to
globalConfig file in the parent directory of source provided.
* `--ta-version` - [optional] override current version of TA, default
version is version specified in `globalConfig.json` or `globalConfig.yaml`.
Splunkbase compatible version of SEMVER will be used by default.
* `--python-binary-name` - [optional] Python binary name to use when
installing Python libraries.

* `init` - initialize the add-on (available from `v5.19.0`).

* `--addon-name` - [required] add-on name. Consult with
[official naming convention guide](https://dev.splunk.com/enterprise/docs/releaseapps/splunkbase/namingguidelines/).
* `--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, `0.0.1` by default.
* `--overwrite` - [optional] overwrites already existing folder if used,
by default you can't generate a new add-on to already existing folder.
deprecated.

It takes the following parameters:

* `--source` - [optional] folder containing the `app.manifest` and app
source.
* `--config` - [optional] path to the configuration file, defaults to
globalConfig file in the parent directory of source provided.
* `--ta-version` - [optional] override current version of TA, default
version is version specified in `globalConfig.json` or `globalConfig.yaml`.
Splunkbase compatible version of SEMVER will be used by default.
* `--python-binary-name` - [optional] Python binary name to use when
installing Python libraries.

### `ucc-gen init`

Initializes the add-on (available from `v5.19.0`).
`ucc-gen init` command initializes the add-on and bootstraps some code in the
modular input which you, as a developer, can extend for your needs.

Expand All @@ -131,7 +126,39 @@ clustering files in `default/server.conf` file and reload triggers in
`ucc-gen build` command itself, for now you need to include them manually
during the add-on development.

## What `ucc-gen` does
It takes the following parameters:

* `--addon-name` - [required] add-on name. Consult with
[official naming convention guide](https://dev.splunk.com/enterprise/docs/releaseapps/splunkbase/namingguidelines/).
* `--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, `0.0.1` by default.
* `--overwrite` - [optional] overwrites already existing folder if used,
by default you can't generate a new add-on to already existing folder.

### `ucc-gen import-from-aob`

Import from AoB (Add-on Builder) (available from `v5.24.0`). It is in the
**experimental** state as of now, meaning that running this command may not
produce 100% UCC compatible add-on, but we are going to work on future
improvements for the script itself.

> Note: `import-from-aob` command does not support Windows as of now.
The import functionality is based on the
[ucc_migration_test](https://github.com/tmartin14/ucc_migration_test) bash
script.
One of the ways you can use it is to download an AoB-based add-on from
Splunkbase, unarchive it and use
`ucc-gen import-from-aob --addon-name <unarchived-folder-name>`. Or you can
run the same command against your locally developed add-on, but it should be
exported from AoB.

It takes the following parameters:

* `--addon-name` - [required] add-on name.

## What `ucc-gen build` does

* Cleans the output folder.
* Retrieves the package ID of addon.
Expand Down
2 changes: 1 addition & 1 deletion example/globalConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
"meta": {
"name": "Splunk_TA_dummy_data",
"restRoot": "Splunk_TA_dummy_data",
"version": "5.23.0Rcc389503",
"version": "5.23.2R593316cd",
"displayName": "Splunk_TA_dummy_data",
"schemaVersion": "0.0.3"
}
Expand Down
2 changes: 1 addition & 1 deletion get-ucc-ui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
wget https://github.com/splunk/addonfactory-ucc-base-ui/releases/download/v1.23.1/splunk-ucc-ui.tgz
wget https://github.com/splunk/addonfactory-ucc-base-ui/releases/download/v1.24.0/splunk-ucc-ui.tgz
2 changes: 1 addition & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@
#

[pytest]
norecursedirs = .git .venv venv build tests/deps node_modules package tests/smoke/output tests/testdata/expected_addons/expected_output_global_config_inputs_configuration_alerts tests/data/output output
norecursedirs = .git .venv venv build tests/deps node_modules package tests/smoke/output tests/testdata/expected_addons/expected_output_global_config_inputs_configuration_alerts tests/data/output output tests/smoke/Splunk_TA_Dynatrace
addopts = -v --tb=long
38 changes: 38 additions & 0 deletions splunk_add_on_ucc_framework/commands/import_from_aob.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#
# Copyright 2021 Splunk Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import os
import subprocess

import logging
import sys

logger = logging.getLogger("ucc_gen")


def import_from_aob(addon_name: str):
addon_name_directory = os.path.join(os.getcwd(), addon_name)
if not os.path.isdir(addon_name_directory):
logger.error(f"No such directory {addon_name_directory}")
sys.exit(1)
import_from_aob_script_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)),
"commands",
"import_from_aob.sh",
)
imports_py_path = os.path.join(
os.path.dirname(os.path.dirname(__file__)), "commands", "imports.py"
)
subprocess.call((import_from_aob_script_path, addon_name, imports_py_path))
Loading

0 comments on commit e5bc2f1

Please sign in to comment.