Skip to content

Commit 91b6d28

Browse files
committedJan 2, 2023
fix: Add visible Rsync CMD for debugging
1 parent 4f233a7 commit 91b6d28

File tree

3 files changed

+23
-13
lines changed

3 files changed

+23
-13
lines changed
 

‎.github/workflows/e2e.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212
EXCLUDE:
1313
description: 'EXCLUDE'
1414
required: true
15-
default: '/dist/, /node_modules/'
15+
default: 'skip_dir/, /node_modules/'
1616
SSH_CMD_ARGS:
1717
description: 'SSH_CMD_ARGS'
1818
required: true
@@ -63,15 +63,18 @@ jobs:
6363

6464
- name: Create project file
6565
run: |
66-
mkdir test_project
67-
cd test_project
66+
mkdir test_project && cd "$_"
6867
touch index.html
68+
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
6969
truncate -s 50MB image.svg
70-
truncate -s 5MB text.txt
70+
truncate -s 5MB info.txt
7171
truncate -s 500MB big_file.txt
72-
date +"%Y-%m-%d %H:%M:%S,%3N" >> index.html
72+
mkdir skip_dir && cd "$_"
73+
truncate -s 5MB text_in_skip_dir.txt
74+
cd ../
7375
cat index.html
74-
ls -l
76+
echo "test_project: \n" && ls -l
77+
echo "skip_dir: \n" && ls -l skip_dir
7578
7679
- name: e2e Test published ssh-deploy action
7780
uses: easingthemes/ssh-deploy@main
@@ -84,11 +87,10 @@ jobs:
8487
SSH_CMD_ARGS: ${{ github.event.inputs.SSH_CMD_ARGS || '-o StrictHostKeyChecking=no, -o UserKnownHostsFile=/dev/null' }}
8588
SOURCE: "test_project/"
8689
TARGET: "/var/www/html/"
87-
EXCLUDE: ${{ github.event.inputs.EXCLUDE || '/dist/, /node_modules/' }}
90+
EXCLUDE: ${{ github.event.inputs.EXCLUDE || 'skip_dir/, /node_modules/' }}
8891
SCRIPT_BEFORE: |
8992
whoami
90-
ls -al
93+
ls -al /var/www/html/
9194
SCRIPT_AFTER: |
92-
whoami
93-
ls -al
95+
ls -al /var/www/html/
9496
echo $RSYNC_STDOUT

‎dist/index.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎src/rsyncCli.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ const { execSync } = require('child_process');
22
const nodeRsync = require('rsyncwrapper');
33

44
const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
5+
const logCMD = (cmd) => {
6+
console.warn('================================================================');
7+
console.log(cmd);
8+
console.warn('================================================================');
9+
};
10+
511
try {
612
nodeRsync(config, (error, stdout, stderr, cmd) => {
713
if (error) {
@@ -11,10 +17,12 @@ const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => {
1117
console.error(stderr);
1218
console.error('❌️ [Rsync] stdout: ');
1319
console.error(stdout);
14-
console.error('❌ [Rsync] cmd: ', cmd);
20+
console.error('❌ [Rsync] command: ');
21+
logCMD(cmd);
1522
reject(new Error(`${error.message}\n\n${stderr}`));
1623
} else {
17-
console.log('⭐ [Rsync] cmd finished: ', cmd);
24+
console.log('⭐ [Rsync] command finished: ');
25+
logCMD(cmd);
1826
resolve(stdout);
1927
}
2028
});

0 commit comments

Comments
 (0)
Please sign in to comment.