Skip to content

Commit

Permalink
out: print response
Browse files Browse the repository at this point in the history
  • Loading branch information
vito committed Sep 30, 2018
1 parent 43a80d1 commit 810e134
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions cmd/out/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,20 @@ func main() {
Image: img,
}

digest, err := img.Digest()
if err != nil {
logrus.Errorf("failed to get image digest: %s", err)
os.Exit(1)
return
}

logrus.Infof("pushing %s to %s", digest, ref)

auth := &authn.Basic{
Username: req.Source.Username,
Password: req.Source.Password,
}

logrus.Infof("pushing to %s", ref)

err = remote.Write(n, img, auth, http.DefaultTransport, remote.WriteOptions{})
if err != nil {
logrus.Errorf("failed to upload image: %s", err)
Expand All @@ -112,4 +119,11 @@ func main() {
}

logrus.Info("pushed")

json.NewEncoder(os.Stdout).Encode(OutResponse{
Version: resource.Version{
Digest: digest.String(),
},
Metadata: []resource.MetadataField{},
})
}

0 comments on commit 810e134

Please sign in to comment.