Skip to content

Commit

Permalink
Fix return err in service cmds (#52)
Browse files Browse the repository at this point in the history
This fixes build commands exiting early
  • Loading branch information
cpg1111 authored Jul 22, 2016
1 parent 6187c27 commit b3ac6b9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions pipeline/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,10 @@ func runServiceBuild(srvs map[string]*DepService, testAll, shouldDeploy *bool) e
log.Println("Building", srvs[i].build.conf.Name)
go build(srvs[i], i, doneChan, errChan, shouldDeploy)
} else {
runServiceBuild(srvs[i].Children, testAll, shouldDeploy)
runErr := runServiceBuild(srvs[i].Children, testAll, shouldDeploy)
if runErr != nil {
return runErr
}
}
}
total := 0
Expand All @@ -68,7 +71,10 @@ func runServiceBuild(srvs map[string]*DepService, testAll, shouldDeploy *bool) e
case index := <-doneChan:
total++
if len(srvs[index].Children) > 0 {
runServiceBuild(srvs[index].Children, testAll, shouldDeploy)
runErr := runServiceBuild(srvs[index].Children, testAll, shouldDeploy)
if runErr != nil {
return runErr
}
}
if total == buildTotal {
return nil
Expand Down
8 changes: 6 additions & 2 deletions pipeline/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,9 @@ func (s *Service) execCheck() (bool, error) {
func (s *Service) execBuild() error {
for i := range s.conf.BuildCMD {
_, err := s.execSrvCmd(s.conf.BuildCMD[i], s.conf.Path)
return err
if err != nil {
return err
}
}
log.Println("Built")
return nil
Expand All @@ -217,7 +219,9 @@ func (s *Service) execTests() error {
log.Println("Testing")
for i := range s.conf.TestCMD {
_, err := s.execSrvCmd(s.conf.TestCMD[i], s.conf.Path)
return err
if err != nil {
return err
}
}
log.Println("Tested")
return nil
Expand Down

0 comments on commit b3ac6b9

Please sign in to comment.