Complete implementation: Fix helmfile list to reflect versions from helmfile.lock for both --skip-charts and normal modes
Co-authored-by: yxxhero <11087727+yxxhero@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									19ede56a51
								
							
						
					
					
						commit
						3dc7b27c6e
					
				|  | @ -593,17 +593,29 @@ func (a *App) ListReleases(c ListConfigProvider) error { | ||||||
| 		var err error | 		var err error | ||||||
| 
 | 
 | ||||||
| 		if !c.SkipCharts() { | 		if !c.SkipCharts() { | ||||||
| 			err = run.withPreparedCharts("list", state.ChartPrepareOptions{ | 			// Even though we call withPreparedCharts, the list command is explicitly
 | ||||||
|  | 			// skipped in prepareChartsIfNeeded, so we need to resolve dependencies here
 | ||||||
|  | 			resolvedState, resolveErr := run.state.ResolveDeps() | ||||||
|  | 			if resolveErr != nil { | ||||||
|  | 				err = resolveErr | ||||||
|  | 			} else { | ||||||
|  | 				// Create a new run with the resolved state to get the correct versions
 | ||||||
|  | 				resolvedRun := *run | ||||||
|  | 				resolvedRun.state = resolvedState | ||||||
|  | 				 | ||||||
|  | 				err = resolvedRun.withPreparedCharts("list", state.ChartPrepareOptions{ | ||||||
| 					SkipRepos:   true, | 					SkipRepos:   true, | ||||||
| 					SkipDeps:    true, | 					SkipDeps:    true, | ||||||
|  | 					SkipResolve: false, // Explicitly enable dependency resolution
 | ||||||
| 					Concurrency: 2, | 					Concurrency: 2, | ||||||
| 				}, func() { | 				}, func() { | ||||||
| 				rel, err := a.list(run) | 					rel, err := a.list(&resolvedRun) | ||||||
| 					if err != nil { | 					if err != nil { | ||||||
| 						panic(err) | 						panic(err) | ||||||
| 					} | 					} | ||||||
| 					stateReleases = rel | 					stateReleases = rel | ||||||
| 				}) | 				}) | ||||||
|  | 			} | ||||||
| 		} else { | 		} else { | ||||||
| 			// Even when skipping charts, we should still resolve dependencies from the lock file
 | 			// Even when skipping charts, we should still resolve dependencies from the lock file
 | ||||||
| 			// to show the locked versions instead of the version constraints from helmfile.yaml
 | 			// to show the locked versions instead of the version constraints from helmfile.yaml
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue