Skip to content
Permalink
Browse files
fix(helm): fix 'error preparing chart dependencies... file exists'
Error may occur when concurrent processes fulfill cache directory.

Fixed by additional check of directory existance after lock has been acquired.

Signed-off-by: Timofey Kirillov <timofey.kirillov@flant.com>
  • Loading branch information
distorhead committed May 31, 2022
1 parent 5992f96 commit 3f32bf08125daac73fbc5905f726976e3b814d04
Showing 1 changed file with 9 additions and 0 deletions.
@@ -74,6 +74,15 @@ func GetPreparedChartDependenciesDir(ctx context.Context, metadataFile, metadata
}
defer werf.ReleaseHostLock(lock)

switch _, err := os.Stat(depsDir); {
case os.IsNotExist(err):
case err != nil:
return fmt.Errorf("error accessing %s: %w", depsDir, err)
default:
// at the time we have acquired a lock the target directory was created
return nil
}

tmpDepsDir := fmt.Sprintf("%s.tmp.%s", depsDir, uuid.NewV4().String())

buildChartDependenciesOpts.LoadOptions = &loader.LoadOptions{

0 comments on commit 3f32bf0

Please sign in to comment.