about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2023-02-23 22:23:30 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2023-03-17 22:38:16 +0000
commit789bf292487566980e69b0745e5e2cd1f252cd80 (patch)
tree01115bce516f43c00df2725111792f9bde847bd0
parentc0cdde6d0fc3c8423dce71cdc7245cdb7fef8da8 (diff)
downloadklee-789bf292487566980e69b0745e5e2cd1f252cd80.tar.gz
Fix script to build all the containers we require for GitHub actions
-rwxr-xr-xscripts/build/build-ci-container.py19
1 files 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