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

This commit is contained in:
Tianon Gravi 2018-01-24 09:56:57 -08:00
parent 90101d3445
commit f36ef9d30b
1 changed files with 8 additions and 1 deletions

View File

@ -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