Skip to content

Commit 22aba94

Browse files
committed
WIP
Signed-off-by: Austin Abro <austinabro321@gmail.com>
1 parent c7b7c74 commit 22aba94

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

examples/dos-games/zarf.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ components:
1515
- manifests/service.yaml
1616
images:
1717
- ghcr.io/zarf-dev/doom-game:0.0.1
18+
files:
19+
- source: 2gb.bin
20+
target: file.data
1821

1922
# YAML keys starting with `x-` are custom keys that are ignored by the Zarf CLI
2023
# The `x-mdx` key is used to render the markdown content for https://docs.zarf.dev/ref/examples

src/pkg/packager/load/import.go

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ func compatibleComponent(c v1alpha1.ZarfComponent, arch, flavor string) bool {
212212
}
213213

214214
// TODO (phillebaba): Refactor package structure so that pullOCI can be used instead.
215-
func fetchOCISkeleton(ctx context.Context, component v1alpha1.ZarfComponent, packagePath string, cachePath string) (string, error) {
215+
func fetchOCISkeleton(ctx context.Context, component v1alpha1.ZarfComponent, packagePath string, cachePath string) (_ string, err error) {
216216
if component.Import.URL == "" {
217217
return component.Import.Path, nil
218218
}
@@ -255,11 +255,18 @@ func fetchOCISkeleton(ctx context.Context, component v1alpha1.ZarfComponent, pac
255255
if err != nil {
256256
return "", err
257257
}
258-
defer os.RemoveAll(tempDir)
258+
defer func() {
259+
err = errors.Join(err, os.RemoveAll(tempDir))
260+
}()
259261
// FIXME: once oci PR is merged this is unnecessary
260-
if err := os.Mkdir(filepath.Join(tempDir, "components"), helpers.ReadWriteExecuteUser); err != nil {
261-
return "", err
262-
}
262+
// if err := os.Mkdir(filepath.Join(tempDir, "components"), helpers.ReadWriteExecuteUser); err != nil {
263+
// return "", err
264+
// }
265+
// Annotation titles generally look like 'components/component-name.tar'
266+
267+
// The problem is we still essentially need the cache as a place to put the skeleton image
268+
// The only other way would be to store it in a temp directory then when cleaning up after the package is finished we delete that temp directory
269+
fmt.Println("this is the digest", componentDesc.Digest.Encoded())
263270
tarball = filepath.Join(tempDir, componentDesc.Annotations[ocispec.AnnotationTitle])
264271
dir = filepath.Join(cache, "dirs", componentDesc.Digest.Encoded())
265272
err = remote.PullPath(ctx, tempDir, componentDesc)

0 commit comments

Comments
 (0)