retina icon indicating copy to clipboard operation
retina copied to clipboard

feat(capture download): Add ability to download capture files based on capture name

Open kamilprz opened this issue 7 months ago • 1 comments

Description

This PR introduces the ability to download captures via the Retina CLI.

It extends the retina capture download cmd to be able to download captures based on the capture name / blobURL.

This enables the manual download of captures which occur after this PR.

  • This is because in order to make retrospective downloads possible, the download pods are now annotated with some metadata. Captures prior to this PR won't have this metadata, and it won't be possible to download them.

Change list:

  • Update retina capture list to be more readable.
  • Change BlobURL download to be a flag --blobUrl rather than an ENV variable.
    • This makes it more consistent with the rest of the CLI.
  • Add annotations to capture pods to store metadata about the capture.
  • Download capture file from host node by passing name of capture which created the file.
    • By default, creates a folder in the current directory based on the name of the capture, which will contain the tarball.
    • Can set the output directory. (-o)
      • Example: retina capture download --name download-me -o /tmp/retina/

Related Issue

N/A

Checklist

  • [x] I have read the contributing documentation.
  • [x] I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • [x] I have correctly attributed the author(s) of the code.
  • [x] I have tested the changes locally.
  • [x] I have followed the project's style guidelines.
  • [x] I have updated the documentation, if necessary.
  • [x] I have added tests, if applicable.

Screenshots

Examples and flags documentation

{50A67E84-9D0C-49ED-997B-1C594C2C646E}

k retina capture list

After {447597F0-3512-4F12-96C2-09DB0D66A210}

Before {83B47868-B31C-4A7D-8FDF-2F3BEFDAB1F9}

Downloading a capture based on the capture name

{3CC49A7E-9A7D-45C4-B7E0-C9DCB092B1C0}

{C3B0F8E1-5037-4EDC-9E07-A6530A621B05}

kamilprz avatar Apr 28 '25 11:04 kamilprz

Decided in the end to leave extract functionality out of this PR and focus solely on getting the download operation to work consistently and reliably. Will add it back in another PR later down the line.

kamilprz avatar May 13 '25 17:05 kamilprz

in the unhappy path, if a capture isn't started, or has problem, download fails silently, let's give some feedback

$ ./bin/kubectl-retina capture list
NAMESPACE   CAPTURE NAME     JOB                    COMPLETIONS   AGE
default     retina-capture   retina-capture-8dl8v   0/1   

$ ./bin/kubectl-retina capture download retina-capture

this also seems to be the case just calling

$ ./bin/kubectl-retina capture download 

matmerr avatar Jun 05 '25 20:06 matmerr

in the unhappy path, if a capture isn't started, or has problem, download fails silently, let's give some feedback

$ ./bin/kubectl-retina capture list
NAMESPACE   CAPTURE NAME     JOB                    COMPLETIONS   AGE
default     retina-capture   retina-capture-8dl8v   0/1   

$ ./bin/kubectl-retina capture download retina-capture

this also seems to be the case just calling

$ ./bin/kubectl-retina capture download 

Added validation of --name or --blob-url as one of them is required:

$ ./artifacts/kubectl-retina capture download
Error: either --name or --blob-url must be specified
Usage:
  kubectl-retina capture download [flags]

Examples:
  # List Retina capture jobs
  kubectl retina capture list

  # Download the capture file(s) created using the capture name
  kubectl retina capture download --name <capture-name>

  # Download the capture file(s) created using the capture name and define output location
  kubectl retina capture download --name <capture-name> -o <output-location>

alexcastilio avatar Jun 06 '25 15:06 alexcastilio