Skip to content
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

oras support for tempfile cleanups and partial artifacts cleanup #1400

Open
1 task
nileshpatra opened this issue Jun 7, 2024 · 8 comments
Open
1 task
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@nileshpatra
Copy link

What is the version of your ORAS CLI

1.2.0

What would you like to be added?

I could not find it anywhere written in the docs if oras pull cleans up the output directory or tempfiles in case oras pull is unsuccessful due to for instance poor network connection.

Why is this needed for ORAS?

If this feature is not already present, it'd be good for oras to cleanup things in an intermediate state in order to start downloading again, or at least it should give such an option to enable.

Are you willing to submit PRs to contribute to this feature?

  • Yes, I am willing to implement it.
@nileshpatra nileshpatra added enhancement New feature or request triage New issues or PRs to be acknowledged by maintainers labels Jun 7, 2024
@nileshpatra
Copy link
Author

If I do not initialize ORAS_CACHE and try to pull in to an output dir and if I cancel the context, oras seems to now download partial thing and clean it up. So it seems oras seems to already manage partial downloads, is it?

I need to use it in a script and hence need to know if handling it is needed.

/cc: @qweeah

@sajayantony sajayantony added the question Further information is requested label Jun 10, 2024
@qweeah
Copy link
Contributor

qweeah commented Jun 11, 2024

@nileshpatra Thanks for the valuable feedback!

Firstly, the user experience of oras pull is like cp commands: if a copy process is aborted halfway, then copied files in the destination folder will not be cleaned.

Secondly, you can set up the ORAS_CACHE variable to use a folder as a temporary cache for storing the files in a content-addressable way. But by design, ORAS CLI is not responsible for cleaning that folder.

@qweeah
Copy link
Contributor

qweeah commented Jun 11, 2024

it'd be good for oras to cleanup things in an intermediate state in order to start downloading again

IMHO, to speed up re-pull, ORAS doesn't need to cleanup things. The right thing to do is checking the existence of a to-be-pulled file and skip it if an identical copy is already there.

@qweeah qweeah removed the triage New issues or PRs to be acknowledged by maintainers label Jun 11, 2024
@nileshpatra
Copy link
Author

nileshpatra commented Jun 11, 2024 via email

@nileshpatra
Copy link
Author

nileshpatra commented Jun 11, 2024 via email

@qweeah
Copy link
Contributor

qweeah commented Jun 11, 2024

Correct, but what if the downloaded files are partially downloaded, i.e. the
entire artifact isn't present?

  1. One artifact can contain more than one file
  2. If a file is partially downloaded, the checksum won't match the layer digest and thus won't be recognized as existed file

@qweeah
Copy link
Contributor

qweeah commented Jun 11, 2024

If I understand correctly, oras pull will try to download the artifacts and manifests and if aborted, the downloaded stuff will not be cleaned, correct?

Yes.

Right. Does it "copy" things from any place to another place even if there's no cache setup?

If there is no cache setup, there is no partial file created in the local file system.

@qweeah qweeah added this to the future milestone Jun 18, 2024
@qweeah
Copy link
Contributor

qweeah commented Jun 18, 2024

As is mentioned in oras-project/oras-go#777, the performance of oras pull can be optimized if oras-go can skip copying existed file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants