Skip to content

[6.0] Fix cache not cleaned up if download fails #7671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 19, 2024

Conversation

MaxDesiatov
Copy link
Contributor

Cherry-pick of #7663.

Explanation: If a server returns an error when trying to download a binaryTarget an invalid file remains in the artifacts cache.
Scope: Isolated to binary targets cache.
Risk: Low, scope is isolated, and the change has a corresponding test.
Testing: Automated with an existing test case refined.
Issue: rdar://123897276
Reviewer: @MaxDesiatov

If the download of a binaryTarget fails a cache file still remains in
the artifact cache.

The file only contains the server's response which is usually the status
code and the error message.

All following resolve calls therefore fail because the cached file is
used but is an invalid archive

(cherry picked from commit ee48da5)
(cherry picked from commit 809c405)
@MaxDesiatov MaxDesiatov added bug swift 6.0 Related to Swift 6.0 release branch labels Jun 17, 2024
@MaxDesiatov MaxDesiatov requested a review from a team as a code owner June 17, 2024 12:29
@MaxDesiatov MaxDesiatov removed their assignment Jun 17, 2024
@MaxDesiatov MaxDesiatov changed the title Fix/cleanup cache on failure 6.0 [6.0] Fix: cache not cleaned up if download fails Jun 17, 2024
@MaxDesiatov MaxDesiatov changed the title [6.0] Fix: cache not cleaned up if download fails [6.0] Fix cache not cleaned up if download fails Jun 17, 2024
@MaxDesiatov
Copy link
Contributor Author

@swift-ci test

@@ -618,6 +618,9 @@ extension Workspace {
progress: progress,
completion: { result in
self.delegate?.willDownloadBinaryArtifact(from: artifact.url.absoluteString, fromCache: false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it already downloaded at this point?

@MaxDesiatov MaxDesiatov merged commit 3b5474a into release/6.0 Jun 19, 2024
5 checks passed
@MaxDesiatov MaxDesiatov deleted the fix/cleanup-cache-on-failure-6.0 branch June 19, 2024 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug swift 6.0 Related to Swift 6.0 release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants