// Reload the chart with the updated Chart.lock file.
ifchartRequested,err=loader.Load(cp);err!=nil{
returnnil,fmt.Errorf("failed reloading chart after repo update: %w",err)
}
}else{
if!client.DependencyUpdate{
returnnil,fmt.Errorf("an error occurred while checking for chart dependencies. You may need to run 'helm dependency build' to fetch missing dependencies: %w",err)
}
man:=&downloader.Manager{
Out:out,
ChartPath:cp,
Keyring:client.Keyring,
SkipUpdate:false,
Getters:p,
RepositoryConfig:settings.RepositoryConfig,
RepositoryCache:settings.RepositoryCache,
ContentCache:settings.ContentCache,
Debug:settings.Debug,
RegistryClient:client.GetRegistryClient(),
}
iferr:=man.Update();err!=nil{
returnnil,err
}
// Reload the chart with the updated Chart.lock file.
ifchartRequested,err=loader.Load(cp);err!=nil{
returnnil,fmt.Errorf("failed reloading chart after repo update: %w",err)
err=fmt.Errorf("an error occurred while checking for chart dependencies. You may need to run 'helm dependency build' to fetch missing dependencies: %w",err)
ifclient.DependencyUpdate{
man:=&downloader.Manager{
Out:out,
ChartPath:chartPath,
Keyring:client.Keyring,
SkipUpdate:false,
Getters:p,
RepositoryConfig:settings.RepositoryConfig,
RepositoryCache:settings.RepositoryCache,
ContentCache:settings.ContentCache,
Debug:settings.Debug,
}
iferr:=man.Update();err!=nil{
returnerr
}
// Reload the chart with the updated Chart.lock file.
ifch,err=loader.Load(chartPath);err!=nil{
returnfmt.Errorf("failed reloading chart after repo update: %w",err)
}
}else{
if!client.DependencyUpdate{
returnerr
}
man:=&downloader.Manager{
Out:out,
ChartPath:chartPath,
Keyring:client.Keyring,
SkipUpdate:false,
Getters:p,
RepositoryConfig:settings.RepositoryConfig,
RepositoryCache:settings.RepositoryCache,
ContentCache:settings.ContentCache,
Debug:settings.Debug,
}
iferr:=man.Update();err!=nil{
returnerr
}
// Reload the chart with the updated Chart.lock file.
ifch,err=loader.Load(chartPath);err!=nil{
returnfmt.Errorf("failed reloading chart after repo update: %w",err)
returnerrors.New("the lock file (Chart.lock) is out of sync with the dependencies file (Chart.yaml). Please update the dependencies with 'helm dependency update'")
}
// If lock digest differs and chart is apiVersion v1, it maybe because the lock was built
// with Helm 2 and therefore should be checked with Helm v2 hash
log.Println("warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...")
ifv2Sum!=lock.Digest{
returnerrors.New("the lock file (requirements.lock) is out of sync with the dependencies file (requirements.yaml). Please update the dependencies")
}
}else{
returnerrors.New("the lock file (Chart.lock) is out of sync with the dependencies file (Chart.yaml). Please update the dependencies with 'helm dependency update'")
log.Println("warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...")
ifv2Sum!=lock.Digest{
returnerrors.New("the lock file (requirements.lock) is out of sync with the dependencies file (requirements.yaml). Please update the dependencies")