mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 17:10:18 +01:00 
			
		
		
		
	[Nostromo] Make rsync inherit SSH configuration
This commit is contained in:
		
							parent
							
								
									ff6d8b174f
								
							
						
					
					
						commit
						ce88fc981e
					
				@ -34,6 +34,7 @@ class RsyncTask extends AbstractTask
 | 
				
			|||||||
    public function execute()
 | 
					    public function execute()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $flags = $this->runtime->getConfigOptions('rsync', '-avz');
 | 
					        $flags = $this->runtime->getConfigOptions('rsync', '-avz');
 | 
				
			||||||
 | 
					        $sshConfig = $this->runtime->getSSHConfig();
 | 
				
			||||||
        $user = $this->runtime->getEnvironmentConfig('user');
 | 
					        $user = $this->runtime->getEnvironmentConfig('user');
 | 
				
			||||||
        $host = $this->runtime->getWorkingHost();
 | 
					        $host = $this->runtime->getWorkingHost();
 | 
				
			||||||
        $hostPath = rtrim($this->runtime->getEnvironmentConfig('host_path'), '/');
 | 
					        $hostPath = rtrim($this->runtime->getEnvironmentConfig('host_path'), '/');
 | 
				
			||||||
@ -44,7 +45,7 @@ class RsyncTask extends AbstractTask
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $excludes = $this->getExcludes();
 | 
					        $excludes = $this->getExcludes();
 | 
				
			||||||
        $cmdRsync = sprintf('rsync %s %s ./ %s@%s:%s', $flags, $excludes, $user, $host, $targetDir);
 | 
					        $cmdRsync = sprintf('rsync -e "ssh -p %d %s" %s %s ./ %s@%s:%s', $sshConfig['port'], $sshConfig['flags'], $flags, $excludes, $user, $host, $targetDir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        /** @var Process $process */
 | 
					        /** @var Process $process */
 | 
				
			||||||
        $process = $this->runtime->runLocalCommand($cmdRsync, 600);
 | 
					        $process = $this->runtime->runLocalCommand($cmdRsync, 600);
 | 
				
			||||||
 | 
				
			|||||||
@ -279,7 +279,7 @@ class DeployCommandTest extends TestCase
 | 
				
			|||||||
            2 => 'git pull',
 | 
					            2 => 'git pull',
 | 
				
			||||||
            3 => 'composer install --dev',
 | 
					            3 => 'composer install --dev',
 | 
				
			||||||
            4 => 'composer dumpautoload --optimize',
 | 
					            4 => 'composer dumpautoload --optimize',
 | 
				
			||||||
            5 => 'rsync -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
					            5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
				
			||||||
            6 => 'git checkout master',
 | 
					            6 => 'git checkout master',
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -381,7 +381,7 @@ class DeployCommandTest extends TestCase
 | 
				
			|||||||
            2 => 'git pull',
 | 
					            2 => 'git pull',
 | 
				
			||||||
            3 => 'composer install --dev',
 | 
					            3 => 'composer install --dev',
 | 
				
			||||||
            4 => 'composer dumpautoload --optimize',
 | 
					            4 => 'composer dumpautoload --optimize',
 | 
				
			||||||
            5 => 'rsync -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
					            5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
				
			||||||
            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:clear --env=dev \\"',
 | 
					            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:clear --env=dev \\"',
 | 
				
			||||||
            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
 | 
					            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
 | 
				
			||||||
            8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
					            8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
				
			||||||
@ -486,7 +486,7 @@ class DeployCommandTest extends TestCase
 | 
				
			|||||||
            2 => 'git pull',
 | 
					            2 => 'git pull',
 | 
				
			||||||
            3 => 'composer install --dev',
 | 
					            3 => 'composer install --dev',
 | 
				
			||||||
            4 => 'composer dumpautoload --optimize',
 | 
					            4 => 'composer dumpautoload --optimize',
 | 
				
			||||||
            5 => 'rsync -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
					            5 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
				
			||||||
            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:clear --env=dev \\"',
 | 
					            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:clear --env=dev \\"',
 | 
				
			||||||
            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:warmup --env=dev \\"',
 | 
					            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console cache:warmup --env=dev \\"',
 | 
				
			||||||
            8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
					            8 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& sudo bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
				
			||||||
@ -589,7 +589,7 @@ class DeployCommandTest extends TestCase
 | 
				
			|||||||
            1 => 'git pull',
 | 
					            1 => 'git pull',
 | 
				
			||||||
            2 => 'composer install --dev',
 | 
					            2 => 'composer install --dev',
 | 
				
			||||||
            3 => 'composer dumpautoload --optimize',
 | 
					            3 => 'composer dumpautoload --optimize',
 | 
				
			||||||
            4 => 'rsync -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
					            4 => 'rsync -e "ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" -avz --exclude=.git --exclude=vendor --exclude=app/cache --exclude=app/log --exclude=web/app_dev.php ./ tester@testhost:/var/www/test',
 | 
				
			||||||
            5 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:clear --env=dev \\"',
 | 
					            5 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:clear --env=dev \\"',
 | 
				
			||||||
            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
 | 
					            6 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console cache:warmup --env=dev \\"',
 | 
				
			||||||
            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
					            7 => 'ssh -p 22 -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no tester@testhost sh -c \\"cd /var/www/test \\&\\& bin/console assets:install --env=dev --symlink --relative web\\"',
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user