Skip to content

Commit

Permalink
ci: new add-on passes AppInspect (#1501)
Browse files Browse the repository at this point in the history
**Issue number:** N/A

### PR Type

**What kind of change does this PR introduce?**
* [ ] Feature
* [ ] Bug Fix
* [ ] Refactoring (no functional or API changes)
* [ ] Documentation Update
* [x] Maintenance (dependency updates, CI, etc.)

## Summary

### Changes

Introduce a new test to verify that the new add-on (init -> build ->
package) passes Splunk's AppInspect checks.

It contains one hack

```
echo "# Binary File Declaration\n\nIgnoring lib/charset_normalizer/md.cpython-37m-x86_64-linux-gnu.so" > demo_addon_for_splunk/package/README.txt
```

to make sure we actually pass AppInspect checks.

We will need to follow up on it with the team and see how this can be
solved long-term.

### User experience

N/A

## Checklist

If an item doesn't apply to your changes, leave it unchecked.

* [x] I have performed a self-review of this change according to the
[development
guidelines](https://splunk.github.io/addonfactory-ucc-generator/contributing/#development-guidelines)
* [ ] Tests have been added/modified to cover the changes [(testing
doc)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#build-and-test)
* [ ] Changes are documented
* [x] PR title and description follows the [contributing
principles](https://splunk.github.io/addonfactory-ucc-generator/contributing/#pull-requests)
  • Loading branch information
artemrys authored Jan 3, 2025
1 parent 509199d commit f6cae67
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 39 deletions.
114 changes: 75 additions & 39 deletions .github/workflows/build-test-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,81 @@ jobs:
name: appinspect-api-html-report-${{ matrix.tags }}
path: AppInspect_response.html

init-build-run-appinspect-cli:
runs-on: ubuntu-22.04
needs:
- build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.7"
- uses: actions/download-artifact@v4
with:
name: UCC-UI-build
path: built-ui/
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
- run: |
cp -R built-ui/. splunk_add_on_ucc_framework/package/appserver/static/js/
poetry install --only main
- run: |
poetry run ucc-gen init \
--addon-name "demo_addon_for_splunk" \
--addon-display-name "Demo Add-on for Splunk" \
--addon-input-name demo_input \
--add-license "Apache License 2.0" \
--include-author Splunk
- run: |
echo "# Binary File Declaration\n\nIgnoring lib/charset_normalizer/md.cpython-37m-x86_64-linux-gnu.so" > demo_addon_for_splunk/package/README.txt
- run: |
poetry run ucc-gen build --source demo_addon_for_splunk/package --ta-version 0.0.1
- run: |
mkdir packaged
poetry run ucc-gen package --path output/demo_addon_for_splunk -o packaged
- run: |
python3 -m pip install splunk-appinspect
- run: |
splunk-appinspect inspect packaged/demo_addon_for_splunk-0.0.1.tar.gz --mode test --included-tags cloud
build-test-addon-openapi-client:
name: build-test-addon-openapi-client Splunk ${{ matrix.splunk.version }}
runs-on: ubuntu-22.04
needs:
- meta
- build-test-addon
- build
- test-unit
- test-smoke
strategy:
matrix:
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: UCC-UI-build
path: built-ui/
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
- run: |
cp -R built-ui/. splunk_add_on_ucc_framework/package/appserver/static/js/
poetry install --only main
- run: poetry run ucc-gen build --source tests/testdata/test_addons/package_global_config_everything/package -o out_${{ matrix.splunk.version }}
- run: |
cp out_${{ matrix.splunk.version }}/Splunk_TA_UCCExample/appserver/static/openapi.json ./oa_${{ matrix.splunk.version }}.json
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/oa_${{ matrix.splunk.version }}.json -g python -o /local/restapi_client_${{ matrix.splunk.version }}
- run: |
sudo chmod -R 777 ./restapi_client_${{ matrix.splunk.version }}
python3 -m pip install ./restapi_client_${{ matrix.splunk.version }}
- run: mv out_${{ matrix.splunk.version }} output
- run: |
./scripts/run_splunk.sh ${{ matrix.splunk.version }}
until curl -Lsk "https://localhost:8088/services/collector/health" &>/dev/null ; do echo -n "Waiting for HEC-" && sleep 5 ; done
timeout-minutes: 5
- run: python3 tests/testdata/expected_addons/expected_output_global_config_everything/client-test.py

all-checks:
if: ${{ !cancelled() }}
needs:
Expand Down Expand Up @@ -436,42 +511,3 @@ jobs:
run: |
poetry build
poetry publish -n -u ${{ secrets.PYPI_USERNAME }} -p ${{ secrets.PYPI_TOKEN }}
build-test-addon-openapi-client:
name: build-test-addon-openapi-client Splunk ${{ matrix.splunk.version }}
runs-on: ubuntu-22.04
needs:
- meta
- build-test-addon
- build
- test-unit
- test-smoke
strategy:
matrix:
splunk: ${{ fromJson(needs.meta.outputs.matrix_supportedSplunk) }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- uses: actions/download-artifact@v4
with:
name: UCC-UI-build
path: built-ui/
- run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1
- run: |
cp -R built-ui/. splunk_add_on_ucc_framework/package/appserver/static/js/
poetry install --only main
- run: poetry run ucc-gen build --source tests/testdata/test_addons/package_global_config_everything/package -o out_${{ matrix.splunk.version }}
- run: |
cp out_${{ matrix.splunk.version }}/Splunk_TA_UCCExample/appserver/static/openapi.json ./oa_${{ matrix.splunk.version }}.json
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/oa_${{ matrix.splunk.version }}.json -g python -o /local/restapi_client_${{ matrix.splunk.version }}
- run: |
sudo chmod -R 777 ./restapi_client_${{ matrix.splunk.version }}
python3 -m pip install ./restapi_client_${{ matrix.splunk.version }}
- run: mv out_${{ matrix.splunk.version }} output
- run: |
./scripts/run_splunk.sh ${{ matrix.splunk.version }}
until curl -Lsk "https://localhost:8088/services/collector/health" &>/dev/null ; do echo -n "Waiting for HEC-" && sleep 5 ; done
timeout-minutes: 5
- run: python3 tests/testdata/expected_addons/expected_output_global_config_everything/client-test.py
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ demo_addon_for_splunk_already_exists/
demo_addon_for_splunk_license/
addon_name
init_addon_for_ucc_package/
demo_addon_for_splunk/

# UI build
# ignore everything except redirect_page.js
Expand Down

0 comments on commit f6cae67

Please sign in to comment.