diff --git a/agent/agent.go b/agent/agent.go index 6e4bd70..b692846 100644 --- a/agent/agent.go +++ b/agent/agent.go @@ -550,7 +550,7 @@ func (c *Agent) waitingQueue(ctx context.Context, msg string, weight int, info * return client.MessageResponse{}, fmt.Errorf("failed to create queue: %w", err) } - if mr.Status == model.StatusPending { + if mr.Status == model.StatusPending || mr.Status == model.StatusProcessing { c.logger.Info("watching message from queue", "msg", msg) chMr, err := c.queueClient.Watch(ctx, mr.MessageID) @@ -586,7 +586,7 @@ func (c *Agent) waitingQueue(ctx context.Context, msg string, weight int, info * case model.StatusFailed: return client.MessageResponse{}, fmt.Errorf("%q Queue Error: %s", msg, mr.Data.Error) default: - return client.MessageResponse{}, fmt.Errorf("unexpected status %q for message %q", mr.Status, msg) + return client.MessageResponse{}, fmt.Errorf("unexpected status %d for message %q", mr.Status, msg) } } diff --git a/cache/cache_manifest.go b/cache/cache_manifest.go index a12db97..c6bc629 100644 --- a/cache/cache_manifest.go +++ b/cache/cache_manifest.go @@ -39,7 +39,8 @@ func (c *Cache) RelinkManifest(ctx context.Context, host, image, tag string, blo func (c *Cache) PutManifestContent(ctx context.Context, host, image, tagOrBlob string, content []byte) (int64, string, string, error) { mt := struct { - MediaType string `json:"mediaType"` + MediaType string `json:"mediaType"` + Manifests json.RawMessage `json:"manifests"` }{} err := json.Unmarshal(content, &mt) if err != nil { @@ -48,7 +49,11 @@ func (c *Cache) PutManifestContent(ctx context.Context, host, image, tagOrBlob s mediaType := mt.MediaType if mediaType == "" { - mediaType = "application/vnd.docker.distribution.manifest.v1+json" + if len(mt.Manifests) != 0 { + mediaType = "application/vnd.oci.image.index.v1+json" + } else { + mediaType = "application/vnd.docker.distribution.manifest.v1+json" + } } h := sha256.New() @@ -101,7 +106,8 @@ func (c *Cache) GetManifestContent(ctx context.Context, host, image, tagOrBlob s } mt := struct { - MediaType string `json:"mediaType"` + MediaType string `json:"mediaType"` + Manifests json.RawMessage `json:"manifests"` }{} err = json.Unmarshal(content, &mt) if err != nil { @@ -118,7 +124,11 @@ func (c *Cache) GetManifestContent(ctx context.Context, host, image, tagOrBlob s mediaType := mt.MediaType if mediaType == "" { - mediaType = "application/vnd.docker.distribution.manifest.v1+json" + if len(mt.Manifests) != 0 { + mediaType = "application/vnd.oci.image.index.v1+json" + } else { + mediaType = "application/vnd.docker.distribution.manifest.v1+json" + } } return content, digest, mediaType, nil