in src/context.py [0:0]
def add(self, artifacts):
"""
Adds artifacts to the build context
Args:
artifacts: array of (source, destination) tuples
"""
self.artifacts.update(artifacts)
# TODO: Use glob to expand
# TODO: Add logic to untar and retar
with tarfile.open(self.context_path, "w:gz") as tar:
for artifact_name in artifacts:
artifact = artifacts[artifact_name]
if "source" not in artifact or "target" not in artifact:
continue
source = os.path.join(self.artifact_root, artifact["source"])
target = artifact["target"]
tar.add(source, arcname=target)