-
Notifications
You must be signed in to change notification settings - Fork 854
Rsync: split execution for SSH agent forwarding support #46802
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
base: trunk
Are you sure you want to change the base?
Conversation
Docker cannot access macOS Secure Enclave SSH keys (AutoProxxy), so rsync needs to run on the host with native SSH. This adds a two-phase mode: Docker handles file collection, prompts, and watch/debounce via a new --prepare-filters flag, writing filter rules and metadata to tools/docker/data/rsync/. The host-side jp.js watches for trigger file changes and runs rsync natively. --config continues to run entirely in Docker (no SSH needed).
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a split-execution model for rsync to enable SSH agent forwarding support with Secure Enclave keys. The change addresses a limitation where Docker containers cannot access Secure Enclave SSH keys (e.g., AutoProxxy), by having Docker handle file collection and the host system execute rsync with native SSH.
Changes:
- Introduced
--prepare-filtersmode inrsync.jswhere Docker collects files, generates filter rules, and writes metadata for host-side execution - Added split-mode handling in
jp.jsthat detects rsync invocations and orchestrates the Docker-for-collection + host-for-rsync workflow - Fixed watch mode output formatting issues by using
\r\nline endings and capturing rsync output to handle terminal raw mode
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tools/cli/commands/rsync.js | Added --prepare-filters flag, writeFilterFile() and prepareFiltersAndSignal() functions to support split execution; updated watch mode to conditionally use prepare-filters workflow |
| projects/js-packages/jetpack-cli/bin/jp.js | Implemented handleRsyncSplit(), runHostRsync(), detectOpenrsync(), and helper functions to orchestrate split execution on the host side; added rsync command interception in main execution flow |
| projects/js-packages/jetpack-cli/changelog/add-monorepo-ssh-agent-forwarding | Added changelog entry documenting the feature change |
|
Maybe this is the way we'll have to go, but the amount of code copy-pasted from tools/cli into jp isn't great and having to have What might work better would be to use
|
Proposed changes:
--prepare-filtersmode torsync.jsinside Docker: collects paths, writes filter rules and metadata totools/docker/data/rsync/, and touches a trigger file for the host to detect.jp.jsdetects whenrsyncis invoked (without--config,--help, or-h) and handles the split: runs Docker for file collection, then executes rsync natively on the host.--prepare-filtersand the host polls a trigger file, running rsync each time Docker signals a change.\r\nline endings since Docker exec leaves the host terminal in raw mode.--helpand-hflags through to Docker directly instead of entering split mode.Other information:
Jetpack product discussion
N/A — this is a developer tooling change to the Jetpack CLI (
jp rsync), not a product change.Does this pull request change what data or activity we track or use?
No. This change only affects local developer tooling (the
jp rsynccommand). No tracking or data collection is added or modified.Testing instructions:
Setup
cd projects/js-packages/jetpack-cli npm linkwhich jp # Should point to your nvm node_modules npm list -g @automattic/jetpack-cliTest:
--helpflagjp rsync --helpTest: Single rsync
jp rsyncand select a plugin and destination.Test: Watch mode
jp rsync --watchand select a plugin and destination.Test: SSH agent forwarding (if applicable)
jp rsyncworks with remote destinations that require it.Cleanup
When done testing, restore the published version of the CLI: