@@ -16,7 +16,6 @@ import (
16
16
"github.com/rs/zerolog/log"
17
17
"go.opentelemetry.io/otel/attribute"
18
18
"go.opentelemetry.io/otel/metric"
19
- "golang.org/x/sync/errgroup"
20
19
)
21
20
22
21
func checkRateLimit (err error ) error {
@@ -99,7 +98,7 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
99
98
100
99
pullAuth , pullAuthName := getAuth (image .GetSourceRegistry (), image .GetSourceRepository ())
101
100
102
- puller , err := remote .NewPuller (pullAuth )
101
+ srcPuller , err := remote .NewPuller (pullAuth )
103
102
if err != nil {
104
103
return err
105
104
}
@@ -109,7 +108,7 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
109
108
return err
110
109
}
111
110
112
- srcLister , err := puller .Lister (ctx , srcRepo )
111
+ srcLister , err := srcPuller .Lister (ctx , srcRepo )
113
112
if err != nil {
114
113
return err
115
114
}
@@ -185,9 +184,6 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
185
184
186
185
// Sync tags
187
186
for _ , tag := range srcTags {
188
- g , ctx := errgroup .WithContext (ctx )
189
- g .SetLimit (config .SyncMaxErrors .Int ())
190
-
191
187
log .Info ().
192
188
Str ("image" , image .Source ).
193
189
Str ("tag" , tag ).
@@ -197,29 +193,27 @@ func SyncImage(ctx context.Context, image *structs.Image) error {
197
193
if err := func () error {
198
194
tag := tag
199
195
200
- desc , err := pull (ctx , puller , image , tag )
196
+ desc , err := pull (ctx , srcPuller , image , tag )
201
197
if err != nil {
202
198
return err
203
199
}
204
200
205
201
for _ , dst := range image .Targets {
206
- g .Go (func () error {
207
- if slices .Contains (dstTags , fmt .Sprintf ("%s:%s" , dst , tag )) {
208
- log .Info ().
209
- Str ("image" , image .Source ).
210
- Str ("tag" , tag ).
211
- Str ("target" , dst ).
212
- Msg ("Tag already exists, skipping" )
213
- return nil
214
- }
215
- if err := push (ctx , image , desc , dst , tag ); err != nil {
216
- log .Error ().Err (err ).Msg ("Failed to push tag" )
217
- }
218
- return err
219
- })
202
+ if slices .Contains (dstTags , fmt .Sprintf ("%s:%s" , dst , tag )) {
203
+ log .Info ().
204
+ Str ("image" , image .Source ).
205
+ Str ("tag" , tag ).
206
+ Str ("target" , dst ).
207
+ Msg ("Tag already exists, skipping" )
208
+ return nil
209
+ }
210
+ if err := push (ctx , image , desc , dst , tag ); err != nil {
211
+ log .Error ().Err (err ).Msg ("Failed to push tag" )
212
+ }
213
+ return err
220
214
}
221
215
222
- return g . Wait ()
216
+ return nil
223
217
}(); err != nil {
224
218
log .Error ().
225
219
Err (err ).
0 commit comments