Added error display for rsync

This commit is contained in:
GarryOne 2020-03-26 23:53:42 +02:00
parent 19dbe22d4f
commit 37e21b5b6b
2 changed files with 8 additions and 10 deletions

9
dist/index.js vendored
View File

@ -481,18 +481,17 @@ const nodeCmd = __webpack_require__(428);
const nodeRsync = __webpack_require__(250); 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; 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 sshDeploy = (() => {
const rsync = ({ privateKey, port, src, dest, args }) => { const rsync = ({ privateKey, port, src, dest, args }) => {
console.log(`Starting Rsync Action: ${src} to ${dest}`); console.log(`Starting Rsync Action: ${src} to ${dest}`);
console.log(privateKey, port, src, dest, args);
try { try {
// RSYNC COMMAND // 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) { if (error) {
console.error('⚠️ Rsync error', error); console.error('⚠️ Rsync error', error.message);
console.log(stderr); console.log(stderr);
console.log(stdout); console.log(stdout);
process.abort(); process.abort();
@ -501,7 +500,7 @@ const sshDeploy = (() => {
} }
}); });
} catch (err) { } catch (err) {
console.error(`⚠️ An error happened:(.`, err); console.error(`⚠️ An error happened:(.`, err.message, err.stack);
process.abort(); process.abort();
} }
}; };

View File

@ -6,18 +6,17 @@ const nodeCmd = require('node-cmd');
const nodeRsync = require('rsyncwrapper'); 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; 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 sshDeploy = (() => {
const rsync = ({ privateKey, port, src, dest, args }) => { const rsync = ({ privateKey, port, src, dest, args }) => {
console.log(`Starting Rsync Action: ${src} to ${dest}`); console.log(`Starting Rsync Action: ${src} to ${dest}`);
console.log(privateKey, port, src, dest, args);
try { try {
// RSYNC COMMAND // 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) { if (error) {
console.error('⚠️ Rsync error', error); console.error('⚠️ Rsync error', error.message);
console.log(stderr); console.log(stderr);
console.log(stdout); console.log(stdout);
process.abort(); process.abort();
@ -26,7 +25,7 @@ const sshDeploy = (() => {
} }
}); });
} catch (err) { } catch (err) {
console.error(`⚠️ An error happened:(.`, err); console.error(`⚠️ An error happened:(.`, err.message, err.stack);
process.abort(); process.abort();
} }
}; };