@@ -1138,7 +1138,13 @@ def main(args=None):
1138
1138
# tag specified, use that version
1139
1139
forced_version = args .tag
1140
1140
1141
- if not args .list_images :
1141
+ if args .list_images :
1142
+ # skip build_chart when listing images,
1143
+ # instead read the current version from Chart.yaml
1144
+ chart_file = os .path .join (chart ["name" ], "Chart.yaml" )
1145
+ with open (chart_file ) as f :
1146
+ chart_version = yaml .load (f )["version" ]
1147
+ else :
1142
1148
# update Chart.yaml with a version
1143
1149
chart_version = build_chart (
1144
1150
chart ["name" ],
@@ -1156,13 +1162,22 @@ def main(args=None):
1156
1162
base_version = _trim_version_suffix (chart_version )
1157
1163
else :
1158
1164
base_version = None
1165
+
1166
+ # set common image tag if `--tag` specified _or_ resetting
1167
+ common_image_tag = None
1168
+ if args .tag :
1169
+ common_image_tag = args .tag
1170
+ elif args .reset :
1171
+ if use_chart_version :
1172
+ common_image_tag = chart_version
1173
+ else :
1174
+ common_image_tag = chart .get ("resetTag" , "set-by-chartpress" )
1175
+
1159
1176
# build images
1160
1177
values_file_modifications = build_images (
1161
1178
prefix = args .image_prefix or chart .get ("imagePrefix" , "" ),
1162
1179
images = chart ["images" ],
1163
- tag = args .tag
1164
- if not args .reset
1165
- else chart .get ("resetTag" , "set-by-chartpress" ),
1180
+ tag = common_image_tag ,
1166
1181
push = args .push ,
1167
1182
force_push = args .force_push ,
1168
1183
force_build = args .force_build ,
0 commit comments