parent
7bfb58c0e4
commit
30155d8742
|
|
@ -278,10 +278,15 @@ func (state *HelmState) SyncReleases(helm helmexec.Interface, additionalValues [
|
||||||
// downloadCharts will download and untar charts for Lint and Template
|
// downloadCharts will download and untar charts for Lint and Template
|
||||||
func (state *HelmState) downloadCharts(helm helmexec.Interface, dir string, workerLimit int) (map[string]string, []error) {
|
func (state *HelmState) downloadCharts(helm helmexec.Interface, dir string, workerLimit int) (map[string]string, []error) {
|
||||||
temp := make(map[string]string, len(state.Releases))
|
temp := make(map[string]string, len(state.Releases))
|
||||||
|
type downloadResults struct {
|
||||||
|
releaseName string
|
||||||
|
chartPath string
|
||||||
|
}
|
||||||
errs := []error{}
|
errs := []error{}
|
||||||
|
|
||||||
var wgFetch sync.WaitGroup
|
var wgFetch sync.WaitGroup
|
||||||
jobQueue := make(chan *ReleaseSpec, len(state.Releases))
|
jobQueue := make(chan *ReleaseSpec, len(state.Releases))
|
||||||
|
results := make(chan *downloadResults, len(state.Releases))
|
||||||
wgFetch.Add(len(state.Releases))
|
wgFetch.Add(len(state.Releases))
|
||||||
|
|
||||||
if workerLimit < 1 {
|
if workerLimit < 1 {
|
||||||
|
|
@ -312,7 +317,7 @@ func (state *HelmState) downloadCharts(helm helmexec.Interface, dir string, work
|
||||||
}
|
}
|
||||||
chartPath = path.Join(chartPath, chartNameWithoutRepository(release.Chart))
|
chartPath = path.Join(chartPath, chartNameWithoutRepository(release.Chart))
|
||||||
}
|
}
|
||||||
temp[release.Name] = chartPath
|
results <- &downloadResults{release.Name, chartPath}
|
||||||
wgFetch.Done()
|
wgFetch.Done()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
@ -320,8 +325,13 @@ func (state *HelmState) downloadCharts(helm helmexec.Interface, dir string, work
|
||||||
for i := 0; i < len(state.Releases); i++ {
|
for i := 0; i < len(state.Releases); i++ {
|
||||||
jobQueue <- &state.Releases[i]
|
jobQueue <- &state.Releases[i]
|
||||||
}
|
}
|
||||||
|
|
||||||
close(jobQueue)
|
close(jobQueue)
|
||||||
|
|
||||||
|
for i := 0; i < len(state.Releases); i++ {
|
||||||
|
downloadRes := <-results
|
||||||
|
temp[downloadRes.releaseName] = downloadRes.chartPath
|
||||||
|
}
|
||||||
|
|
||||||
wgFetch.Wait()
|
wgFetch.Wait()
|
||||||
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue