Skip to content

Commit 7f9e012

Browse files
committed
chore(script): Formatting
1 parent db2aba9 commit 7f9e012

1 file changed

Lines changed: 17 additions & 7 deletions

File tree

.scripts/update_helm_charts.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import yaml
66
from typing import Tuple, Set
77

8+
89
def run_helm_repo_add(repo_name: str, repo_url: str) -> None:
910
try:
1011
subprocess.run(["helm", "repo", "add", repo_name, repo_url], check=True)
@@ -25,7 +26,7 @@ def get_chart_and_app_version(repo_name: str, chart_name: str) -> Tuple[str, str
2526
["helm", "show", "chart", full_chart],
2627
capture_output=True,
2728
text=True,
28-
check=True
29+
check=True,
2930
)
3031
chart_yaml = yaml.safe_load(result.stdout)
3132
return chart_yaml["version"], chart_yaml["appVersion"]
@@ -79,12 +80,14 @@ def process_yaml_files(top_dir: str) -> None:
7980
run_helm_repo_update(repo_name)
8081

8182
# print(f"📦 Updating {filepath} -> {repo_name}/{chart_name}")
82-
new_chart_version, new_app_version = get_chart_and_app_version(repo_name, chart_name)
83+
new_chart_version, new_app_version = get_chart_and_app_version(
84+
repo_name, chart_name
85+
)
8386

8487
updated_lines = []
8588
for line in raw_lines:
8689
if line.strip().startswith("version:"):
87-
new_line = f'version: {new_chart_version} # {new_app_version}\n'
90+
new_line = f"version: {new_chart_version} # {new_app_version}\n"
8891
updated_lines.append(new_line)
8992
else:
9093
updated_lines.append(line)
@@ -97,11 +100,18 @@ def process_yaml_files(top_dir: str) -> None:
97100
except Exception as e:
98101
print(f"⚠️ Error processing {filepath}: {e}")
99102

103+
100104
if __name__ == "__main__":
101-
print('⚠️⚠️⚠️ This script is best-effort! Always check the result using "git diff"! ⚠️⚠️⚠️')
102-
print('Notably, it skips invalid YAMLs, which can be the case because we sometimes use templating syntax, even for helm-chart definitions')
103-
print('Please judge on the skipped files if they contain a helm-chart and should be manually bumped')
104-
print('The script can be improved to handle such files in the future')
105+
print(
106+
'⚠️⚠️⚠️ This script is best-effort! Always check the result using "git diff"! ⚠️⚠️⚠️'
107+
)
108+
print(
109+
"Notably, it skips invalid YAMLs, which can be the case because we sometimes use templating syntax, even for helm-chart definitions"
110+
)
111+
print(
112+
"Please judge on the skipped files if they contain a helm-chart and should be manually bumped"
113+
)
114+
print("The script can be improved to handle such files in the future")
105115
print()
106116

107117
process_yaml_files(".")

0 commit comments

Comments
 (0)