Skip to content
Permalink
Browse files
refactor: use the variable from artifact
refs #3496

Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
  • Loading branch information
caarlos0 committed Nov 15, 2022
1 parent 4863781 commit 33ea55b8e6ab6ed02311a29bdb42d4e1219abbca
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
@@ -20,7 +20,6 @@ import (

const (
dockerConfigExtra = "DockerConfig"
dockerDigestExtra = artifact.ExtraDigest

useBuildx = "buildx"
useDocker = "docker"
@@ -1094,7 +1094,7 @@ func TestRunPipe(t *testing.T) {
}

_ = ctx.Artifacts.Filter(artifact.ByType(artifact.DockerImage)).Visit(func(a *artifact.Artifact) error {
digest, err := artifact.Extra[string](*a, dockerDigestExtra)
digest, err := artifact.Extra[string](*a, artifact.ExtraDigest)
require.NoError(t, err)
require.NotEmpty(t, digest)
return nil
@@ -1430,14 +1430,14 @@ func TestWithDigest(t *testing.T) {
Name: "owner/img:t1",
Type: artifact.DockerImage,
Extra: artifact.Extras{
dockerDigestExtra: "sha256:d1",
artifact.ExtraDigest: "sha256:d1",
},
})
artifacts.Add(&artifact.Artifact{
Name: "owner/img:t2",
Type: artifact.DockerImage,
Extra: artifact.Extras{
dockerDigestExtra: "sha256:d2",
artifact.ExtraDigest: "sha256:d2",
},
})
artifacts.Add(&artifact.Artifact{
@@ -134,7 +134,7 @@ func manifestImages(ctx *context.Context, manifest config.DockerManifest) ([]str
func withDigest(name string, images []*artifact.Artifact) string {
for _, art := range images {
if art.Name == name {
if digest := artifact.ExtraOr(*art, dockerDigestExtra, ""); digest != "" {
if digest := artifact.ExtraOr(*art, artifact.ExtraDigest, ""); digest != "" {
return name + "@" + digest
}
break

0 comments on commit 33ea55b

Please sign in to comment.