Skip to content

Commit

Permalink
Filter images in Ready state when finding latest image
Browse files Browse the repository at this point in the history
  • Loading branch information
nlopes committed Sep 10, 2017
1 parent 7b15348 commit c9feef4
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,11 @@ func (c Client) GetLatestImage() (models.Image, error) {
}

if len(images) > 0 {
return images[len(images)-1], nil
for i := len(images) - 1; i >= 0; i-- {
if images[i].Ready {
return images[i], nil
}
}
}

return image, errors.New("no images available")
Expand Down

0 comments on commit c9feef4

Please sign in to comment.