-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbump.py
35 lines (24 loc) · 1 KB
/
bump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
# Bumps all chart versions
from os import path
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper
import glob
import semver
CHART_DIRECTORIES = "charts/*"
for dir in glob.glob(CHART_DIRECTORIES):
if path.exists(path.join(dir, "Chart.yaml")) and path.exists(path.join(dir, "values.yaml")):
with open(path.join(dir, "values.yaml"), "r") as f:
values = load(f, Loader)
if "image" not in values or "repository" not in values["image"]:
continue
image = values["image"]["repository"]
with open(path.join(dir, "Chart.yaml"), "r") as f:
chart = load(f, Loader)
chartVersion = chart["version"]
chart["version"] = str(semver.VersionInfo.parse(chartVersion).bump_patch())
with open(path.join(dir, "Chart.yaml"), "w") as f:
dump(chart, f, Dumper)