Repository: jupyterhub/chartpress

Issue:
--list-images updates Chart.yaml's version
Running `chartpress --list-images` will also update Chart.yaml with a version which I consider unwanted.

Discussion:

Patch:
diff --git a/chartpress.py b/chartpress.py
index 27906a9..0d0fa08 100755
--- a/chartpress.py
+++ b/chartpress.py
@@ -826,15 +826,16 @@ def main(args=None):
         if args.reset:
             forced_version = chart.get('resetVersion', '0.0.1-set.by.chartpress')
 
-        # update Chart.yaml with a version
-        chart_version = build_chart(
-            chart['name'],
-            paths=_get_all_chart_paths(chart),
-            version=forced_version,
-            long=args.long,
-            reset=args.reset,
-            strict_version=args.publish_chart,
-        )
+        if not args.list_images:
+            # update Chart.yaml with a version
+            chart_version = build_chart(
+                chart['name'],
+                paths=_get_all_chart_paths(chart),
+                version=forced_version,
+                long=args.long,
+                reset=args.reset,
+                strict_version=args.publish_chart,
+            )
 
         if 'images' in chart:
             # build images


Test patch:
diff --git a/tests/test_chartpress.py b/tests/test_chartpress.py
index 0334a37..d1dcc3b 100644
--- a/tests/test_chartpress.py
+++ b/tests/test_chartpress.py
@@ -19,3 +19,11 @@ def test_list_images(git_repo):
     # split hash_suffix which will be different every run
     pre_hash, hash_suffix = images[0].rsplit(".", 1)
     assert pre_hash == "testchart/testimage:0.0.1-n001"
+
+    p = run(
+        ["git", "status", "--porcelain"],
+        check=True,
+        stdout=PIPE,
+        stderr=PIPE,
+    )
+    assert not p.stdout, "--list-images should not make changes!"