Skip to content

Commit 4137114

Browse files
committed
fix: handle optional config in S3 sync function
1 parent 4d1ca99 commit 4137114

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

internal/sync/s3.go

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -82,25 +82,23 @@ func pushS3WithSession(ctx context.Context, s3Session *s3.S3, bucket *string, im
8282
}
8383

8484
cnf, err := i.RawConfigFile()
85-
if err != nil {
86-
return err
87-
}
88-
89-
cnfHash, err := i.ConfigName()
90-
if err != nil {
91-
return err
92-
}
93-
94-
if err := syncObject(
95-
ctx,
96-
s3Session,
97-
bucket,
98-
filepath.Join(baseDir, "blobs", cnfHash.String()),
99-
acl,
100-
aws.String("application/vnd.docker.container.image.v1+json"),
101-
cnf,
102-
); err != nil {
103-
return err
85+
// Config is optional, so we don't return an error if it's not found.
86+
if err == nil {
87+
cnfHash, err := i.ConfigName()
88+
if err == nil {
89+
90+
if err := syncObject(
91+
ctx,
92+
s3Session,
93+
bucket,
94+
filepath.Join(baseDir, "blobs", cnfHash.String()),
95+
acl,
96+
aws.String("application/vnd.docker.container.image.v1+json"),
97+
cnf,
98+
); err != nil {
99+
return err
100+
}
101+
}
104102
}
105103

106104
l, err := i.Layers()

0 commit comments

Comments
 (0)