Skip to content

allow remote binary customization#6013

Merged
mrsdizzie merged 1 commit into
wp-cli:mainfrom
drzraf:wp-custom-binary
Apr 30, 2025
Merged

allow remote binary customization#6013
mrsdizzie merged 1 commit into
wp-cli:mainfrom
drzraf:wp-custom-binary

Conversation

@drzraf

@drzraf drzraf commented Nov 6, 2024

Copy link
Copy Markdown

Could be set to use /custom/path/wp on the remote end but also sudo -u user /some/wp to allow running wp under a distinct user.

See also #5974

@drzraf drzraf requested a review from a team as a code owner November 6, 2024 17:19
@mrsdizzie

Copy link
Copy Markdown
Member

I don't use this feature so this is more just a comment, but the existing documentation already recommends using an alias for wp for this specific case:

https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/#alias-wp-to-php-which-runs-the-wp-cli-binary

alias wp="php ~/bin/wp"

So that case of "let the remote user specify what wp is" seems already covered by existing practices.

@drzraf

drzraf commented Nov 15, 2024

Copy link
Copy Markdown
Author

So that case of "let the remote user specify what wp is" seems already covered by existing practices.

non-interactive mode is not firing a "login-shell". ~/.bashrc isn't read and the aliases it may contain are not defined.

@mrsdizzie

mrsdizzie commented Nov 15, 2024

Copy link
Copy Markdown
Member

This is covered in the sections above on that same link:

https://make.wordpress.org/cli/handbook/guides/running-commands-remotely/#configure-the-remote-non-interactive-shell-to-resolve-aliases

Mostly just trying to gauge if this addresses a real problem that in some cases isn't possible with current advice -- ie: is there a situation where you can set an ENV var on remote but can't do the steps above? Or if it is just another way to accomplish that.

@drzraf

drzraf commented Jan 20, 2025

Copy link
Copy Markdown
Author

It addresses the problem in a way that doesn't need any hook nor modification on the remote server (like .bashrc to add aliases), either because:

  • These are not available
  • It's undesirable (because it need to work for multiple users with distinct .bashrc)
  • Because it's cumbersome to enable alias expansion, just to set on wp alias just to run wp with sudo under another user.

(and the diff in the codebase is just one-line)

@codecov-commenter

codecov-commenter commented Mar 4, 2025

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
php/WP_CLI/Runner.php 0.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@mrsdizzie

Copy link
Copy Markdown
Member

I think WP_CLI_BINARY is too vague because it is only used in SSH context with this PR. We already have WP_CLI_SSH_PRE_CMD so maybe this could be WP_CLI_SSH_BINARY / WP_CLI_SSH_REMOTE_BINARY / WP_CLI_SSH_REMOTE_WP_BINARY

Suggesting because these should also end up documented here in the list of all available ENV Vars that WP CLI supports and every other use of WP_CLI_XXX is for the local version, not the remote.

@drzraf

drzraf commented Apr 24, 2025

Copy link
Copy Markdown
Author

I'm fine renaming it for whatever gets your preference. Just let me know.

@schlessera schlessera mentioned this pull request Apr 29, 2025
47 tasks
@mrsdizzie

Copy link
Copy Markdown
Member

WP_CLI_SSH_BINARY seems fine to me (can add documentation separately)

@mrsdizzie mrsdizzie added this to the 2.12.0 milestone Apr 29, 2025
…o `sudo -u user /some/wp` would also allow running remote `wp-cli` under a distinct user
@drzraf drzraf force-pushed the wp-custom-binary branch from ff9677b to 6c736ef Compare April 29, 2025 23:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants