Repository: pantsbuild/pants

Issue:
Add support for Helm chart documentation files
**Is your feature request related to a problem? Please describe.**
As part of the Helm chart file structure there are some documentation-related optional files that a chart may include and which will be helpful for users of a published chart.

The `helm_chart` target does not support any of those kind of files at the moment, for a more complete implementation, support for these files should be added: `values.schema.json`, `README.md`, `LICENSE` and `templates/NOTES.txt`.

**Describe the solution you'd like**
Add one optional single-source field per file to the `helm_chart`. This would allow to later provide with add-on implementations that could codegen each of those files independently from different sources.

**Describe alternatives you've considered**
N/A

**Additional context**
Helm documentation describing chart file structure:
https://helm.sh/docs/topics/charts/



Discussion:

Resolving patch:
diff --git a/src/python/pants/backend/helm/target_types.py b/src/python/pants/backend/helm/target_types.py
--- a/src/python/pants/backend/helm/target_types.py
+++ b/src/python/pants/backend/helm/target_types.py
@@ -121,15 +121,20 @@ class HelmChartMetaSourceField(SingleSourceField):
 
 class HelmChartSourcesField(MultipleSourcesField):
     default = (
+        ".helmignore",
+        "README.md",
+        "LICENSE",
         "values.yaml",
         "values.yml",
+        "values.schema.json",
         "templates/*.yaml",
         "templates/*.yml",
         "templates/*.tpl",
+        "templates/NOTES.txt",
         "crds/*.yaml",
         "crds/*.yml",
     )
-    expected_file_extensions = (".yaml", ".yml", ".tpl")
+    expected_file_extensions = (".helmignore", ".yaml", ".yml", ".tpl", ".json", ".md", ".txt", "")
     help = generate_multiple_sources_field_help_message(
         "Example: `sources=['values.yaml', 'templates/*.yaml', '!values_ignore.yaml']`"
     )


Test patch:
diff --git a/src/python/pants/backend/helm/util_rules/sources_test.py b/src/python/pants/backend/helm/util_rules/sources_test.py
--- a/src/python/pants/backend/helm/util_rules/sources_test.py
+++ b/src/python/pants/backend/helm/util_rules/sources_test.py
@@ -74,7 +74,7 @@ def test_can_not_auto_detect_source_root(rule_runner: RuleRunner) -> None:
         rule_runner.request(HelmChartRoot, [HelmChartRootRequest(field_set.chart)])
 
 
-def test_source_templates_are_always_included(rule_runner: RuleRunner) -> None:
+def test_standard_sources_are_always_included(rule_runner: RuleRunner) -> None:
     rule_runner.write_files(
         {
             "BUILD": dedent(
@@ -86,9 +86,13 @@ def test_source_templates_are_always_included(rule_runner: RuleRunner) -> None:
             ),
             "Chart.yaml": HELM_CHART_FILE,
             "values.yaml": HELM_VALUES_FILE,
+            "values.schema.json": "",
+            "README.md": "",
+            "LICENSE": "",
             "crds/foo.yml": K8S_CRD_FILE,
             "templates/_helpers.tpl": HELM_TEMPLATE_HELPERS_FILE,
             "templates/service.yaml": K8S_SERVICE_TEMPLATE,
+            "templates/NOTES.txt": "",
             "resource.xml": "",
             "file.txt": "",
         }
@@ -106,9 +110,13 @@ def test_source_templates_are_always_included(rule_runner: RuleRunner) -> None:
     )
 
     assert source_files.snapshot.files == (
+        "LICENSE",
+        "README.md",
         "crds/foo.yml",
+        "templates/NOTES.txt",
         "templates/_helpers.tpl",
         "templates/service.yaml",
+        "values.schema.json",
         "values.yaml",
     )