@@ -71,7 +71,7 @@ const (
7171
7272var (
7373 // Defines the default version to be used for the provider CR if no version is specified in the tilt-provider.yaml|json file.
74- defaultVersion = "v1.4.99"
74+ defaultProviderVersion = "v1.4.99"
7575
7676 // This data struct mirrors a subset of info from the providers struct in the tilt file
7777 // which is containing "hard-coded" tilt-provider.yaml files for the providers managed in the Cluster API repository.
@@ -293,8 +293,13 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error {
293293
294294 // Add read configurations from provider repos
295295 for _ , p := range ts .ProviderRepos {
296- if err := loadTiltProvider (p ); err != nil {
297- return errors .Wrapf (err , "failed to load tile-provider.yaml/json from %s" , p )
296+ tiltProviderConfigs , err := loadTiltProvider (p )
297+ if err != nil {
298+ return errors .Wrapf (err , "failed to load tilt-provider.yaml/json from %s" , p )
299+ }
300+
301+ for name , config := range tiltProviderConfigs {
302+ providers [name ] = config
298303 }
299304 }
300305
@@ -320,26 +325,27 @@ func tiltResources(ctx context.Context, ts *tiltSettings) error {
320325 return runTaskGroup (ctx , "resources" , tasks )
321326}
322327
323- func loadTiltProvider (providerRepository string ) error {
328+ func loadTiltProvider (providerRepository string ) ( map [ string ] tiltProviderConfig , error ) {
324329 tiltProviders , err := readTiltProvider (providerRepository )
325330 if err != nil {
326- return err
331+ return nil , err
327332 }
328333
334+ ret := make (map [string ]tiltProviderConfig )
329335 for _ , p := range tiltProviders {
330336 if p .Config == nil {
331- return errors .Errorf ("tilt-provider.yaml/json file from %s does not contain a config section for provider %s" , providerRepository , p .Name )
337+ return nil , errors .Errorf ("tilt-provider.yaml/json file from %s does not contain a config section for provider %s" , providerRepository , p .Name )
332338 }
333339
334340 // Resolving context, that is a relative path to the repository where the tilt-provider is defined
335341 contextPath := filepath .Join (providerRepository , pointer .StringDeref (p .Config .Context , "." ))
336342
337- providers [p .Name ] = tiltProviderConfig {
343+ ret [p .Name ] = tiltProviderConfig {
338344 Context : & contextPath ,
339345 Version : p .Config .Version ,
340346 }
341347 }
342- return nil
348+ return ret , nil
343349}
344350
345351func readTiltProvider (path string ) ([]tiltProvider , error ) {
@@ -947,7 +953,7 @@ func getProviderObj(version *string) func(prefix string, objs []unstructured.Uns
947953 },
948954 ProviderName : providerName ,
949955 Type : providerType ,
950- Version : pointer .StringDeref (version , defaultVersion ),
956+ Version : pointer .StringDeref (version , defaultProviderVersion ),
951957 }
952958
953959 providerObj := & unstructured.Unstructured {}
0 commit comments