Skip to content

Commit ca92671

Browse files
committed
Clearer error message
Signed-off-by: David Gageot <david.gageot@docker.com>
1 parent 9f374d4 commit ca92671

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pkg/oci/package.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"strings"
99
"time"
1010

11-
latest "github.com/docker/cagent/pkg/config/v2"
1211
"github.com/goccy/go-yaml"
1312
v1 "github.com/google/go-containerregistry/pkg/v1"
1413
"github.com/google/go-containerregistry/pkg/v1/empty"
@@ -17,6 +16,7 @@ import (
1716
"github.com/google/go-containerregistry/pkg/v1/types"
1817

1918
"github.com/docker/cagent/pkg/config"
19+
latest "github.com/docker/cagent/pkg/config/v2"
2020
"github.com/docker/cagent/pkg/content"
2121
"github.com/docker/cagent/pkg/path"
2222
"github.com/docker/cagent/pkg/version"

pkg/remote/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Pull(ctx context.Context, registryRef string, force bool, opts ...crane.Opt
3434
if meta, metaErr := store.GetArtifactMetadata(localRef); metaErr == nil {
3535
if meta.Digest == remoteDigest {
3636
if !hasCagentAnnotation(meta.Annotations) {
37-
return "", fmt.Errorf("artifact %s found in store wasn't created by cagent", localRef)
37+
return "", fmt.Errorf("artifact %s found in store wasn't created by `cagent push`\nTry to push again with `cagent push` (cagent >= v1.10.0)", localRef)
3838
}
3939
return meta.Digest, nil
4040
}
@@ -51,7 +51,7 @@ func Pull(ctx context.Context, registryRef string, force bool, opts ...crane.Opt
5151
return "", fmt.Errorf("getting manifest from pulled image: %w", err)
5252
}
5353
if !hasCagentAnnotation(manifest.Annotations) {
54-
return "", fmt.Errorf("artifact %s wasn't created by cagent", localRef)
54+
return "", fmt.Errorf("artifact %s wasn't created by `cagent push`\nTry to push again with `cagent push` (cagent >= v1.10.0)", localRef)
5555
}
5656

5757
digest, err := store.StoreArtifact(img, localRef)

0 commit comments

Comments
 (0)