Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adjust COPY behavior for files and directories to match desired struc… #3047

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions flytekit/image_spec/default_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,10 @@ def create_docker_context(image_spec: ImageSpec, tmp_dir: Path):

if src_path.is_dir():
shutil.copytree(src_path, dst_path, dirs_exist_ok=True)
copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/{src_path.as_posix()}/")
copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/{src_path.name}/")
else:
shutil.copy(src_path, dst_path)
copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/{src_path.parent.as_posix()}/")
copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/")
Comment on lines +340 to +343
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent COPY destination paths in Dockerfile

Consider consolidating the COPY commands to use a consistent destination path /root/ for both files and directories. Currently, directories are copied to /root/{name}/ while files are copied to /root/, which could lead to confusion.

Code suggestion
Check the AI-generated fix before applying
 -                copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/{src_path.name}/")
 -                copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/")
 +                copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/")
 +                copy_commands.append(f"COPY --chown=flytekit {src_path.as_posix()} /root/")

Code Review Run #83a536


Is this a valid issue, or was it incorrectly flagged by the Agent?

  • it was incorrectly flagged


extra_copy_cmds = "\n".join(copy_commands)
else:
Expand Down
Loading