From 37e21b5b6b67e1c5d07fb1bb48d6b31117041fa2 Mon Sep 17 00:00:00 2001 From: GarryOne Date: Thu, 26 Mar 2020 23:53:42 +0200 Subject: [PATCH] Added error display for rsync --- dist/index.js | 9 ++++----- src/index.js | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dist/index.js b/dist/index.js index 35fce26..fbbc9b8 100755 --- a/dist/index.js +++ b/dist/index.js @@ -481,18 +481,17 @@ const nodeCmd = __webpack_require__(428); const nodeRsync = __webpack_require__(250); const { REMOTE_HOST, REMOTE_USER, REMOTE_PORT, SSH_PRIVATE_KEY, DEPLOY_KEY_NAME, SOURCE, TARGET, ARGS, GITHUB_WORKSPACE, HOME } = process.env; +console.log('GITHUB_WORKSPACE', GITHUB_WORKSPACE); const sshDeploy = (() => { const rsync = ({ privateKey, port, src, dest, args }) => { console.log(`Starting Rsync Action: ${src} to ${dest}`); - console.log(privateKey, port, src, dest, args); - try { // RSYNC COMMAND - nodeRsync({ src, dest, args, privateKey, ssh: false, port, sshCmdArgs: ['-o StrictHostKeyChecking=no'], recursive: true }, (error, stdout, stderr, cmd) => { + nodeRsync({ src, dest, args, privateKey, ssh: true, port, sshCmdArgs: ['-o StrictHostKeyChecking=no'], recursive: true }, (error, stdout, stderr, cmd) => { if (error) { - console.error('⚠️ Rsync error', error); + console.error('⚠️ Rsync error', error.message); console.log(stderr); console.log(stdout); process.abort(); @@ -501,7 +500,7 @@ const sshDeploy = (() => { } }); } catch (err) { - console.error(`⚠️ An error happened:(.`, err); + console.error(`⚠️ An error happened:(.`, err.message, err.stack); process.abort(); } }; diff --git a/src/index.js b/src/index.js index 1dcc7a5..9c6df69 100644 --- a/src/index.js +++ b/src/index.js @@ -6,18 +6,17 @@ const nodeCmd = require('node-cmd'); const nodeRsync = require('rsyncwrapper'); const { REMOTE_HOST, REMOTE_USER, REMOTE_PORT, SSH_PRIVATE_KEY, DEPLOY_KEY_NAME, SOURCE, TARGET, ARGS, GITHUB_WORKSPACE, HOME } = process.env; +console.log('GITHUB_WORKSPACE', GITHUB_WORKSPACE); const sshDeploy = (() => { const rsync = ({ privateKey, port, src, dest, args }) => { console.log(`Starting Rsync Action: ${src} to ${dest}`); - console.log(privateKey, port, src, dest, args); - try { // RSYNC COMMAND - nodeRsync({ src, dest, args, privateKey, ssh: false, port, sshCmdArgs: ['-o StrictHostKeyChecking=no'], recursive: true }, (error, stdout, stderr, cmd) => { + nodeRsync({ src, dest, args, privateKey, ssh: true, port, sshCmdArgs: ['-o StrictHostKeyChecking=no'], recursive: true }, (error, stdout, stderr, cmd) => { if (error) { - console.error('⚠️ Rsync error', error); + console.error('⚠️ Rsync error', error.message); console.log(stderr); console.log(stdout); process.abort(); @@ -26,7 +25,7 @@ const sshDeploy = (() => { } }); } catch (err) { - console.error(`⚠️ An error happened:(.`, err); + console.error(`⚠️ An error happened:(.`, err.message, err.stack); process.abort(); } };