From 24c984d6caf9071ee50cef9f8645ec0c610f3d23 Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Tue, 3 Dec 2024 16:26:48 +0100 Subject: [PATCH 1/5] chore: move build-test-addon-openapi-client higher --- .github/workflows/build-test-release.yml | 78 ++++++++++++------------ 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 0afc0b68d..86845f343 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -353,6 +353,45 @@ jobs: name: appinspect-api-html-report-${{ matrix.tags }} path: AppInspect_response.html + 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: @@ -434,42 +473,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 From 1be4469dc01a1f206de4d46df6032efc05a755de Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Tue, 3 Dec 2024 16:44:02 +0100 Subject: [PATCH 2/5] ci: check if a new add-on is compatible with AppInspect CLI cloud --- .github/workflows/build-test-release.yml | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 86845f343..ac740f97d 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -353,6 +353,36 @@ 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-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 + poetry run ucc-gen build --source demo_addon_for_splunk/package --ta-version 0.0.1 + - uses: splunk/appinspect-cli-action@v2.8 + with: + app_path: output/demo_addon_for_splunk + included_tags: "cloud" + build-test-addon-openapi-client: name: build-test-addon-openapi-client Splunk ${{ matrix.splunk.version }} runs-on: ubuntu-22.04 From fc048216e1e4afbf270e92c3c21e9dffd8b04b10 Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Tue, 3 Dec 2024 18:13:42 +0100 Subject: [PATCH 3/5] ci: package add-on before running AppInspect --- .github/workflows/build-test-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index ac740f97d..56131ee94 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -378,9 +378,10 @@ jobs: --add-license "Apache License 2.0" \ --include-author Splunk poetry run ucc-gen build --source demo_addon_for_splunk/package --ta-version 0.0.1 + poetry run ucc-gen package --path output/demo_addon_for_splunk -o packaged - uses: splunk/appinspect-cli-action@v2.8 with: - app_path: output/demo_addon_for_splunk + app_path: packaged included_tags: "cloud" build-test-addon-openapi-client: From a159f221deef6d26d1693b8132d1ae066c79a61a Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Tue, 3 Dec 2024 18:25:23 +0100 Subject: [PATCH 4/5] ci: download proper artifact --- .github/workflows/build-test-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 56131ee94..707061061 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -364,7 +364,7 @@ jobs: python-version: "3.7" - uses: actions/download-artifact@v4 with: - name: UCC-build + name: UCC-UI-build path: built-ui/ - run: curl -sSL https://install.python-poetry.org | python3 - --version 1.5.1 - run: | From 1869c89fb58b7aa29c5603f2ef7ba3832fecbc50 Mon Sep 17 00:00:00 2001 From: Artem Rys Date: Tue, 3 Dec 2024 18:37:57 +0100 Subject: [PATCH 5/5] ci: create packaged directory --- .github/workflows/build-test-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-test-release.yml b/.github/workflows/build-test-release.yml index 707061061..f6bd0d2ec 100644 --- a/.github/workflows/build-test-release.yml +++ b/.github/workflows/build-test-release.yml @@ -378,6 +378,7 @@ jobs: --add-license "Apache License 2.0" \ --include-author Splunk poetry run ucc-gen build --source demo_addon_for_splunk/package --ta-version 0.0.1 + mkdir packaged poetry run ucc-gen package --path output/demo_addon_for_splunk -o packaged - uses: splunk/appinspect-cli-action@v2.8 with: