mirror of
				https://github.com/hauke68/Magallanes.git
				synced 2025-11-04 09:00:18 +01:00 
			
		
		
		
	Deploy Summary info. Deploy lock: only run one instance at a time.
This commit is contained in:
		
							parent
							
								
									c9759b19c0
								
							
						
					
					
						commit
						d5ebf6e6e3
					
				@ -25,17 +25,49 @@ class Mage_Command_BuiltIn_Deploy
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    public function run()
 | 
					    public function run()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        $this->getConfig()->setReleaseId(date('YmdHis'));
 | 
					        // Check if Environment is not Locked
 | 
				
			||||||
        $failedTasks = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->_startTime = time();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    	$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
 | 
					    	$lockFile = '.mage/' . $this->getConfig()->getEnvironment() . '.lock';
 | 
				
			||||||
    	if (file_exists($lockFile)) {
 | 
					    	if (file_exists($lockFile)) {
 | 
				
			||||||
    		Mage_Console::output('<red>This environment is locked!</red>', 1, 2);
 | 
					    		Mage_Console::output('<red>This environment is locked!</red>', 1, 2);
 | 
				
			||||||
    		return;
 | 
					    		return;
 | 
				
			||||||
    	}
 | 
					    	}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    	// Check for running instance and Lock
 | 
				
			||||||
 | 
					    	if (file_exists('.mage/~working.lock')) {
 | 
				
			||||||
 | 
					    		Mage_Console::output('<red>There is already an instance of Magallanes running!</red>', 1, 2);
 | 
				
			||||||
 | 
					    		return;
 | 
				
			||||||
 | 
					    	} else {
 | 
				
			||||||
 | 
					    		touch('.mage/~working.lock');
 | 
				
			||||||
 | 
					    	}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Release ID
 | 
				
			||||||
 | 
					        $this->getConfig()->setReleaseId(date('YmdHis'));
 | 
				
			||||||
 | 
					        $failedTasks = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Deploy Summary
 | 
				
			||||||
 | 
					        Mage_Console::output('<dark_gray>Deploy summary</dark_gray>', 1, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Deploy Summary - Environment
 | 
				
			||||||
 | 
					        Mage_Console::output('<dark_gray>Environment:</dark_gray> <purple>' . $this->getConfig()->getEnvironment() . '</purple>', 2, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Deploy Summary - Releases
 | 
				
			||||||
 | 
					        if ($this->getConfig()->release('enabled', false)) {
 | 
				
			||||||
 | 
					        	Mage_Console::output('<dark_gray>Release ID:</dark_gray>  <purple>' . $this->getConfig()->getReleaseId() . '</purple>', 2, 1);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Deploy Summary - SCM
 | 
				
			||||||
 | 
					        if ($this->getConfig()->deployment('scm', false)) {
 | 
				
			||||||
 | 
					        	$scmConfig = $this->getConfig()->deployment('scm');
 | 
				
			||||||
 | 
					        	if (isset($scmConfig['branch'])) {
 | 
				
			||||||
 | 
					        		Mage_Console::output('<dark_gray>SCM Branch:</dark_gray>  <purple>' . $scmConfig['branch'] . '</purple>', 2, 1);
 | 
				
			||||||
 | 
					        	}
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Deploy Summary - Separator Line
 | 
				
			||||||
 | 
					        Mage_Console::output('', 0, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        $this->_startTime = time();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Run Pre-Deployment Tasks
 | 
					        // Run Pre-Deployment Tasks
 | 
				
			||||||
        $this->_runNonDeploymentTasks('pre-deploy', $this->getConfig(), 'Pre-Deployment');
 | 
					        $this->_runNonDeploymentTasks('pre-deploy', $this->getConfig(), 'Pre-Deployment');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -168,6 +200,11 @@ class Mage_Command_BuiltIn_Deploy
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // Send Notifications
 | 
					        // Send Notifications
 | 
				
			||||||
        $this->_sendNotification();
 | 
					        $this->_sendNotification();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        // Unlock
 | 
				
			||||||
 | 
					        if (file_exists('.mage/~working.lock')) {
 | 
				
			||||||
 | 
					        	unlink('.mage/~working.lock');
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
 | 
				
			|||||||
@ -12,6 +12,15 @@ class Mage_Console
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    public function run($arguments)
 | 
					    public function run($arguments)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					    	register_shutdown_function(function() {
 | 
				
			||||||
 | 
					    		// Only Unlock if there was an error
 | 
				
			||||||
 | 
					            if (error_get_last() !== null) {
 | 
				
			||||||
 | 
					            	if (file_exists('.mage/~working.lock')) {
 | 
				
			||||||
 | 
					            		unlink('.mage/~working.lock');
 | 
				
			||||||
 | 
					            	}
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					    	});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $configError = false;
 | 
					        $configError = false;
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            // Load Config
 | 
					            // Load Config
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user