zarf-dev / zarf

DevSecOps for Air Gap & Limited-Connection Systems. https://zarf.dev/
Apache License 2.0
1.41k stars 171 forks source link

Investigate / refactor `LayersFromRequestedComponents` flow #2097

Open Racer159 opened 1 year ago

Racer159 commented 1 year ago

Describe what should be investigated or refactored

Currently the LayersFromRequestedComponents flow is not well tested and brittle as it is used in a single location only under certain conditions. This should minimally be wrapped with unit tests, though ideally the flow should be redesigned to use more common code and allow for better calculation of what resources need to be pulled.

Links to any relevant code

https://github.com/defenseunicorns/zarf/blob/7cc12011f863d48168202a4a4e2fb60e501cb560/src/pkg/oci/pull.go#L80

Additional context

This came up during the fixing of a related bug (#2087 ) / change to the way image annotations are handled and may also lead into a simplification of the oci package as well.

Racer159 commented 1 year ago

During this issue we may also want to revisit https://github.com/defenseunicorns/zarf/pull/2077 to make re-signing copied OCI packages more efficient.