mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 09:00:18 +01:00 
			
		
		
		
	Merge pull request #45 from drmikecrowe/master
Adds "ssh_needs_tty" general parameter, and rsync copy option
This commit is contained in:
		
						commit
						8b43a136dd
					
				@ -73,13 +73,15 @@ class InitCommand extends AbstractCommand
 | 
				
			|||||||
				'%notificationEnabled%',
 | 
									'%notificationEnabled%',
 | 
				
			||||||
				'%loggingEnabled%',
 | 
									'%loggingEnabled%',
 | 
				
			||||||
				'%maxlogs%',
 | 
									'%maxlogs%',
 | 
				
			||||||
 | 
									'%ssh_needs_tty%',
 | 
				
			||||||
			),
 | 
								),
 | 
				
			||||||
			array(
 | 
								array(
 | 
				
			||||||
				$projectName,
 | 
									$projectName,
 | 
				
			||||||
				$notificationEmail,
 | 
									$notificationEmail,
 | 
				
			||||||
				$notificationEnabled,
 | 
									$notificationEnabled,
 | 
				
			||||||
				'true',
 | 
									'true',
 | 
				
			||||||
				30
 | 
									30,
 | 
				
			||||||
 | 
									'false'
 | 
				
			||||||
			),
 | 
								),
 | 
				
			||||||
			$this->getGeneralConfigTemplate()
 | 
								$this->getGeneralConfigTemplate()
 | 
				
			||||||
    	);
 | 
					    	);
 | 
				
			||||||
@ -98,7 +100,8 @@ class InitCommand extends AbstractCommand
 | 
				
			|||||||
                  . 'email: %notificationEmail%' . PHP_EOL
 | 
					                  . 'email: %notificationEmail%' . PHP_EOL
 | 
				
			||||||
                  . 'notifications: %notificationEnabled%' . PHP_EOL
 | 
					                  . 'notifications: %notificationEnabled%' . PHP_EOL
 | 
				
			||||||
                  . 'logging: %loggingEnabled%' . PHP_EOL
 | 
					                  . 'logging: %loggingEnabled%' . PHP_EOL
 | 
				
			||||||
                  . 'maxlogs: %maxlogs%' . PHP_EOL;
 | 
					                  . 'maxlogs: %maxlogs%' . PHP_EOL
 | 
				
			||||||
 | 
					                  . 'ssh_needs_tty: %ssh_needs_tty%' . PHP_EOL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    	return $template;
 | 
					    	return $template;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
				
			|||||||
@ -189,7 +189,10 @@ abstract class AbstractTask
 | 
				
			|||||||
            $releasesDirectory = '';
 | 
					            $releasesDirectory = '';
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        $localCommand = 'ssh -p ' . $this->getConfig()->getHostPort() . ' '
 | 
					        // if general.yml includes "ssy_needs_tty: true", then add "-t" to the ssh command
 | 
				
			||||||
 | 
					        $needs_tty = ($this->getConfig()->general('ssh_needs_tty',false) ? "-t" : "");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $localCommand = 'ssh ' . $needs_tty . ' -p ' . $this->getConfig()->getHostPort() . ' '
 | 
				
			||||||
                      . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
					                      . '-q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no '
 | 
				
			||||||
                      . $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ' '
 | 
					                      . $this->getConfig()->deployment('user') . '@' . $this->getConfig()->getHostName() . ' '
 | 
				
			||||||
                      . '"cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && '
 | 
					                      . '"cd ' . rtrim($this->getConfig()->deployment('to'), '/') . $releasesDirectory . ' && '
 | 
				
			||||||
 | 
				
			|||||||
@ -30,7 +30,12 @@ class RsyncTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
            if ($this->getConfig()->getParameter('overrideRelease', false) == true) {
 | 
					            if ($this->getConfig()->getParameter('overrideRelease', false) == true) {
 | 
				
			||||||
                return 'Deploy via Rsync (with Releases override) [built-in]';
 | 
					                return 'Deploy via Rsync (with Releases override) [built-in]';
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                return 'Deploy via Rsync (with Releases) [built-in]';
 | 
					                $rsync_copy = $this->getConfig()->deployment("rsync");
 | 
				
			||||||
 | 
					                if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
 | 
				
			||||||
 | 
					                    return 'Deploy via Rsync (with Releases) [built-in, incremental]';
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    return 'Deploy via Rsync (with Releases) [built-in]';
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
                return 'Deploy via Rsync [built-in]';
 | 
					                return 'Deploy via Rsync [built-in]';
 | 
				
			||||||
@ -58,8 +63,8 @@ class RsyncTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
            '.svn',
 | 
					            '.svn',
 | 
				
			||||||
            '.mage',
 | 
					            '.mage',
 | 
				
			||||||
            '.gitignore',
 | 
					            '.gitignore',
 | 
				
			||||||
    		'.gitkeep',
 | 
					            '.gitkeep',
 | 
				
			||||||
    		'nohup.out'
 | 
					            'nohup.out'
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Look for User Excludes
 | 
					        // Look for User Excludes
 | 
				
			||||||
@ -73,7 +78,18 @@ class RsyncTask extends AbstractTask implements IsReleaseAware
 | 
				
			|||||||
            $deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
 | 
					            $deployToDirectory = rtrim($this->getConfig()->deployment('to'), '/')
 | 
				
			||||||
                               . '/' . $releasesDirectory
 | 
					                               . '/' . $releasesDirectory
 | 
				
			||||||
                               . '/' . $this->getConfig()->getReleaseId();
 | 
					                               . '/' . $this->getConfig()->getReleaseId();
 | 
				
			||||||
            $this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
 | 
					            $resultFetch = $this->runCommandRemote('ls -ld current | cut -d"/" -f2', $releaseToOverride);
 | 
				
			||||||
 | 
					            
 | 
				
			||||||
 | 
					            if ( $resultFetch ) {
 | 
				
			||||||
 | 
					                // If deployment configuration is rsync, include a flag to simply sync the deltas between the prior release
 | 
				
			||||||
 | 
					                // rsync: { copy: yes }
 | 
				
			||||||
 | 
					                $rsync_copy = $this->getConfig()->deployment("rsync");
 | 
				
			||||||
 | 
					                if ( $rsync_copy && is_array($rsync_copy) && $rsync_copy['copy'] ) {
 | 
				
			||||||
 | 
					                    $this->runCommandRemote('cp -R ' . $releasesDirectory . '/' . $releaseToOverride . ' ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    $this->runCommandRemote('mkdir -p ' . $releasesDirectory . '/' . $this->getConfig()->getReleaseId());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $command = 'rsync -avz '
 | 
					        $command = 'rsync -avz '
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user