Skip to content

Commit

Permalink
change reutnr list of command or build_docker instead of command
Browse files Browse the repository at this point in the history
  • Loading branch information
pisua committed Dec 16, 2024
1 parent fd0df14 commit 67f68d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions src/kapla/cli/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async def main() -> None:
logger.error(f"Tags file {tags_filepath} does not exist")
sys.exit(1)
tag, *additional_tags = json.loads(tags_filepath.read_text())
docker_func = partial(
docker_funcs = partial(
project.build_docker,
tag=tag,
additional_tags=additional_tags,
Expand All @@ -210,7 +210,8 @@ async def main() -> None:
)

try:
run(docker_func)
for docker_func in docker_funcs:
run(docker_func)
except CommandFailedError:
logger.error("Build failed")
sys.exit(1)
Expand Down
7 changes: 4 additions & 3 deletions src/kapla/projects/kproject.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,9 +659,10 @@ async def build_docker(
timeout: Optional[float] = None,
deadline: Optional[float] = None,
**kwargs: Any,
) -> Command:
) -> List[Command]:
"""Build docker image for the projcet according to the project spec."""
suffix = suffix or ""
cmds : List[Command] = []
# Gather deadline
deadline = get_deadline(timeout, deadline)
kwargs["rc"] = kwargs.get("rc", 0 if raise_on_error else None)
Expand Down Expand Up @@ -793,10 +794,10 @@ async def build_docker(
shutil.copy2(filepath, dist_root)
logger.warning("Invoking docker command", command=cmd.cmd)
# Run docker build command
return await cmd.run()
cmds.append(await cmd.run())
finally:
Path(self.root, "Dockerfile").unlink(missing_ok=True)

return cmds
def clean(self) -> None:
"""Remove well-known non versioned files"""
# Remove venv
Expand Down

0 comments on commit 67f68d6

Please sign in to comment.