Skip to content

fix: resolve symlinks when archiving embedded artifacts#13554

Open
Priyanshu-u07 wants to merge 3 commits into
kubeflow:masterfrom
Priyanshu-u07:fix/embedded-artifact-resolve-symlinks
Open

fix: resolve symlinks when archiving embedded artifacts#13554
Priyanshu-u07 wants to merge 3 commits into
kubeflow:masterfrom
Priyanshu-u07:fix/embedded-artifact-resolve-symlinks

Conversation

@Priyanshu-u07

Copy link
Copy Markdown
Contributor

Description of your changes:

Resolves symlinks when creating tar archives for embedded artifacts. Previously, tarfile.open() preserved symlinks in the archive, causing RuntimeError: Failed to extract embedded archive at runtime when the symlink target didn't exist inside the container.

Fixes #13533
Changes:

  • Added dereference=True to tarfile.open() in _get_command_and_args_for_lightweight_component() so symlinked files are archived as regular files with actual content
  • Added _get_archive() test helper to extract and decompress the embedded archive from a compiled component
  • Added tests for symlinked file passed directly as embedded_artifact_path
  • Added tests for directory containing symlinked files
  • Both tests verify no symlinks or hardlinks remain in the archive and file content is correct
  • This fix only affects the SDK compile-time logic. The backend is unchanged

Note: The issue is labeled [backend] but the bug is in the Python SDK's archiving logic, not the backend API server.

Copilot AI review requested due to automatic review settings June 18, 2026 19:35
@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign chensun for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow

Copy link
Copy Markdown

Hi @Priyanshu-u07. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes embedded-artifact extraction failures at runtime by ensuring symlinked inputs are archived as regular files (with their actual contents) during SDK compile-time component generation, addressing #13533 without backend changes.

Changes:

  • Enable symlink dereferencing when building the embedded tar archive for lightweight components (dereference=True).
  • Add a small test helper to extract/decompress the embedded archive payload from compiled component source.
  • Add unit tests covering (1) embedding a symlinked file and (2) embedding a directory containing symlinked files, asserting the archive has no symlink/hardlink entries and content is correct.

🤖 LGTM 🤖

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
sdk/python/kfp/dsl/component_factory.py Dereference symlinks when creating embedded artifact tar archives to avoid runtime extraction errors.
sdk/python/kfp/dsl/component_factory_test.py Adds helpers + new tests to validate symlink resolution behavior for embedded artifacts.

Comment thread sdk/python/kfp/dsl/component_factory_test.py Outdated
Comment thread sdk/python/kfp/dsl/component_factory_test.py Outdated
Comment thread sdk/python/kfp/dsl/component_factory_test.py Outdated
Signed-off-by: Priyanshu-u07 <connect.priyanshu8271@gmail.com>
@Priyanshu-u07 Priyanshu-u07 force-pushed the fix/embedded-artifact-resolve-symlinks branch from 31539d5 to 20d78a9 Compare June 18, 2026 20:55
@Priyanshu-u07

Copy link
Copy Markdown
Contributor Author

/retest

@google-oss-prow

Copy link
Copy Markdown

@Priyanshu-u07: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

Details

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[backend] Embedded Artifact does not resolve symlinks

2 participants