Commit graph

6 commits

Author SHA1 Message Date
Orgad Shaneh
3575c04de7 fix(downloader): prevent concurrent file access errors on Windows
When DownloadTo runs in parallel for the same ref and version, both
processes try to write the same target file, causing "Access Denied"
errors on Windows.

This change refactors the file locking mechanism based on maintainer
feedback:
- Add LockedAtomicWriteFile to internal/fileutil package to encapsulate
  locking logic
- Use the new function for both chart and provenance files
- Lock is cross-process safe and automatically released on process exit
- Files are only written if they don't already exist (avoiding
  duplicate work)

The TestParallelDownloadTo test verifies the fix works correctly.

Fixes #31633

Signed-off-by: Orgad Shaneh <orgad.shaneh@audiocodes.com>
2026-01-25 11:42:19 +02:00
Mile Druzijanic
934b4550d9 improve fileutil test coverage
Signed-off-by: Mile Druzijanic <zedsprogramms@gmail.com>
2025-09-12 20:46:28 +02:00
Matt Farina
2236294119 Updating to helm.sh/helm/v4
Since Helm is going through breaking changes with Helm v4, the version path to
Helm needs to be updated.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2024-12-26 16:33:51 -05:00
Matt Farina
4e7e939f19
Updating the Go version in go.mod
At this time both Go 1.19 and 1.20 are supported. The version
specified in the go.mod file is the minimum version we expect Helm
to be compiled against. This is the oldest supported version to
support environments where others compile Helm. The Helm project
is using Go 1.20 to build Helm itself.

Updating to Go 1.19 also includes dealing with io/ioutil
deprecation and some additional linting issues around staticcheck.
All the staticcheck issues were in test files so linting was
skipped for those.

Signed-off-by: Matt Farina <matt.farina@suse.com>
2023-03-22 11:52:30 -04:00
Eng Zer Jun
2e3e22a003
test: use T.TempDir to create temporary test directory
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-12 13:54:54 +08:00
Raphaël
984d2ac767
fix: write index.yaml file atomically (#7954)
* fix: write index.yaml file atomically

This refactors the already-existing `AtomicWriteFile` utility
to a central location and uses it to write index files
atomically.
This is done to avoid having half-written index files break
client requests.

Drive-bys:
  - Add test for AtomicWriteFile.
  - Add test IndexFile.WriteFile.
Signed-off-by: rabadin <rvbadin@gmail.com>

* Review fix: use RenameWithFallback instead of os.Rename

Signed-off-by: rabadin <rvbadin@gmail.com>

Co-authored-by: rabadin <rvbadin@gmail.com>
2020-04-24 15:03:47 -06:00