// Script arguments // ******************************* if (!isset($argv[1]) || $argv[1] !== 'dev' && $argv[1] !== 'uat' && $argv[1] !== 'prod') { echo "Usage: php " . $argv[0] . " dev|uat|prod\n"; exit(1); } // ******************************* // Script configuration // ******************************* $host = $maoDevHost; if ($argv[1] == 'uat') { $host = $maoUatHost; } else { if ($argv[1] == 'prod') { $host = $maoProdHost; } } // ******************************* // Start the build script // ******************************* // *** // Initial output Task::log("\n---------------------------------------\n"); Task::log("-------- Clear memcached on " . $host->getHostname() . " ({$argv[1]})\n\n"); // *** // Prompt for user password, if it's not hardcoded CliTask::promptAccountPassword($cogecoAccount); // *** $command = "php /var/www/scripts/memcached-clear.php"; SshTask::exec($host, $command); Task::log("- Clearing memcached completed\n");
$changesText = ViewTask::getLogEntriesText($logEntries); $changesHtml = ViewTask::getLogEntriesHtml($logEntries); // Load the email templates with the changes $emailText = ViewTask::load('views/template-release-text.php', array('changes' => $changesText), TRUE); $emailHtml = ViewTask::load('views/template-release-html.php', array('changes' => $changesHtml), TRUE); // Create the emails as files $emailFileBaseName = "release-prod-r{$workingCopy->info->commitRevision}"; EmailTask::createEmailFiles($emailFileBaseName, $emailHtml, $emailText); // ******************** // *** Deploy intermediate // // Sync files from the working copy to the temporary prod directory FileSyncTask::sync($rsyncOptions1); // Task::log("- Syncing intermediate directory {$syncDestinationDir1->path} with {$syncDestinationDir2->path}\n\n"); // $rsyncCommand = FileSyncTask::getRsyncCommand($rsyncOptions2); SshTask::exec($syncDestinationDir2->getHost(), $rsyncCommand); Task::log("\n"); // ******************** // *** Tag release // if ($build === 'prod') { SvnTask::tagRelease($maoTag, $workingCopy->dir->path, "Release to production - Revision: {$workingCopy->info->commitRevision}"); } // ******************** // *** Notify // $maoReleaseEmail->bodyHtml = $emailHtml; $maoReleaseEmail->bodyText = $emailText; EmailTask::sendEmail($emailConnector, $maoReleaseEmail);
// Convert log entries into text and html $changesText = ViewTask::getLogEntriesText($logEntries); $changesHtml = ViewTask::getLogEntriesHtml($logEntries); // Load the email templates with the changes $emailText = ViewTask::load('views/template-release-text.php', array('changes' => $changesText), TRUE); $emailHtml = ViewTask::load('views/template-release-html.php', array('changes' => $changesHtml), TRUE); // Create the emails as files $emailFileBaseName = "release-prod-r{$workingCopy->info->commitRevision}"; EmailTask::createEmailFiles($emailFileBaseName, $emailHtml, $emailText); // ******************** // *** Tag release // if ($build === 'prod') { SvnTask::tagRelease($maoTag, $workingCopy->dir->path, "Release to production - Revision: {$workingCopy->info->commitRevision}\n"); } // ******************** // *** Notify // $maoReleaseEmail->bodyHtml = $emailHtml; $maoReleaseEmail->bodyText = $emailText; try { EmailTask::sendEmail($emailConnector, $maoReleaseEmail); } catch (\Exception $e) { Task::log($e->getMessage()); } // ******************** // *** Deactivate maintenance mode // $command = "php /var/www/scripts/maintenance-mode.php off prod"; SshTask::exec($remoteHost, $command);