Esempio n. 1
0
$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);
Esempio n. 2
0
        $dateTime['seconds'] = 0;
        $dateTime['minutes'] = 45;
        $dateTime['hours'] = 14;
    } else {
        $dateTime['seconds'] = 0;
        $dateTime['minutes'] = 45;
        $dateTime['hours'] = 9;
    }
}
$dateTime['0'] = strtotime(sprintf("%s-%s-%s %s:%s:%s", $dateTime['year'], $dateTime['mon'], $dateTime['mday'], $dateTime['hours'], $dateTime['minutes'], $dateTime['seconds']));
$deployTime = @ucfirst(strftime("%A le %d %B %Y à %Hh%M", $dateTime['0']));
// *******************************
// Get the latest SVN entry logs up until the last release to production
// *******************************
$latestSvnLogEntries = SvnTask::getLatestLogEntries($workingCopy);
$projectSvnLogEntries = array();
foreach ($latestSvnLogEntries as $revision => $entry) {
    if (stripos($entry->message, "Release to Production") !== FALSE) {
        break;
    } else {
        $projectSvnLogEntries[$revision] = $entry;
    }
}
unset($latestSvnLogEntries);
// ********************
// *** Prep notification email and send it
//
$emailHtml = ViewTask::load('views/template-deploy-request-html.php', array('svnEntries' => $projectSvnLogEntries, 'deployTime' => $deployTime), TRUE);
$deployRequestEmail->bodyHtml = $emailHtml;
EmailTask::sendEmail($emailConnector, $deployRequestEmail);
Esempio n. 3
0
Task::log("- Syncing revision {$workingCopy->info->commitRevision} with {$syncDestinationDir1->getPath()} on {$syncDestinationDir1->getHost()->hostname}\n\n");
//
FileSyncTask::sync($rsyncOptions1);
// ********************
// *** Deploy
//
TimerTask::start();
// Import DB
MysqlTask::importDump($destinationDb, $tmpDumpFile->getPath(), $destinationDbSchema);
//
Task::log("- Syncing intermediate directory {$syncDestinationDir1->path} with {$syncDestinationDir2->path}\n\n");
//
$rsyncCommand = FileSyncTask::getRsyncCommand($rsyncOptions2);
SshTask::exec($syncDestinationDir1->getHost(), $rsyncCommand);
// Stop the deploy timer and log it
TimerTask::stop();
Task::log("Deploy time: " . TimerTask::getLastElapsedTime() . "\n\n");
exit;
// ********************
// *** Tag
//
if ($build === 'prod') {
    SvnTask::commit($workingCopy, "Release to Production");
}
// ********************
// *** Notify
//
$cogecoCaReleaseEmail->bodyHtml = ViewTask::load('views/template-release-html.php', array('changes' => ''), TRUE);
$cogecoCaReleaseEmail->bodyText = ViewTask::load('views/template-release-text.php', array('changes' => ''), TRUE);
EmailTask::sendEmail($emailConnector, $cogecoCaReleaseEmail);
Esempio n. 4
0
//SshTask::copyFile($remoteFileOld, $remoteFileNew->getPath());
// Sync from the remote server to the shared drive
FileSyncTask::sync($rsyncOptions);
// Verify that the file was created on the shared drive and then delete it on the remote server if it exists
if (!is_file($destinationFile->getPath())) {
    throw new \Exception('File was not successfully copied to the shared drive!');
}
//If the file was successfully transferred, delete it on the remote host
//SshTask::deleteFile($remoteFileNew);
// ********************
// *** Notify
//
$pathsHtml = <<<HTML
<p>
\t<a href="file:{$sharedDestinationDir}">
\t\t{$sharedDestinationDir}
\t</a>
\t<br />
\t<a href="file:{$sharedDestinationDir}\\{$destinationFile->name}">
\t\t{$sharedDestinationDir}\\{$destinationFile->name}
\t</a>
</p>
HTML;
$pathsText = <<<TEXT
\t{$sharedDestinationDir}
\t{$sharedDestinationDir}\\{$destinationFile->name}
TEXT;
$sendOrdersEmail->bodyHtml = ViewTask::load('views/send-orders-html.php', array('pathToLogs' => $pathsHtml), TRUE);
$sendOrdersEmail->bodyText = ViewTask::load('views/send-orders-text.php', array('pathToLogs' => $pathsText), TRUE);
EmailTask::sendEmail($emailConnector, $sendOrdersEmail);