浏览代码

Also tag SharedTags (and include them in dependency calculations, etc)

This will include SharedTags directly in "bashbrew list", etc, but explicitly does _not_ include them during "bashbrew push".  This allows for other images to be "FROM" a SharedTags value, and should be reasonably safe since any given SharedTag should only be applicable for a given architecture at most once.
Tianon Gravi 8 年之前
父节点
当前提交
d6ebf0c1ac
共有 2 个文件被更改,包括 12 次插入2 次删除
  1. 9 1
      bashbrew/go/src/bashbrew/cmd-push.go
  2. 3 1
      bashbrew/go/src/bashbrew/repo.go

+ 9 - 1
bashbrew/go/src/bashbrew/cmd-push.go

@@ -3,6 +3,7 @@ package main
 import (
 	"fmt"
 	"os"
+	"path"
 	"time"
 
 	"github.com/codegangsta/cli"
@@ -28,12 +29,19 @@ func cmdPush(c *cli.Context) error {
 			return cli.NewMultiError(fmt.Errorf(`failed fetching repo %q`, repo), err)
 		}
 
+		tagRepo := path.Join(namespace, r.RepoName)
 		for _, entry := range r.Entries() {
 			if r.SkipConstraints(entry) {
 				continue
 			}
 
-			for _, tag := range r.Tags(namespace, uniq, entry) {
+			// we can't use "r.Tags()" here because it will include SharedTags, which we never want to push directly (see "cmd-put-shared.go")
+			for i, tag := range entry.Tags {
+				if uniq && i > 0 {
+					break
+				}
+				tag = tagRepo + ":" + tag
+
 				created := dockerCreated(tag)
 				lastUpdated := fetchDockerHubTagMeta(tag).lastUpdatedTime()
 				if created.After(lastUpdated) {

+ 3 - 1
bashbrew/go/src/bashbrew/repo.go

@@ -147,7 +147,9 @@ func (r Repo) Entries() []manifest.Manifest2822Entry {
 func (r Repo) Tags(namespace string, uniq bool, entry manifest.Manifest2822Entry) []string {
 	tagRepo := path.Join(namespace, r.RepoName)
 	ret := []string{}
-	for i, tag := range entry.Tags {
+	tags := append([]string{}, entry.Tags...)
+	tags = append(tags, entry.SharedTags...)
+	for i, tag := range tags {
 		if uniq && i > 0 {
 			break
 		}