Add helm add repo synchonously to avoid race conditions with multiple repositories
This commit is contained in:
		
							parent
							
								
									8f607b0da7
								
							
						
					
					
						commit
						72eaa2fb62
					
				|  | @ -124,19 +124,13 @@ func (state *HelmState) applyDefaultsTo(spec ReleaseSpec) ReleaseSpec { | |||
| } | ||||
| 
 | ||||
| func (state *HelmState) SyncRepos(helm helmexec.Interface) []error { | ||||
| 	var wg sync.WaitGroup | ||||
| 	errs := []error{} | ||||
| 
 | ||||
| 	for _, repo := range state.Repositories { | ||||
| 		wg.Add(1) | ||||
| 		go func(wg *sync.WaitGroup, name, url string) { | ||||
| 			if err := helm.AddRepo(name, url); err != nil { | ||||
| 		if err := helm.AddRepo(repo.Name, repo.URL); err != nil { | ||||
| 			errs = append(errs, err) | ||||
| 		} | ||||
| 			wg.Done() | ||||
| 		}(&wg, repo.Name, repo.URL) | ||||
| 	} | ||||
| 	wg.Wait() | ||||
| 
 | ||||
| 	if len(errs) != 0 { | ||||
| 		return errs | ||||
|  | @ -157,6 +151,7 @@ func (state *HelmState) SyncReleases(helm helmexec.Interface, additonalValues [] | |||
| 	if workerLimit < 1 { | ||||
| 		workerLimit = len(state.Releases) | ||||
| 	} | ||||
| 
 | ||||
| 	for w := 1; w <= workerLimit; w++ { | ||||
| 		go func() { | ||||
| 			for release := range jobQueue { | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue