Skip to content

Commit

Permalink
fix(main): prevent building on pulled image
Browse files Browse the repository at this point in the history
  • Loading branch information
elmariofredo committed Jan 9, 2018
1 parent da38821 commit cd5567e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions soos.go
Original file line number Diff line number Diff line change
Expand Up @@ -226,26 +226,27 @@ func main() {

localImageIsPresent := checkImagePresence(imageReference)

localImageIsPresent2 := false
localImageIsBuild := false

if !localImageIsPresent {
fmt.Printf("<-> Image is missing, trying to pull...")
pullImage(imageReference)
localImageIsPresent2 := checkImagePresence(imageReference)
fmt.Printf("<-> result: %t done\n", localImageIsPresent2)
localImageIsPresent = checkImagePresence(imageReference)
fmt.Printf("<-> result: %t done\n", localImageIsPresent)
}

if !localImageIsPresent && !localImageIsPresent2 {
if !localImageIsPresent {
fmt.Printf("<-> Image is missing, building...")
buildImage(imageReference)
localImageIsBuild = true
fmt.Printf("<-> done\n")
}

fmt.Printf("<-> Running image...\n\n")
runImage(imageReference)
fmt.Printf("\n\ndone\n")

if !localImageIsPresent && !localImageIsPresent2 {
if localImageIsBuild {
fmt.Printf("<-> Pushing image...")
pushImage(imageReference)
fmt.Printf("done\n")
Expand Down

0 comments on commit cd5567e

Please sign in to comment.