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

chore: merge develop into main #1565

Merged
merged 16 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions .github/actions/cached-ui-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ runs:
cache: 'yarn'
cache-dependency-path: 'ui/yarn.lock'
node-version-file: 'ui/package.json'
# required for publishing
registry-url: 'https://registry.npmjs.org'
- name: Install Dependencies
working-directory: ui
run: yarn install --frozen-lockfile
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ jobs:
- build-test-addon
- build
- test-unit
- test-smoke
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -483,9 +482,8 @@ jobs:
- uses: actions/setup-python@v5
with:
python-version: "3.7"
- uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- name: install UI deps
uses: ./.github/actions/cached-ui-deps
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
- uses: actions/download-artifact@v4
with:
Expand Down Expand Up @@ -515,9 +513,9 @@ jobs:
poetry build
poetry publish -n -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_TOKEN }}
- if: ${{ steps.semantic.outputs.new_release_published == 'true' }}
name: Publish NPM (dry-run)
name: Publish NPM
run: |
cd ui
npm publish --provenance --access public --dry-run || true
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
24 changes: 22 additions & 2 deletions .github/workflows/build-ui.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ on:
workflow_call:

jobs:
build-ui:
ui-code-check:
runs-on: ubuntu-22.04
defaults:
run:
Expand All @@ -17,6 +17,26 @@ jobs:
run: yarn run lint
- name: Unit test
run: yarn run test
- name: Build lib and publish dry run
run: npm publish --provenance --access public --dry-run
- name: Pack tarball
run: npm pack
- name: Upload tarball as artifact
uses: actions/upload-artifact@v4
with:
name: UCC-UI-lib-tarball
path: "ui/*.tgz"

build-ui:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ui
shell: bash
steps:
- uses: actions/checkout@v4
- name: install deps
uses: ./.github/actions/cached-ui-deps
- name: Build UCC library
run: yarn run build:lib
- name: Build UCC UI
Expand All @@ -27,4 +47,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: UCC-UI-build
path: ui/dist/
path: ui/dist/
39 changes: 39 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: NPM Publish

on:
workflow_dispatch:
inputs:
tag:
description: "Git tag to publish"
required: true
dry_run:
description: "Perform a dry run of the npm publish"
required: false
default: true
type: boolean

jobs:
publish:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ui
shell: bash
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.tag }}

- name: Install deps
uses: ./.github/actions/cached-ui-deps

- name: Publish NPM package
run: |
if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then
npm publish --provenance --access public --dry-run
else
npm publish --provenance --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions renovate.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
"string-width",
"strip-ansi",
"styled-components",
"@types/styled-components",
"stylelint",
"undici"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ def generate_rh(self) -> str:


class RestEndpointBuilder:
def __init__(self, name: Optional[str], namespace: str, **kwargs: str):
def __init__(self, name: Optional[str], namespace: str, **kwargs: Any):
self._name = name
self._namespace = namespace
self._entities: List[RestEntityBuilder] = []
Expand All @@ -144,6 +144,7 @@ def __init__(self, name: Optional[str], namespace: str, **kwargs: str):
self._rest_handler_name = f"{self._namespace}_rh_{self._name}"
self._rest_handler_module = kwargs.get("rest_handler_module")
self._rest_handler_class = kwargs.get("rest_handler_class")
self._need_reload = kwargs.get("need_reload", False)

@property
def name(self) -> str:
Expand Down Expand Up @@ -173,6 +174,10 @@ def rh_class(self) -> Optional[str]:
def entities(self) -> List[RestEntityBuilder]:
return self._entities

@property
def need_reload(self) -> bool:
return self._need_reload

def add_entity(self, entity: RestEntityBuilder) -> None:
self._entities.append(entity)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class MultipleModelEndpointBuilder(RestEndpointBuilder):
models=[
{models}
],
need_reload={need_reload},
)


Expand All @@ -81,4 +82,5 @@ def generate_rh(self) -> str:
entities="\n".join(entities),
models=indent(models_lines, 2),
conf_name=self.conf_name,
need_reload=self.need_reload,
)
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ class SingleModelEndpointBuilder(RestEndpointBuilder):
endpoint = SingleModel(
'{conf_name}',
model,
config_name='{config_name}'
config_name='{config_name}',
need_reload={need_reload},
)


Expand All @@ -85,4 +86,5 @@ def generate_rh(self) -> str:
entity=entity.generate_rh(),
conf_name=self.conf_name,
config_name=self._name,
need_reload=self.need_reload,
)
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ def oauth_conf_file_names(self) -> List[str]:
def endpoints(self) -> List[RestEndpointBuilder]:
return list(self._endpoints.values())

@property
def need_reload(self) -> bool:
return False

def _parse_builder_schema(self) -> None:
self._builder_configs()
self._builder_settings()
Expand All @@ -102,6 +106,7 @@ def _builder_configs(self) -> None:
rest_handler_class=config.get(
"restHandlerClass", REST_HANDLER_DEFAULT_CLASS
),
need_reload=self.need_reload,
)
self._endpoints[name] = endpoint
content = self._get_oauth_enitities(config["entity"])
Expand Down Expand Up @@ -140,6 +145,7 @@ def _builder_settings(self) -> None:
namespace=self.global_config.namespace,
rest_handler_module=REST_HANDLER_DEFAULT_MODULE,
rest_handler_class=REST_HANDLER_DEFAULT_CLASS,
need_reload=self.need_reload,
)
self._endpoints["settings"] = endpoint
for setting in self.global_config.settings:
Expand Down Expand Up @@ -173,6 +179,7 @@ def _builder_inputs(self) -> None:
rest_handler_name=rest_handler_name,
rest_handler_module=rest_handler_module,
rest_handler_class=rest_handler_class,
need_reload=self.need_reload,
)
self._endpoints[name] = single_model_endpoint
content = self._get_oauth_enitities(input_item["entity"])
Expand Down
2 changes: 1 addition & 1 deletion splunk_add_on_ucc_framework/install_python_libraries.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
logger = logging.getLogger("ucc_gen")


LIBS_REQUIRED_FOR_UI = {"splunktaucclib": "6.4.0"}
LIBS_REQUIRED_FOR_UI = {"splunktaucclib": "6.6.0"}
LIBS_REQUIRED_FOR_OAUTH = {"solnlib": "5.5.0"}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@
endpoint = SingleModel(
'splunk_ta_uccexample_account',
model,
config_name='account'
config_name='account',
need_reload=False,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@
model_logging,
model_custom_abc
],
need_reload=False,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@
endpoint = SingleModel(
'splunk_ta_uccexample_account',
model,
config_name='account'
config_name='account',
need_reload=False,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
model_logging,
model_custom_abc
],
need_reload=False,
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@
"meta": {
"name": "test_addon",
"restRoot": "test_addon",
"version": "5.56.0+12f4cd8cd",
"version": "5.57.0+f11804ebf",
"displayName": "This is my add-on",
"schemaVersion": "0.0.9"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1897,7 +1897,7 @@
"meta": {
"name": "Splunk_TA_UCCExample",
"restRoot": "splunk_ta_uccexample",
"version": "5.56.0+12f4cd8cd",
"version": "5.57.0+f11804ebf",
"displayName": "Splunk UCC test Add-on",
"schemaVersion": "0.0.9",
"supportedThemes": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@
"meta": {
"name": "Splunk_TA_UCCExample",
"restRoot": "splunk_ta_uccexample",
"version": "5.56.0+12f4cd8cd",
"version": "5.57.0+f11804ebf",
"displayName": "Splunk UCC test Add-on",
"schemaVersion": "0.0.9"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,7 @@
"meta": {
"name": "Splunk_TA_UCCExample",
"restRoot": "splunk_ta_uccexample",
"version": "5.56.0+12f4cd8cd",
"version": "5.57.0+f11804ebf",
"displayName": "Splunk UCC test Add-on",
"schemaVersion": "0.0.9"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"meta": {
"name": "Splunk_TA_UCCExample",
"restRoot": "splunk_ta_uccexample",
"version": "5.56.0+12f4cd8cd",
"version": "5.57.0+f11804ebf",
"displayName": "Splunk UCC test Add-on",
"schemaVersion": "0.0.9"
}
Expand Down
6 changes: 5 additions & 1 deletion tests/ui/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ def pytest_runtest_call(item: pytest.Item) -> Iterator[Any]:

yield

IGNORED: List[str] = []
# sometimes RUM is down and we get a lot of severe logs
IGNORED: List[str] = [
"https://rum-ingest.us1.signalfx.com",
"https://cdn.signalfx.com/o11y-gdi-rum",
]

browser_logs = s_utils.get_browser_logs(item.selenium_helper.browser)
severe_logs = [
Expand Down
Loading
Loading