Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Merge repo and tag on image list #656

Merged
merged 1 commit into from
Oct 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 7 additions & 7 deletions e2e/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (

var (
reg = regexp.MustCompile("Digest is (.*).")
expected = `REPOSITORY TAG APP NAME
%s push-pull
a-simple-app latest simple
b-simple-app latest simple
expected = `APP IMAGE APP NAME
%s push-pull
a-simple-app:latest simple
b-simple-app:latest simple
`
)

Expand Down Expand Up @@ -48,9 +48,9 @@ func TestImageList(t *testing.T) {
dir := fs.NewDir(t, "")
defer dir.Remove()

insertBundles(t, cmd, dir, info)
digest := insertBundles(t, cmd, dir, info)

expectedOutput := fmt.Sprintf(expected, info.registryAddress+"/c-myapp")
expectedOutput := fmt.Sprintf(expected, info.registryAddress+"/c-myapp@"+digest)
cmd.Command = dockerCli.Command("app", "image", "ls")
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Equal(t, result.Stdout(), expectedOutput)
Expand Down Expand Up @@ -84,7 +84,7 @@ Deleted: b-simple-app:latest`,
Err: `Error: no such image b-simple-app:latest`,
})

expectedOutput := "REPOSITORY TAG APP NAME\n"
expectedOutput := "APP IMAGE APP NAME\n"
cmd.Command = dockerCli.Command("app", "image", "ls")
result := icmd.RunCmd(cmd).Assert(t, icmd.Success)
assert.Equal(t, result.Stdout(), expectedOutput)
Expand Down
19 changes: 4 additions & 15 deletions internal/commands/image/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ func getPackages(bundleStore store.BundleStore, references []reference.Named) ([
ref: ref,
}

if r, ok := ref.(reference.NamedTagged); ok {
pk.taggedRef = r
}

packages[i] = pk
}

Expand Down Expand Up @@ -106,14 +102,8 @@ var (
header string
value func(p pkg) string
}{
{"REPOSITORY", func(p pkg) string {
return reference.FamiliarName(p.ref)
}},
{"TAG", func(p pkg) string {
if p.taggedRef != nil {
return p.taggedRef.Tag()
}
return ""
{"APP IMAGE", func(p pkg) string {
return reference.FamiliarString(p.ref)
}},
{"APP NAME", func(p pkg) string {
return p.bundle.Name
Expand All @@ -122,7 +112,6 @@ var (
)

type pkg struct {
ref reference.Named
taggedRef reference.NamedTagged
bundle *bundle.Bundle
ref reference.Named
bundle *bundle.Bundle
}