mirror of
https://github.com/easingthemes/ssh-deploy
synced 2025-04-21 07:42:12 +00:00
add sshCmdArgs option
This commit is contained in:
parent
a16ae38e86
commit
a285ca6ac0
@ -27,6 +27,10 @@ inputs:
|
|||||||
description: "Arguments to pass to rsync"
|
description: "Arguments to pass to rsync"
|
||||||
required: false
|
required: false
|
||||||
default: "-rltgoDzvO"
|
default: "-rltgoDzvO"
|
||||||
|
SSH_CMD_ARGS:
|
||||||
|
description: "An array of ssh arguments, they must be prefixed with -o and separated by a comma, for example: -o SomeArgument=no, -o SomeOtherArgument=5 "
|
||||||
|
required: false
|
||||||
|
default: "-o StrictHostKeyChecking=no"
|
||||||
EXCLUDE:
|
EXCLUDE:
|
||||||
description: "An array of folder to exclude"
|
description: "An array of folder to exclude"
|
||||||
required: false
|
required: false
|
||||||
|
2
dist/index.js
vendored
2
dist/index.js
vendored
File diff suppressed because one or more lines are too long
@ -9,7 +9,7 @@ const run = () => {
|
|||||||
const {
|
const {
|
||||||
source, remoteUser, remoteHost, remotePort,
|
source, remoteUser, remoteHost, remotePort,
|
||||||
deployKeyName, sshPrivateKey,
|
deployKeyName, sshPrivateKey,
|
||||||
args, exclude,
|
args, exclude, sshCmdArgs,
|
||||||
scriptBefore, scriptAfter,
|
scriptBefore, scriptAfter,
|
||||||
sshServer
|
sshServer
|
||||||
} = inputs;
|
} = inputs;
|
||||||
@ -31,7 +31,7 @@ const run = () => {
|
|||||||
/* eslint-disable object-property-newline */
|
/* eslint-disable object-property-newline */
|
||||||
sshDeploy({
|
sshDeploy({
|
||||||
source, sshServer, exclude, remotePort,
|
source, sshServer, exclude, remotePort,
|
||||||
privateKey, args, callback
|
privateKey, args, sshCmdArgs, callback
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -3,17 +3,18 @@ const { snakeToCamel } = require('./helpers');
|
|||||||
const inputNames = [
|
const inputNames = [
|
||||||
'REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT',
|
'REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT',
|
||||||
'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME',
|
'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME',
|
||||||
'SOURCE', 'TARGET', 'ARGS', 'EXCLUDE',
|
'SOURCE', 'TARGET', 'ARGS', 'SSH_CMD_ARGS', 'EXCLUDE',
|
||||||
'SCRIPT_BEFORE', 'SCRIPT_AFTER'];
|
'SCRIPT_BEFORE', 'SCRIPT_AFTER'];
|
||||||
|
|
||||||
const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
const githubWorkspace = process.env.GITHUB_WORKSPACE;
|
||||||
const remoteUser = process.env.REMOTE_USER;
|
const remoteUser = process.env.REMOTE_USER;
|
||||||
|
|
||||||
const defaultInputs = {
|
const defaultInputs = {
|
||||||
source: '', // TODO
|
source: '',
|
||||||
target: `/home/${remoteUser}/`,
|
target: `/home/${remoteUser}/`,
|
||||||
exclude: '', // TODO
|
exclude: '',
|
||||||
args: '-rltgoDzvO', // TODO
|
args: '-rltgoDzvO',
|
||||||
|
sshCmdArgs: '-o StrictHostKeyChecking=no',
|
||||||
deployKeyName: 'deploy_key'
|
deployKeyName: 'deploy_key'
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -32,10 +33,9 @@ inputNames.forEach((input) => {
|
|||||||
extendedVal = `${githubWorkspace}/${validVal}`;
|
extendedVal = `${githubWorkspace}/${validVal}`;
|
||||||
break;
|
break;
|
||||||
case 'exclude':
|
case 'exclude':
|
||||||
extendedVal = validVal.split(',').map((item) => item.trim());
|
|
||||||
break;
|
|
||||||
case 'args':
|
case 'args':
|
||||||
extendedVal = [validVal];
|
case 'sshCmdArgs':
|
||||||
|
extendedVal = validVal.split(',').map((item) => item.trim());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,14 +25,13 @@ const validateRsync = () => new Promise(async (resolve, reject) => {
|
|||||||
|
|
||||||
const rsyncCli = ({
|
const rsyncCli = ({
|
||||||
source, sshServer, exclude, remotePort,
|
source, sshServer, exclude, remotePort,
|
||||||
privateKey, args, callback
|
privateKey, args, sshCmdArgs, callback
|
||||||
}) => {
|
}) => {
|
||||||
console.log(`[Rsync] Starting Rsync Action: ${source} to ${sshServer}`);
|
console.log(`[Rsync] Starting Rsync Action: ${source} to ${sshServer}`);
|
||||||
if (exclude) console.log(`[Rsync] excluding folders ${exclude}`);
|
if (exclude) console.log(`[Rsync] excluding folders ${exclude}`);
|
||||||
|
|
||||||
const defaultOptions = {
|
const defaultOptions = {
|
||||||
ssh: true,
|
ssh: true,
|
||||||
sshCmdArgs: ['-o StrictHostKeyChecking=no'],
|
|
||||||
recursive: true
|
recursive: true
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,9 +39,9 @@ const rsyncCli = ({
|
|||||||
// RSYNC COMMAND
|
// RSYNC COMMAND
|
||||||
/* eslint-disable object-property-newline */
|
/* eslint-disable object-property-newline */
|
||||||
nodeRsync({
|
nodeRsync({
|
||||||
|
...defaultOptions,
|
||||||
src: source, dest: sshServer, excludeFirst: exclude, port: remotePort,
|
src: source, dest: sshServer, excludeFirst: exclude, port: remotePort,
|
||||||
privateKey, args,
|
privateKey, args, sshCmdArgs,
|
||||||
...defaultOptions
|
|
||||||
}, (error, stdout, stderr, cmd) => {
|
}, (error, stdout, stderr, cmd) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.error('⚠️ [Rsync] error: ', error.message);
|
console.error('⚠️ [Rsync] error: ', error.message);
|
||||||
|
Loading…
Reference in New Issue
Block a user