mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	add sshCmdArgs option
This commit is contained in:
		
							parent
							
								
									a16ae38e86
								
							
						
					
					
						commit
						a285ca6ac0
					
				| @ -27,6 +27,10 @@ inputs: | ||||
|     description: "Arguments to pass to rsync" | ||||
|     required: false | ||||
|     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: | ||||
|     description: "An array of folder to exclude" | ||||
|     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 { | ||||
|     source, remoteUser, remoteHost, remotePort, | ||||
|     deployKeyName, sshPrivateKey, | ||||
|     args, exclude, | ||||
|     args, exclude, sshCmdArgs, | ||||
|     scriptBefore, scriptAfter, | ||||
|     sshServer | ||||
|   } = inputs; | ||||
| @ -31,7 +31,7 @@ const run = () => { | ||||
|   /* eslint-disable object-property-newline */ | ||||
|   sshDeploy({ | ||||
|     source, sshServer, exclude, remotePort, | ||||
|     privateKey, args, callback | ||||
|     privateKey, args, sshCmdArgs, callback | ||||
|   }); | ||||
| }; | ||||
| 
 | ||||
|  | ||||
| @ -3,17 +3,18 @@ const { snakeToCamel } = require('./helpers'); | ||||
| const inputNames = [ | ||||
|   'REMOTE_HOST', 'REMOTE_USER', 'REMOTE_PORT', | ||||
|   'SSH_PRIVATE_KEY', 'DEPLOY_KEY_NAME', | ||||
|   'SOURCE', 'TARGET', 'ARGS', 'EXCLUDE', | ||||
|   'SOURCE', 'TARGET', 'ARGS', 'SSH_CMD_ARGS', 'EXCLUDE', | ||||
|   'SCRIPT_BEFORE', 'SCRIPT_AFTER']; | ||||
| 
 | ||||
| const githubWorkspace = process.env.GITHUB_WORKSPACE; | ||||
| const remoteUser = process.env.REMOTE_USER; | ||||
| 
 | ||||
| const defaultInputs = { | ||||
|   source: '', // TODO
 | ||||
|   source: '', | ||||
|   target: `/home/${remoteUser}/`, | ||||
|   exclude: '', // TODO
 | ||||
|   args: '-rltgoDzvO', // TODO
 | ||||
|   exclude: '', | ||||
|   args: '-rltgoDzvO', | ||||
|   sshCmdArgs: '-o StrictHostKeyChecking=no', | ||||
|   deployKeyName: 'deploy_key' | ||||
| }; | ||||
| 
 | ||||
| @ -32,10 +33,9 @@ inputNames.forEach((input) => { | ||||
|       extendedVal = `${githubWorkspace}/${validVal}`; | ||||
|       break; | ||||
|     case 'exclude': | ||||
|       extendedVal = validVal.split(',').map((item) => item.trim()); | ||||
|       break; | ||||
|     case 'args': | ||||
|       extendedVal = [validVal]; | ||||
|     case 'sshCmdArgs': | ||||
|       extendedVal = validVal.split(',').map((item) => item.trim()); | ||||
|       break; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -25,14 +25,13 @@ const validateRsync = () => new Promise(async (resolve, reject) => { | ||||
| 
 | ||||
| const rsyncCli = ({ | ||||
|   source, sshServer, exclude, remotePort, | ||||
|   privateKey, args, callback | ||||
|   privateKey, args, sshCmdArgs, callback | ||||
| }) => { | ||||
|   console.log(`[Rsync] Starting Rsync Action: ${source} to ${sshServer}`); | ||||
|   if (exclude) console.log(`[Rsync] excluding folders ${exclude}`); | ||||
| 
 | ||||
|   const defaultOptions = { | ||||
|     ssh: true, | ||||
|     sshCmdArgs: ['-o StrictHostKeyChecking=no'], | ||||
|     recursive: true | ||||
|   }; | ||||
| 
 | ||||
| @ -40,9 +39,9 @@ const rsyncCli = ({ | ||||
|     // RSYNC COMMAND
 | ||||
|     /* eslint-disable object-property-newline */ | ||||
|     nodeRsync({ | ||||
|       ...defaultOptions, | ||||
|       src: source, dest: sshServer, excludeFirst: exclude, port: remotePort, | ||||
|       privateKey, args, | ||||
|       ...defaultOptions | ||||
|       privateKey, args, sshCmdArgs, | ||||
|     }, (error, stdout, stderr, cmd) => { | ||||
|       if (error) { | ||||
|         console.error('⚠️ [Rsync] error: ', error.message); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic