瀏覽代碼

Update "put-shared" to allow some tags to fail per-repo (and collect errors)

Tianon Gravi 7 年之前
父節點
當前提交
01c6ebec24
共有 1 個文件被更改,包括 8 次插入1 次删除
  1. 8 1
      bashbrew/go/src/bashbrew/cmd-put-shared.go

+ 8 - 1
bashbrew/go/src/bashbrew/cmd-put-shared.go

@@ -4,6 +4,7 @@ import (
 	"fmt"
 	"os"
 	"path"
+	"strings"
 	"time"
 
 	"github.com/codegangsta/cli"
@@ -114,6 +115,7 @@ func cmdPutShared(c *cli.Context) error {
 			continue
 		}
 
+		failed := []string{}
 		for _, group := range sharedTagGroups {
 			yaml, mostRecentPush, err := entriesToManifestToolYaml(singleArch, *r, group.Entries...)
 			if err != nil {
@@ -143,10 +145,15 @@ func cmdPutShared(c *cli.Context) error {
 			if !dryRun {
 				tagYaml := tagsToManifestToolYaml(targetRepo, tagsToPush...) + yaml
 				if err := manifestToolPushFromSpec(tagYaml); err != nil {
-					return fmt.Errorf("failed pushing %s", groupIdentifier)
+					fmt.Fprintf(os.Stderr, "warning: failed putting %s, skipping (collecting errors)", groupIdentifier)
+					failed = append(failed, fmt.Sprintf("- %s: %v", groupIdentifier, err))
+					continue
 				}
 			}
 		}
+		if len(failed) > 0 {
+			return fmt.Errorf("failed putting groups:\n%s", strings.Join(failed, "\n"))
+		}
 	}
 
 	return nil