The UFZ services GitLab and Mattermost will be unavailable on Monday, October 25 from 06:00 AM to 08:00 AM due to maintenance work.

Unverified Commit 7e6f0945 authored by Lars Bilke's avatar Lars Bilke
Browse files

Check exit code of subprocesses in builder.

parent 16aefd06
Pipeline #31375 failed with stage
in 15 seconds
......@@ -28,11 +28,9 @@ class builder(object):
f"sudo `which singularity` build --force {sif_file}"
f"{self.__definition_file_path}",
shell=True,
check=True,
)
subprocess.run(
f"sudo chown $USER:$USER {sif_file}",
shell=True,
)
subprocess.run(f"sudo chown $USER:$USER {sif_file}", shell=True, check=True)
# TODO: adapt this
exit(0)
......@@ -42,7 +40,7 @@ class builder(object):
f"-t {self.__tag} -f {self.__definition_file_path} ."
)
print(f"Running: {build_cmd}")
subprocess.run(build_cmd, shell=True)
subprocess.run(build_cmd, shell=True, check=True)
inspect_out = subprocess.check_output(
f"docker inspect {self.__tag} | grep Id", shell=True
).decode(sys.stdout.encoding)
......@@ -50,7 +48,7 @@ class builder(object):
image_id_short = image_id[0:12]
if self.__args.upload:
subprocess.run(f"docker push {self.__tag}", shell=True)
subprocess.run(f"docker push {self.__tag}", shell=True, check=True)
image_base_name = f"{self.__images_out_dir}/{self.__img_file}-{image_id_short}"
if self.__args.sif_file:
self.image_file = f"{self.__images_out_dir}/{self.__args.sif_file}"
......@@ -62,6 +60,7 @@ class builder(object):
subprocess.run(
f"cd {self.__cwd} && singularity build --force {self.image_file} docker-daemon:{self.__tag}",
shell=True,
check=True,
)
if self.__args.enroot_file:
......@@ -75,6 +74,7 @@ class builder(object):
# See https://www.mankier.com/1/mksquashfs for options.
f"cd {self.__cwd} && rm -f {self.image_file} && ENROOT_SQUASH_OPTIONS='-comp xz -b 512K' enroot import -o {self.image_file} dockerd://{self.__tag}",
shell=True,
check=True,
)
print(f"Wrote image file {self.image_file}")
......@@ -85,5 +85,6 @@ class builder(object):
subprocess.run(
f"cd {self.__cwd} && rm -f {bundle_file} && enroot bundle -o {bundle_file} {self.image_file}",
shell=True,
check=True,
)
print(f"Wrote bundle file {bundle_file}")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment