From 789bf292487566980e69b0745e5e2cd1f252cd80 Mon Sep 17 00:00:00 2001 From: Martin Nowack Date: Thu, 23 Feb 2023 22:23:30 +0000 Subject: Fix script to build all the containers we require for GitHub actions --- scripts/build/build-ci-container.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scripts/build/build-ci-container.py b/scripts/build/build-ci-container.py index c9264674..3f478b54 100755 --- a/scripts/build/build-ci-container.py +++ b/scripts/build/build-ci-container.py @@ -3,6 +3,7 @@ import yaml import subprocess import os +import sys (abs_path, _) = os.path.split(os.path.abspath(__file__)) @@ -10,7 +11,6 @@ with open(os.path.join(abs_path,"../../.github/workflows/build.yaml"), 'r') as s try: ci_config = yaml.safe_load(stream) global_env = ci_config['env'] - print(ci_config['jobs']['Linux']['strategy']['matrix']['include']) for job in ci_config['jobs']['Linux']['strategy']['matrix']['include']: if job['name'] in ["Docker", "macOS"]: print("Skip: {}".format(job['name'])) @@ -21,11 +21,12 @@ with open(os.path.join(abs_path,"../../.github/workflows/build.yaml"), 'r') as s build_env = os.environ.copy() # Copy current global build configurations - build_vars = dict(global_env) + for k,v in global_env.items(): + build_env[k] = str(v) # Override with job specific values for k,v in job['env'].items(): - build_vars[k] = v + build_env[k] = str(v) cmd = [os.path.join(abs_path, 'build.sh'), 'klee', # build KLEE and all its dependencies @@ -35,8 +36,6 @@ with open(os.path.join(abs_path,"../../.github/workflows/build.yaml"), 'r') as s '--create-final-image', # assume KLEE is the final image ] - env_str = ["{}={}".format(k,v) for k,v in build_vars.items()] - print("{} {}".format(" ".join(env_str)," ".join(cmd)) ) process = subprocess.Popen(cmd, # Assume KLEE is the final image stdout=subprocess.PIPE, @@ -47,11 +46,13 @@ with open(os.path.join(abs_path,"../../.github/workflows/build.yaml"), 'r') as s output = process.stdout.readline() print(output.strip()) return_code = process.poll() - if return_code is not None: - print('Building image failed: {}'.format(return_code)) - for output in process.stdout.readlines(): - print(output.strip()) + if return_code != None: break + if return_code != 0: + print('Building image failed: {}'.format(return_code)) + for output in process.stdout.readlines(): + print(output.strip()) + sys.exit(1) except yaml.YAMLError as exc: print(exc) \ No newline at end of file -- cgit 1.4.1