Skip to content

Commit 720671d

Browse files
minrkconsideRatio
andauthored
Apply suggestions from code review
Co-authored-by: Erik Sundell <[email protected]>
1 parent fc321d5 commit 720671d

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,13 @@ information.
3333
before its set as Helm 3 requires Helm chart versions to be SemVer2
3434
compliant.
3535
1. The latest commit modifying content in a _relevant path_ since `tag`.
36-
1. `n`: The number of commits since the tagged commit, as an integer.
37-
1. `h`: The latest commit's abbreviated hash. which is often 7-8 characters,
36+
1. `n`: The number of commits since the latest tagged commit on the branch, as an integer.
37+
1. `hash`: The latest commit's abbreviated hash, which is often 7-8 characters,
3838
prefixed with `h`.
39-
1. If `tag` (like `0.10.0` or `0.10.0-beta.1`) contains `-`,
40-
indicating that it is a prerelease,
41-
the chartpress suffix will be added to the prerelease fields,
42-
e.g. `0.10.0-beta.1.git.5.habc123`
43-
format will be used instead of a `tag-0.dev.git.n.h` format to be SemVer 2 compliant.
39+
1. If `tag` (like `0.10.0` or `0.10.0-beta.1`) contains a `-`, a `tag.git.n.hash`
40+
format will be used, and otherwise a `tag-0.dev.git.n.hash` format will be used.
4441
1. If `--long` is specified or not. If `--long` is specified, tagged commits
45-
will always be written out with the `n.h` part appended to it, looking something
42+
will always be written out with the `.git.n.hash` part appended to it, looking something
4643
like `1.0.0-0.dev.git.0.habcd123`
4744

4845
When producing a development version (with `.git.n.hash` on the end),

chartpress.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,10 @@ def build_chart(
787787
Update Chart.yaml's version, using specified version or by constructing one.
788788
789789
Chart versions are constructed using:
790-
a) a base version, derived from either Chart.yaml or the latest tag
791-
b) the latest commit that modified provided paths
790+
a) a base version, derived from either Chart.yaml's version field or the latest git tag on branch
791+
b) the latest commit that was tagged on the current branch (n)
792+
c) the latest commit that modified provided paths (hash)
793+
792794
793795
Example versions constructed:
794796
- 0.9.0-0.dev.git.2.hdfgh3456
@@ -1117,7 +1119,6 @@ def main(args=None):
11171119
# - push chart (--publish-chart, --extra-message)
11181120
for chart in config["charts"]:
11191121
forced_version = None
1120-
# TODO: maybe warn and switch default in the future?
11211122
use_chart_version = chart.get("useChartVersion", False)
11221123

11231124
if args.tag:
@@ -1126,7 +1127,7 @@ def main(args=None):
11261127
elif args.reset and not use_chart_version:
11271128
# resetting, get version from chartpress.yaml,
11281129
# ignoring current version in Chart.yaml
1129-
forced_version = chart.get("resetVersion", "0.0.1-0.dev")
1130+
forced_version = chart.get("resetVersion", "0.0.1-set.by.chartpress")
11301131

11311132
if not args.list_images:
11321133
# update Chart.yaml with a version

0 commit comments

Comments
 (0)