@@ -7,12 +7,14 @@ import (
7
7
"context"
8
8
"errors"
9
9
"fmt"
10
+ "github.com/zarf-dev/zarf/src/pkg/logger"
10
11
"io"
11
12
"net/http"
12
13
"net/url"
13
14
"os"
14
15
"path/filepath"
15
16
"strings"
17
+ "time"
16
18
17
19
"github.com/defenseunicorns/pkg/helpers/v2"
18
20
"github.com/defenseunicorns/pkg/oci"
@@ -31,6 +33,8 @@ import (
31
33
32
34
// Pull fetches the Zarf package from the given sources.
33
35
func Pull (ctx context.Context , src , dir , shasum string , filter filters.ComponentFilterStrategy , publicKeyPath string , skipSignatureValidation bool ) error {
36
+ l := logger .From (ctx )
37
+ start := time .Now ()
34
38
u , err := url .Parse (src )
35
39
if err != nil {
36
40
return err
@@ -52,11 +56,13 @@ func Pull(ctx context.Context, src, dir, shasum string, filter filters.Component
52
56
isPartial := false
53
57
switch u .Scheme {
54
58
case "oci" :
59
+ l .Info ("starting pull from oci source" , "src" , src , "digest" , shasum )
55
60
isPartial , tmpPath , err = pullOCI (ctx , src , tmpDir , shasum , filter )
56
61
if err != nil {
57
62
return err
58
63
}
59
64
case "http" , "https" :
65
+ l .Info ("starting pull from http(s) source" , "src" , src , "digest" , shasum )
60
66
tmpPath , err = pullHTTP (ctx , src , tmpDir , shasum )
61
67
if err != nil {
62
68
return err
@@ -99,6 +105,8 @@ func Pull(ctx context.Context, src, dir, shasum string, filter filters.Component
99
105
if err != nil {
100
106
return err
101
107
}
108
+
109
+ l .Debug ("done packager2.Pull" , "src" , src , "dir" , dir , "duration" , time .Since (start ))
102
110
return nil
103
111
}
104
112
@@ -112,13 +120,14 @@ func pullOCI(ctx context.Context, src, tarDir, shasum string, filter filters.Com
112
120
src = fmt .Sprintf ("%s@sha256:%s" , src , shasum )
113
121
}
114
122
arch := config .GetArch ()
115
- remote , err := zoci .NewRemote (ctx , src , oci .PlatformForArch (arch ))
123
+ platform := oci .PlatformForArch (arch )
124
+ remote , err := zoci .NewRemote (ctx , src , platform )
116
125
if err != nil {
117
126
return false , "" , err
118
127
}
119
128
desc , err := remote .ResolveRoot (ctx )
120
129
if err != nil {
121
- return false , "" , fmt .Errorf ("could not fetch images index : %w" , err )
130
+ return false , "" , fmt .Errorf ("could not find package %s with architecture %s : %w" , src , platform . Architecture , err )
122
131
}
123
132
layersToPull := []ocispec.Descriptor {}
124
133
isPartial := false
0 commit comments