Add ability to run WP-CLI commands over SSH#2327
Conversation
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
|
|
||
| let countSIGINT = 0; | ||
|
|
||
| if ( ! opts.env.isK8sResident ) { |
There was a problem hiding this comment.
Should we do an explicit check that it's a WP Cloud site?
There was a problem hiding this comment.
Co-authored-by: abdullah-kasim <abdullah.kasim@automattic.com>
Co-authored-by: Mohammad Jangda <mo@automattic.com>
c0055cb to
3ab374e
Compare
mjangda
left a comment
There was a problem hiding this comment.
Noted some minor things but overall, this looks great.
| @@ -0,0 +1,255 @@ | |||
| /** | |||
There was a problem hiding this comment.
Minor: Should we give this file a more specific name, like wp-ssh.ts?
|
|
||
| debug( "Requesting SSH authentication for command '%s'", command ); | ||
|
|
||
| const sshAuth = await getSSHAuthForCommand( this.app.id, this.env.id, command ); |
There was a problem hiding this comment.
Do we want this in a try-catch to handle failures more gracefully?
| message: 'Error executing command over SSH', | ||
| } ); | ||
|
|
||
| throw new Error( message ); |
There was a problem hiding this comment.
Instead of throwing, should we just be exiting?
| throw new Error( message ); | |
| process.exit( 1 ); |
| if ( ! this.app.id || ! this.env.id ) { | ||
| await this.track( 'error', { | ||
| error: 'no_app_env_id', | ||
| message: 'No app or env ID provided', |
There was a problem hiding this comment.
In src/bin/vip-wp.js, we also include a stripped down version of the command. Should we do that here as well? This can be done in a separate PR.
Co-authored-by: Mohammad Jangda <mo@automattic.com>
|



Description
This PR introduces a new feature for executing WP-CLI commands via SSH instead of using websockets.
Pull request checklist
New release checklist
Steps to Test
npm run buildnode ./dist/bin/vip-wp.js <site> --yes -- user list