Skip to content

Commit 07c3c9f

Browse files
committed
Properly skip more things that we know "manifest-tool" will balk at (empty "manifests:" list)
1 parent 74e9c33 commit 07c3c9f

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

cmd/bashbrew/cmd-put-shared.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ import (
1414
"github.com/docker-library/bashbrew/manifest"
1515
)
1616

17+
var errPutShared404 = fmt.Errorf("nothing to push")
18+
1719
func entriesToManifestToolYaml(singleArch bool, r Repo, entries ...*manifest.Manifest2822Entry) (string, []string, error) {
1820
yaml := ""
1921
remoteDigests := []string{}
@@ -60,6 +62,12 @@ func entriesToManifestToolYaml(singleArch bool, r Repo, entries ...*manifest.Man
6062
}
6163
}
6264
}
65+
66+
if yaml == "" {
67+
// we're not even going to try pushing something, so let's inform the caller of that to skip the unnecessary call to "manifest-tool"
68+
return "", nil, errPutShared404
69+
}
70+
6371
return "manifests:\n" + yaml, remoteDigests, nil
6472
}
6573

@@ -128,7 +136,10 @@ func cmdPutShared(c *cli.Context) error {
128136
failed := []string{}
129137
for _, group := range sharedTagGroups {
130138
yaml, expectedRemoteDigests, err := entriesToManifestToolYaml(singleArch, *r, group.Entries...)
131-
if err != nil {
139+
if err == errPutShared404 {
140+
fmt.Fprintf(os.Stderr, "skipping %s (nothing to push)\n", fmt.Sprintf("%s:%s", targetRepo, group.SharedTags[0]))
141+
continue
142+
} else if err != nil {
132143
return err
133144
}
134145

0 commit comments

Comments
 (0)