Skip to content

Commit

Permalink
Add documentation-related sources to helm_chart (#15638)
Browse files Browse the repository at this point in the history
Closes #15622
  • Loading branch information
alonsodomin authored Apr 13, 2024
1 parent 5596794 commit 8f44568
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/python/pants/backend/helm/target_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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']`"
)
Expand Down
10 changes: 9 additions & 1 deletion src/python/pants/backend/helm/util_rules/sources_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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": "",
}
Expand All @@ -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",
)

Expand Down

0 comments on commit 8f44568

Please sign in to comment.