Skip to content

Commit

Permalink
Compress outputs to tar file in GCB dir
Browse files Browse the repository at this point in the history
  • Loading branch information
aBozowski committed May 24, 2022
1 parent 7c9866d commit 187da61
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions examples/chef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import hashlib
import json
import subprocess
import tarfile

import constants
import stateful_shell
Expand Down Expand Up @@ -197,7 +198,7 @@ def main(argv: Sequence[str]) -> None:
print("Cached files out of date. Please run chef with the flag --generate_zzz and commit")
exit(1)
if device == "zap_commit" and False:
# Disabled for now
# Disabled for now, ci_manifest above created without include_zap_submod, fails in CI env.
if cached_manifest[device] != ci_manifest[device]:
print("ZAP updated in master, please pull master and run chef with the flag --generate_zzz and commit")
exit(1)
Expand Down Expand Up @@ -265,9 +266,18 @@ def main(argv: Sequence[str]) -> None:
if device.endswith(target_file_ext):
device_name = device[:-len(target_file_ext)]
for platform, directory in platforms_and_outputs.items():
platforms_and_outputs[platform] = os.path.join(_CHEF_SCRIPT_PATH, directory)
output_dir = os.path.join(_CHEF_SCRIPT_PATH, directory)
command = './chef.py -czbr -d {} -t {}'.format(device_name, platform)
subprocess.check_call(command, cwd=_CHEF_SCRIPT_PATH, shell=True)
archive_prefix = "/workspace/artifacts/"
if not os.path.exists(archive_prefix):
os.mkdir(archive_prefix)
archive_name = f"{platform}-chef-{device_name}-wifi-rpc"
archive_suffix = ".tar.gz"
archive_full_name = archive_prefix + archive_name + archive_suffix
print(f"Adding build output to archive {archive_full_name}")
with tarfile.open(archive_full_name, "w:gz") as tar:
tar.add(output_dir, arcname=".")
exit(0)

#
Expand Down

0 comments on commit 187da61

Please sign in to comment.