Merge pull request #32 from infosiftr/shared-tags-children
Fix edge case of children for images that are FROM a SharedTag
This commit is contained in:
commit
4c95a9e960
|
|
@ -100,11 +100,10 @@ func cmdFamily(parents bool, c *cli.Context) error {
|
||||||
// now the real work
|
// now the real work
|
||||||
seen := map[string]bool{}
|
seen := map[string]bool{}
|
||||||
for _, repo := range depsRepos {
|
for _, repo := range depsRepos {
|
||||||
r, err := fetch(repo)
|
tagsToConsider := []string{}
|
||||||
if err != nil {
|
|
||||||
return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if r, err := fetch(repo); err == nil {
|
||||||
|
// fetch succeeded, must be an object we know about so let's do a proper listing/search
|
||||||
for _, entry := range r.Entries() {
|
for _, entry := range r.Entries() {
|
||||||
if applyConstraints && r.SkipConstraints(entry) {
|
if applyConstraints && r.SkipConstraints(entry) {
|
||||||
continue
|
continue
|
||||||
|
|
@ -113,11 +112,25 @@ func cmdFamily(parents bool, c *cli.Context) error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(r.TagEntries) == 1 {
|
||||||
// we can't include SharedTags here or else they'll make "bashbrew parents something:simple" show the parents of the shared tags too ("nats:scratch" leading to both "nats:alpine" *and* "nats:windowsservercore" instead of just "nats:alpine" like it should), so we have to reimplement bits of "r.Tags" to exclude them
|
// we can't include SharedTags here or else they'll make "bashbrew parents something:simple" show the parents of the shared tags too ("nats:scratch" leading to both "nats:alpine" *and* "nats:windowsservercore" instead of just "nats:alpine" like it should), so we have to reimplement bits of "r.Tags" to exclude them
|
||||||
tagRepo := path.Join(namespace, r.RepoName)
|
tagRepo := path.Join(namespace, r.RepoName)
|
||||||
for _, rawTag := range entry.Tags {
|
for _, rawTag := range entry.Tags {
|
||||||
tag := tagRepo + ":" + rawTag
|
tag := tagRepo + ":" + rawTag
|
||||||
|
tagsToConsider = append(tagsToConsider, tag)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// if we're doing something like "bashbrew children full-repo" (or "bashbrew children full-repo:shared-tag"), we *need* to include the SharedTags or else things that are "FROM full-repo:shared-tag" won't show up 😅 ("bashbrew children adoptopenjdk" was just "cassandra" instead of the full list)
|
||||||
|
tagsToConsider = append(tagsToConsider, r.Tags(namespace, false, entry)...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if err != nil {
|
||||||
|
return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, tag := range tagsToConsider {
|
||||||
nodes := []topsortDepthNodes{}
|
nodes := []topsortDepthNodes{}
|
||||||
if parents {
|
if parents {
|
||||||
nodes = append(nodes, topsortDepthNodes{
|
nodes = append(nodes, topsortDepthNodes{
|
||||||
|
|
@ -161,7 +174,6 @@ func cmdFamily(parents bool, c *cli.Context) error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue