diff --git a/.changesets/10525.md b/.changesets/10525.md new file mode 100644 index 000000000000..e35350599a70 --- /dev/null +++ b/.changesets/10525.md @@ -0,0 +1,17 @@ +- feat(baremetal): Add verbose output to ssh exec (#10525) by @Tobbe + +Passing `--verbose` to the baremetal deploy command is supposed to give you +more detailed info about what's happening. Previously however passing +`--verbose` didn't actually provide any extra information. This PR adds logging +to the new SshExecutor class so that you can see exactly what SSH commands are +being run, and in what path. + +Standard output (this stays the same before and after) +![image](https://github.com/redwoodjs/redwood/assets/30793/588fcf3d-b059-42d2-a1af-d2fff8b3e4bd) + +## Before (verbose output) +![image](https://github.com/redwoodjs/redwood/assets/30793/65fdfe46-2e82-4c87-897b-99a438e16149) +Doesn't really help much compared to the standard output 😅 + +## After (verbose output) +![image](https://github.com/redwoodjs/redwood/assets/30793/4a87bde4-072f-4bae-a84e-50ac72afe964) diff --git a/packages/cli/src/commands/deploy/baremetal.js b/packages/cli/src/commands/deploy/baremetal.js index 0e0fb0b3b641..9ded79319a37 100644 --- a/packages/cli/src/commands/deploy/baremetal.js +++ b/packages/cli/src/commands/deploy/baremetal.js @@ -672,7 +672,7 @@ export const handler = async (yargs) => { verbose: yargs.verbose, }) - const ssh = new SshExecutor() + const ssh = new SshExecutor(yargs.verbose) try { const tasks = new Listr(commands(yargs, ssh), { diff --git a/packages/cli/src/commands/deploy/baremetal/SshExecutor.js b/packages/cli/src/commands/deploy/baremetal/SshExecutor.js index 428fc4e6cae3..c9f5ebe8daf4 100644 --- a/packages/cli/src/commands/deploy/baremetal/SshExecutor.js +++ b/packages/cli/src/commands/deploy/baremetal/SshExecutor.js @@ -1,7 +1,8 @@ export class SshExecutor { - constructor() { + constructor(verbose) { const { NodeSSH } = require('node-ssh') this.ssh = new NodeSSH() + this.verbose = verbose } /** @@ -15,6 +16,12 @@ export class SshExecutor { sshCommand += ` ${args.join(' ')}` } + if (this.verbose) { + console.log( + `SshExecutor::exec running command \`${command} ${args.join(' ')}\` in ${path}`, + ) + } + const result = await this.ssh.execCommand(sshCommand, { cwd: path, })