fix: Add visible Rsync CMD for debugging

main
Dragan Filipovic 2023-01-02 22:59:19 +01:00
parent 4f233a7f45
commit 91b6d280ae
3 changed files with 24 additions and 14 deletions

View File

@ -12,7 +12,7 @@ on:
EXCLUDE: EXCLUDE:
description: 'EXCLUDE' description: 'EXCLUDE'
required: true required: true
default: '/dist/, /node_modules/' default: 'skip_dir/, /node_modules/'
SSH_CMD_ARGS: SSH_CMD_ARGS:
description: 'SSH_CMD_ARGS' description: 'SSH_CMD_ARGS'
required: true required: true
@ -63,15 +63,18 @@ jobs:
- name: Create project file - name: Create project file
run: | run: |
mkdir test_project mkdir test_project && cd "$_"
cd test_project
touch index.html touch index.html
truncate -s 50MB image.svg
truncate -s 5MB text.txt
truncate -s 500MB big_file.txt
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
truncate -s 50MB image.svg
truncate -s 5MB info.txt
truncate -s 500MB big_file.txt
mkdir skip_dir && cd "$_"
truncate -s 5MB text_in_skip_dir.txt
cd ../
cat index.html cat index.html
ls -l echo "test_project: \n" && ls -l
echo "skip_dir: \n" && ls -l skip_dir
- name: e2e Test published ssh-deploy action - name: e2e Test published ssh-deploy action
uses: easingthemes/ssh-deploy@main uses: easingthemes/ssh-deploy@main
@ -84,11 +87,10 @@ jobs:
SSH_CMD_ARGS: ${{ github.event.inputs.SSH_CMD_ARGS || '-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null' }} SSH_CMD_ARGS: ${{ github.event.inputs.SSH_CMD_ARGS || '-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null' }}
SOURCE: "test_project/" SOURCE: "test_project/"
TARGET: "/var/www/html/" TARGET: "/var/www/html/"
EXCLUDE: ${{ github.event.inputs.EXCLUDE || '/dist/, /node_modules/' }} EXCLUDE: ${{ github.event.inputs.EXCLUDE || 'skip_dir/, /node_modules/' }}
SCRIPT_BEFORE: | SCRIPT_BEFORE: |
whoami whoami
ls -al ls -al /var/www/html/
SCRIPT_AFTER: | SCRIPT_AFTER: |
whoami ls -al /var/www/html/
ls -al
echo $RSYNC_STDOUT echo $RSYNC_STDOUT

2
dist/index.js vendored

File diff suppressed because one or more lines are too long

View File

@ -2,6 +2,12 @@ const { execSync } = require('child_process');
const nodeRsync = require('rsyncwrapper'); const nodeRsync = require('rsyncwrapper');
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => { const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
const logCMD = (cmd) => {
console.warn('================================================================');
console.log(cmd);
console.warn('================================================================');
};
try { try {
nodeRsync(config, (error, stdout, stderr, cmd) => { nodeRsync(config, (error, stdout, stderr, cmd) => {
if (error) { if (error) {
@ -11,10 +17,12 @@ const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
console.error(stderr); console.error(stderr);
console.error('❌️ [Rsync] stdout: '); console.error('❌️ [Rsync] stdout: ');
console.error(stdout); console.error(stdout);
console.error('❌ [Rsync] cmd: ', cmd); console.error('❌ [Rsync] command: ');
logCMD(cmd);
reject(new Error(`${error.message}\n\n${stderr}`)); reject(new Error(`${error.message}\n\n${stderr}`));
} else { } else {
console.log('⭐ [Rsync] cmd finished: ', cmd); console.log('⭐ [Rsync] command finished: ');
logCMD(cmd);
resolve(stdout); resolve(stdout);
} }
}); });