Skip to content

Commit dffdfb2

Browse files
chore: remove support for .uccignore (#1770)
**Issue number:** ADDON-76463 ### PR Type **What kind of change does this PR introduce?** * [ ] Feature * [ ] Bug Fix * [x] Refactoring (no functional or API changes) * [x] Documentation Update * [ ] Maintenance (dependency updates, CI, etc.) ## Summary ### Changes Support for `.uccignore` has been removed. If a user includes this file, the build will now fail with an error message. ### User experience Users will no longer be able to use `.uccignore` feature. ## Checklist If an item doesn't apply to your changes, leave it unchecked. ### Review * [x] self-review - I have performed a self-review of this change according to the [development guidelines](https://splunk.github.io/addonfactory-ucc-generator/contributing/#development-guidelines) * [x] Changes are documented. The documentation is understandable, examples work [(more info)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#documentation-guidelines) * [x] PR title and description follows the [contributing principles](https://splunk.github.io/addonfactory-ucc-generator/contributing/#pull-requests) * [ ] meeting - I have scheduled a meeting or recorded a demo to explain these changes (if there is a video, put a link below and in the ticket) ### Tests See [the testing doc](https://splunk.github.io/addonfactory-ucc-generator/contributing/#build-and-test). * [ ] Unit - tests have been added/modified to cover the changes * [x] Smoke - tests have been added/modified to cover the changes * [ ] UI - tests have been added/modified to cover the changes * [x] coverage - I have checked the code coverage of my changes [(see more)](https://splunk.github.io/addonfactory-ucc-generator/contributing/#checking-the-code-coverage) **Demo/meeting:** *Reviewers are encouraged to request meetings or demos if any part of the change is unclear* --------- Co-authored-by: soleksy-splunk <143183665+soleksy-splunk@users.noreply.github.com>
1 parent e873d7d commit dffdfb2

File tree

4 files changed

+2
-173
lines changed

4 files changed

+2
-173
lines changed

docs/uccignore.md

Lines changed: 0 additions & 35 deletions
This file was deleted.

mkdocs.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ nav:
9494
- Custom search commands: "custom_search_commands.md"
9595
- Table: "table.md"
9696
- Additional packaging: "additional_packaging.md"
97-
- UCC ignore: "uccignore.md"
9897
- OpenAPI: "openapi.md"
9998
- UCC-related libraries: "ucc_related_libraries.md"
10099
- Custom UI extensions:

splunk_add_on_ucc_framework/commands/build.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# limitations under the License.
1515
#
1616
import ast
17-
import glob
1817
import json
1918
import logging
2019
import os
@@ -227,63 +226,6 @@ def _get_num_of_args(
227226
return None
228227

229228

230-
def _get_ignore_list(
231-
addon_name: str, ucc_ignore_path: str, output_directory: str
232-
) -> list[str]:
233-
"""
234-
Return path of files/folders to be removed.
235-
236-
Args:
237-
addon_name: Add-on name.
238-
ucc_ignore_path: Path to '.uccignore'.
239-
output_directory: Output directory path.
240-
241-
Returns:
242-
list: List of paths to be removed from output directory.
243-
"""
244-
if not os.path.exists(ucc_ignore_path):
245-
return []
246-
else:
247-
logger.warning(
248-
"The `.uccignore` feature has been deprecated from UCC and is planned to be removed after May 2025. "
249-
"To achieve the similar functionality use additional_packaging.py."
250-
"\nRefer: https://splunk.github.io/addonfactory-ucc-generator/additional_packaging/."
251-
)
252-
with open(ucc_ignore_path) as ignore_file:
253-
ignore_list = ignore_file.readlines()
254-
ignore_list = [
255-
(
256-
os.path.join(output_directory, addon_name, utils.get_os_path(path))
257-
).strip()
258-
for path in ignore_list
259-
if path.strip()
260-
]
261-
return ignore_list
262-
263-
264-
def _remove_listed_files(ignore_list: list[str]) -> list[str]:
265-
"""
266-
Return path of files/folders to removed in output folder.
267-
268-
Args:
269-
ignore_list (list): List of files/folder patterns to be removed in output directory.
270-
"""
271-
removed_list = []
272-
for pattern in ignore_list:
273-
paths = glob.glob(pattern, recursive=True)
274-
if not paths:
275-
logger.warning(f"No files found for the specified pattern: {pattern}")
276-
continue
277-
for path in paths:
278-
if os.path.exists(path):
279-
if os.path.isfile(path):
280-
os.remove(path)
281-
elif os.path.isdir(path):
282-
shutil.rmtree(path, ignore_errors=True)
283-
removed_list.append(path)
284-
return removed_list
285-
286-
287229
def _get_addon_version(addon_version: Optional[str]) -> str:
288230
if not addon_version:
289231
try:
@@ -627,14 +569,6 @@ def generate(
627569
global_config, gc_path, ta_name, dashboard_definition_json_path
628570
)
629571

630-
ignore_list = _get_ignore_list(
631-
ta_name,
632-
os.path.abspath(os.path.join(source, os.pardir, ".uccignore")),
633-
output_directory,
634-
)
635-
removed_list = _remove_listed_files(ignore_list)
636-
if removed_list:
637-
logger.info("Removed:\n{}".format("\n".join(removed_list)))
638572
utils.check_author_name(source, app_manifest)
639573

640574
# Update files before overwriting

tests/smoke/test_ucc_build.py

Lines changed: 2 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -637,82 +637,13 @@ def summarize_types(raw_expected_logs):
637637
assert log_line.levelname == expected_logs[log_line.message]
638638

639639

640-
def test_ucc_generate_with_everything_uccignore(caplog):
641-
"""
642-
Checks the deprecation warning of .uccignore present in a repo with
643-
its functionality still working.
644-
"""
645-
# clean-up cached `additional_packaging` module when running all tests
646-
sys.modules.pop("additional_packaging", "")
647-
with tempfile.TemporaryDirectory() as temp_dir:
648-
package_folder = path.join(
649-
path.dirname(path.realpath(__file__)),
650-
"..",
651-
"testdata",
652-
"test_addons",
653-
"package_global_config_everything_uccignore",
654-
"package",
655-
)
656-
# create `.uccignore` temporarily
657-
ucc_file = path.join(path.dirname(package_folder), ".uccignore")
658-
f = open(ucc_file, "w+")
659-
f.write(
660-
"""**/**one.py
661-
bin/splunk_ta_uccexample_rh_example_input_two.py
662-
bin/wrong_pattern
663-
"""
664-
)
665-
f.close()
666-
build.generate(source=package_folder, output_directory=temp_dir)
667-
668-
expected_warning_msg = (
669-
f"No files found for the specified pattern: "
670-
f"{temp_dir}/Splunk_TA_UCCExample/bin/wrong_pattern"
671-
)
672-
673-
edm_paths = {
674-
f"{temp_dir}/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_example_input_one.py",
675-
f"{temp_dir}/Splunk_TA_UCCExample/bin/helper_one.py",
676-
f"{temp_dir}/Splunk_TA_UCCExample/bin/example_input_one.py",
677-
f"{temp_dir}/Splunk_TA_UCCExample/bin/splunk_ta_uccexample_rh_example_input_two.py",
678-
}
679-
removed = set(
680-
caplog.text.split("Removed:", 1)[1].split("INFO")[0].strip().split("\n")
681-
)
682-
exp_msg = (
683-
"The `.uccignore` feature has been deprecated from UCC and is planned to be removed after May 2025. "
684-
"To achieve the similar functionality use additional_packaging.py."
685-
"\nRefer: https://splunk.github.io/addonfactory-ucc-generator/additional_packaging/."
686-
)
687-
exp_info_msg = (
688-
"additional_packaging.py is present but does not have `additional_packaging`."
689-
" Skipping additional packaging."
690-
)
691-
692-
assert exp_msg in caplog.text
693-
assert exp_info_msg in caplog.text
694-
assert expected_warning_msg in caplog.text
695-
assert edm_paths == removed
696-
# on successful assertion, we delete the file
697-
os.remove(ucc_file)
698-
699-
actual_folder = path.join(temp_dir, "Splunk_TA_UCCExample")
700-
# when custom files are provided, default files shouldn't be shipped
701-
files_should_be_absent = [
702-
("bin", "splunk_ta_uccexample_rh_example_input_one.py"),
703-
("bin", "example_input_one.py"),
704-
("bin", "splunk_ta_uccexample_rh_example_input_two.py"),
705-
]
706-
for af in files_should_be_absent:
707-
actual_file_path = path.join(actual_folder, *af)
708-
assert not path.exists(actual_file_path)
709-
710-
711640
def test_ucc_generate_with_everything_cleanup_output_files():
712641
"""
713642
Checks the functioning of addtional_packaging.py's `cleanup_output_files` present in a repo.
714643
Compares only the files that shouldn't be present in the output directory.
715644
"""
645+
# clean-up cached `additional_packaging` module when running all tests
646+
sys.modules.pop("additional_packaging", "")
716647
with tempfile.TemporaryDirectory() as temp_dir:
717648
package_folder = path.join(
718649
path.dirname(path.realpath(__file__)),

0 commit comments

Comments
 (0)