mirror of
				https://github.com/easingthemes/ssh-deploy.git
				synced 2025-10-30 23:30:09 +08:00 
			
		
		
		
	emoji updates
This commit is contained in:
		
							parent
							
								
									177f5b4b79
								
							
						
					
					
						commit
						9dcb6032a7
					
				
							
								
								
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| @ -3,11 +3,11 @@ const { join } = require('path'); | |||||||
| 
 | 
 | ||||||
| const validateDir = (dir) => { | const validateDir = (dir) => { | ||||||
|   if (!dir) { |   if (!dir) { | ||||||
|     console.log('[DIR] dir is not defined'); |     console.warn('⚠️ [DIR] dir is not defined'); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
|   if (existsSync(dir)) { |   if (existsSync(dir)) { | ||||||
|     console.log(`[DIR] ${dir} dir exist`); |     console.log(`✅ [DIR] ${dir} dir exist`); | ||||||
|     return; |     return; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -51,7 +51,7 @@ const validateRequiredInputs = (inputs) => { | |||||||
|     const inputValue = inputs[inputKey]; |     const inputValue = inputs[inputKey]; | ||||||
| 
 | 
 | ||||||
|     if (!inputValue) { |     if (!inputValue) { | ||||||
|       console.error(`⚠️ [INPUTS] ${inputKey} is mandatory`); |       console.error(`❌ [INPUTS] ${inputKey} is mandatory`); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     return inputValue; |     return inputValue; | ||||||
|  | |||||||
| @ -38,10 +38,10 @@ const run = async () => { | |||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| run() | run() | ||||||
|   .then((data) => { |   .then((data = '') => { | ||||||
|     console.log('[DONE]', data); |     console.log('✅ [DONE]', data); | ||||||
|   }) |   }) | ||||||
|   .catch((error) => { |   .catch((error) => { | ||||||
|     console.error('[ERROR]', error.message); |     console.error('❌ [ERROR]', error.message); | ||||||
|     process.exit(1); |     process.exit(1); | ||||||
|   }); |   }); | ||||||
|  | |||||||
| @ -15,7 +15,7 @@ const remoteCmd = async (content, privateKeyPath, isRequired, label) => new Prom | |||||||
|   const filename = `local_ssh_script-${label}.sh`; |   const filename = `local_ssh_script-${label}.sh`; | ||||||
|   try { |   try { | ||||||
|     writeToFile({ dir: githubWorkspace, filename, content }); |     writeToFile({ dir: githubWorkspace, filename, content }); | ||||||
|     console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`, content); |     console.log(`Executing remote script: ssh -i ${privateKeyPath} ${sshServer}`); | ||||||
|     exec( |     exec( | ||||||
|       `DEBIAN_FRONTEND=noninteractive ssh -i ${privateKeyPath} ${sshServer} 'RSYNC_STDOUT="${process.env.RSYNC_STDOUT}" bash -s' < ${filename}`, |       `DEBIAN_FRONTEND=noninteractive ssh -i ${privateKeyPath} ${sshServer} 'RSYNC_STDOUT="${process.env.RSYNC_STDOUT}" bash -s' < ${filename}`, | ||||||
|       (err, data, stderr) => { |       (err, data, stderr) => { | ||||||
|  | |||||||
| @ -5,20 +5,20 @@ const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => { | |||||||
|   try { |   try { | ||||||
|     nodeRsync(config, (error, stdout, stderr, cmd) => { |     nodeRsync(config, (error, stdout, stderr, cmd) => { | ||||||
|       if (error) { |       if (error) { | ||||||
|         console.error('⚠️ [Rsync] error: '); |         console.error('❌ [Rsync] error: '); | ||||||
|         console.error(error); |         console.error(error); | ||||||
|         console.error('⚠️ [Rsync] stderr: '); |         console.error('❌ [Rsync] stderr: '); | ||||||
|         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] cmd: ', cmd); | ||||||
|         reject(new Error(`${error.message}\n\n${stderr}`)); |         reject(new Error(`${error.message}\n\n${stderr}`)); | ||||||
|       } else { |       } else { | ||||||
|         resolve(stdout); |         resolve(stdout); | ||||||
|       } |       } | ||||||
|     }); |     }); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     console.error('⚠️ [Rsync] command error: ', error.message, error.stack); |     console.error('❌ [Rsync] command error: ', error.message, error.stack); | ||||||
|     reject(error); |     reject(error); | ||||||
|   } |   } | ||||||
| }); | }); | ||||||
| @ -26,13 +26,13 @@ const nodeRsyncPromise = async (config) => new Promise((resolve, reject) => { | |||||||
| const validateRsync = async () => { | const validateRsync = async () => { | ||||||
|   try { |   try { | ||||||
|     execSync('rsync --version', { stdio: 'inherit' }); |     execSync('rsync --version', { stdio: 'inherit' }); | ||||||
|     console.log('⚠️ [CLI] Rsync exists'); |     console.log('✅️ [CLI] Rsync exists'); | ||||||
|     return; |     return; | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     console.log('⚠️ [CLI] Rsync doesn\'t exists', error.message); |     console.warn('⚠️ [CLI] Rsync doesn\'t exists', error.message); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   console.log('⚠️ [CLI] Start rsync installation with "apt-get" \n'); |   console.log('[CLI] Start rsync installation with "apt-get" \n'); | ||||||
|   try { |   try { | ||||||
|     execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' }); |     execSync('sudo DEBIAN_FRONTEND=noninteractive apt-get -y update && sudo DEBIAN_FRONTEND=noninteractive apt-get --no-install-recommends -y install rsync', { stdio: 'inherit' }); | ||||||
|     console.log('✅ [CLI] Rsync installed. \n'); |     console.log('✅ [CLI] Rsync installed. \n'); | ||||||
|  | |||||||
| @ -25,13 +25,13 @@ const addSshKey = (content, deployKeyName) => { | |||||||
| 
 | 
 | ||||||
| const updateKnownHosts = (host) => { | const updateKnownHosts = (host) => { | ||||||
|   const { knownHostsPath } = getPrivateKeyPath(); |   const { knownHostsPath } = getPrivateKeyPath(); | ||||||
|   console.log('✅ [SSH] Adding host to `known_hosts` ....', host, knownHostsPath); |   console.log('[SSH] Adding host to `known_hosts` ....', host, knownHostsPath); | ||||||
|   try { |   try { | ||||||
|     execSync(`ssh-keyscan -H ${host}  >> ${knownHostsPath}`, { |     execSync(`ssh-keyscan -H ${host}  >> ${knownHostsPath}`, { | ||||||
|       stdio: 'inherit' |       stdio: 'inherit' | ||||||
|     }); |     }); | ||||||
|   } catch (error) { |   } catch (error) { | ||||||
|     console.error('✅ [SSH] Adding host to `known_hosts` ERROR', host, error.message); |     console.error('❌ [SSH] Adding host to `known_hosts` ERROR', host, error.message); | ||||||
|   } |   } | ||||||
|   console.log('✅ [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath); |   console.log('✅ [SSH] Adding host to `known_hosts` DONE', host, knownHostsPath); | ||||||
| }; | }; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Dragan Filipovic
						Dragan Filipovic