image: fixed tags, catalog, push operation

This commit is contained in:
2026-03-11 21:02:10 +02:00
parent a064d942e7
commit 0d67944966
9 changed files with 25 additions and 18 deletions
+4 -4
View File
@@ -1,10 +1,10 @@
package config
const (
confdir = "/usr/local/etc/mstore"
rundir = "/var/run/mstore"
logdir = "/var/log/mstore"
datadir = "/var/data/mstore"
confdir = "/home/ziggi/Projects/mstore/etc/mstore"
rundir = "/home/ziggi/Projects/mstore/tmp/run"
logdir = "/home/ziggi/Projects/mstore/tmp/log"
datadir = "/home/ziggi/Projects/mstore/tmp/data"
version = "0.2.0"
srvname = "mstored"
)
+2 -1
View File
@@ -237,5 +237,6 @@ func (hand *Handler) ListManifests(rctx *router.Context) {
if err != nil {
hand.logg.Errorf("ListManifests error: %v", err)
}
rctx.SendJSON(code, res)
rctx.SendJSON(code, res.Repositories)
}
+3 -3
View File
@@ -95,6 +95,9 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
return res, code, err
}
inMan := &ocispec.Manifest{}
inMan.Subject = &ocispec.Descriptor{}
inMan.Subject.Platform = &ocispec.Platform{}
err = json.Unmarshal(inManData, inMan)
if err != nil {
err = fmt.Errorf("Manifest parsing error: %v", err)
@@ -107,9 +110,6 @@ func (oper *Operator) PutManifest(ctx context.Context, params *PutManifestParams
name := params.Name
reference := params.Reference
if inMan.Subject == nil {
}
arch := inMan.Subject.Platform.Architecture
os := inMan.Subject.Platform.OS
variant := inMan.Subject.Platform.Variant
+1
View File
@@ -98,6 +98,7 @@ func (svc *Service) Build() error {
svc.rout.Post(`/v2/{name}/blobs/uploads/`, svc.hand.PostUpload)
svc.rout.Patch(`/v2/{name}/blobs/uploads/{reference}`, svc.hand.PatchUpload)
svc.rout.Put(`/v2/{name}/blobs/uploads/{reference}`, svc.hand.PutUpload)
svc.rout.Put(`/v2/{name}/uploads/{reference}`, svc.hand.PutUpload)
svc.rout.Get(`/v2/{name}/blobs/{digest}`, svc.hand.GetBlob)
svc.rout.Delete(`/v2/{name}/blobs/{digest}`, svc.hand.DeleteBlob)
+4 -3
View File
@@ -15,6 +15,7 @@ import (
"github.com/spf13/cobra"
"mstore/pkg/descr"
"mstore/pkg/repocli"
)
@@ -24,7 +25,7 @@ type ImageTagsParams struct {
}
type ImageTagsResult struct {
ImageTags []string `json:"imageTags"`
Tags *descr.Tags `json:"imageTags"`
}
func (util *ImageUtil) ImageTags(cmd *cobra.Command, args []string) {
@@ -36,7 +37,7 @@ func (util *ImageUtil) ImageTags(cmd *cobra.Command, args []string) {
func (util *ImageUtil) imageTags(common *CommonImageParams, params *ImageTagsParams) (*ImageTagsResult, error) {
var err error
res := &ImageTagsResult{
ImageTags: make([]string, 0),
Tags: &descr.Tags{},
}
timeout := time.Duration(common.Timeout) * time.Second
@@ -52,6 +53,6 @@ func (util *ImageUtil) imageTags(common *CommonImageParams, params *ImageTagsPar
if err != nil {
return res, err
}
res.ImageTags = opres
res.Tags = opres
return res, err
}
+1 -1
View File
@@ -20,7 +20,7 @@ func (cli *Client) CreateAccount(ctx context.Context, host, user, pass string) (
if err != nil {
return res, err
}
respdata, err := cli.doHTTPCall(ctx, host, "accont", "create", reqdata)
respdata, err := cli.doHTTPCall(ctx, host, "account", "create", reqdata)
if err != nil {
return res, err
}
+3 -3
View File
@@ -105,11 +105,11 @@ func Unarchive(filename, dstdir string) error {
target = filepath.Clean(target)
fileInfo := header.FileInfo()
switch header.Typeflag {
case tar.TypeDir:
_, err := os.Stat(target)
if err != nil && err == os.ErrNotExist {
if os.IsNotExist(err) {
err = nil
err := os.MkdirAll(target, fileInfo.Mode())
if err != nil {
return err
@@ -122,7 +122,7 @@ func Unarchive(filename, dstdir string) error {
wrapfunc := func() error {
dir := filepath.Dir(target)
_, err := os.Stat(dir)
if err != nil && err == os.ErrNotExist {
if os.IsNotExist(err) {
err := os.MkdirAll(dir, 0750)
if err != nil {
return err
+1 -1
View File
@@ -73,7 +73,7 @@ func (cli *Client) PushImage(ctx context.Context, filepath, imagepath string) er
dstdir := auxtool.MakeTmpFilename(filepath)
err = auxutar.Unarchive(filepath, dstdir)
if err != nil {
os.RemoveAll(dstdir)
//os.RemoveAll(dstdir)
return err
}
image, err := imageLoader(dstdir)
+6 -2
View File
@@ -18,11 +18,15 @@ import (
"fmt"
"net/http"
"strconv"
"mstore/pkg/descr"
)
func (cli *Client) GetTags(ctx context.Context, rawrepo string) ([]string, error) {
func (cli *Client) GetTags(ctx context.Context, rawrepo string) (*descr.Tags, error) {
var err error
list := make([]string, 0)
list := &descr.Tags{
Tags: make([]string, 0),
}
tagdata, err := cli.GetRawTags(ctx, rawrepo)
if err != nil {
return list, err