working commit
This commit is contained in:
@@ -43,24 +43,25 @@ func (util *ImageUtil) imageManifest(common *CommonImageParams, params *ImageMan
|
||||
Index: &ocispec.Index{},
|
||||
Manifest: &ocispec.Manifest{},
|
||||
}
|
||||
params.Imagepath, err = packUserinfo(params.Imagepath, common.Username, common.Password)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
timeout := time.Duration(common.Timeout) * time.Second
|
||||
ctx, _ := context.WithTimeout(context.Background(), timeout)
|
||||
ref, err := repocli.NewReferer(params.Imagepath)
|
||||
if err != nil {
|
||||
return res, err
|
||||
}
|
||||
|
||||
ref.SetUserinfo(common.Username, common.Password)
|
||||
mw := repocli.NewBasicAuthMiddleware(ref.Userinfo())
|
||||
cli := repocli.NewClient(nil, mw)
|
||||
exists, mime, man, _, err := cli.GetRawManifest(ctx, ref.RawRepo())
|
||||
if !exists {
|
||||
err = fmt.Errorf("Manifest not found")
|
||||
accepts := []string{
|
||||
repocli.MediaTypeDDMLv2,
|
||||
repocli.MediaTypeDDMv2,
|
||||
repocli.MediaTypeOIMv1,
|
||||
repocli.MediaTypeOIIv1,
|
||||
}
|
||||
_, mime, man, _, err := cli.GetRawManifest(ctx, ref.Raw(), accepts)
|
||||
if err != nil {
|
||||
return res, err
|
||||
|
||||
}
|
||||
switch mime {
|
||||
case repocli.MediaTypeDDMLv2, repocli.MediaTypeOIIv1:
|
||||
|
||||
Reference in New Issue
Block a user