Commit 0c67fa83f50701337a04b5b25973aeb9bfe57635

Authored by Alessandro Beltrão
1 parent ec5ae043

Correcting SPB_ENV and Converging only when all packages succeeded

Signed-off-by: Alessandro Caetano <alessandro.caetanob@gmail.com>
Showing 1 changed file with 14 additions and 3 deletions   Show diff stats
src/daily_builds/converge.py
... ... @@ -36,8 +36,12 @@ def checkBuildStatus(packageName,buildId):
36 36 print('%s build with id %s exited with status: %s'% (packageName,buildId,buildStatus))
37 37  
38 38 with open(today+'_log', 'a+') as f:
39   - f.write('%s build with id %s exited with status: %s'% (packageName,buildId,buildStatus))
40   - return 0
  39 + f.write('%s build with id %s exited with status: %s\n'% (packageName,buildId,buildStatus))
  40 +
  41 + if(buildStatus == 'succeeded'):
  42 + return 0
  43 + else:
  44 + return 1
41 45  
42 46 pluginsUpload = subprocess.Popen('make release_plugins', shell=True, cwd=SRC_PATH)
43 47  
... ... @@ -63,7 +67,14 @@ with open(today+&#39;.yaml&#39;) as f:
63 67 with concurrent.futures.ThreadPoolExecutor(max_workers=BUILD_COUNT) as executor:
64 68 future_builds = {executor.submit(checkBuildStatus,packageName,buildId) for packageName, buildId in buildDict.iteritems()}
65 69  
  70 +for build in concurrent.futures.as_completed(future_builds):
  71 + status = build.result()
  72 + if(status != 0):
  73 + sys.exit('One of the packages failed to build, aborting converge, check the log file')
  74 + else:
  75 + print('All builds are ok, proceding to converge')
  76 +
66 77  
67   -spbConverge = subprocess.Popen(['rake converge SPB_ENV=',SPB_ENV], shell=True, cwd=SPB_PATH)
  78 +spbConverge = subprocess.Popen(['rake converge SPB_ENV='+SPB_ENV], shell=True, cwd=SPB_PATH)
68 79  
69 80 spbConverge.wait()
... ...