File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ import (
2323 "os"
2424 "path/filepath"
2525 "strings"
26+ "sync"
2627
2728 "github.com/Masterminds/semver/v3"
2829 securejoin "github.com/cyphar/filepath-securejoin"
@@ -57,6 +58,8 @@ type DependencyManager struct {
5758 // Dependencies contains a list of dependencies, and the respective
5859 // repository the dependency can be found at.
5960 Dependencies []* DependencyWithRepository
61+
62+ mu sync.Mutex
6063}
6164
6265// Build compiles and builds the dependencies of the Chart.
@@ -66,7 +69,8 @@ func (dm *DependencyManager) Build(ctx context.Context) error {
6669 }
6770
6871 errs , ctx := errgroup .WithContext (ctx )
69- for _ , item := range dm .Dependencies {
72+ for _ , i := range dm .Dependencies {
73+ item := i
7074 errs .Go (func () error {
7175 select {
7276 case <- ctx .Done ():
@@ -123,7 +127,10 @@ func (dm *DependencyManager) addLocalDependency(dpr *DependencyWithRepository) e
123127 return err
124128 }
125129
130+ dm .mu .Lock ()
126131 dm .Chart .AddDependency (ch )
132+ dm .mu .Unlock ()
133+
127134 return nil
128135}
129136
@@ -147,7 +154,10 @@ func (dm *DependencyManager) addRemoteDependency(dpr *DependencyWithRepository)
147154 return err
148155 }
149156
157+ dm .mu .Lock ()
150158 dm .Chart .AddDependency (ch )
159+ dm .mu .Unlock ()
160+
151161 return nil
152162}
153163
You can’t perform that action at this time.
0 commit comments