Exemplo n.º 1
0
Task::log("- Last tag commit revision: {$lastTagRevision}\n");
if ($build === 'prod' && $workingCopy->info->commitRevision <= $lastTagRevision) {
    Task::log("The revision you want to tag is lower than or equal to the last tagged release revision\n");
    Task::log("Custom tags should be created manually\n\n");
    exit;
}
// ********************
// *** Prep notification email
//
$logEntries = SvnTask::getLogEntries($workingCopy, $lastTagRevision + 1, $workingCopy->info->commitRevision);
// 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);
// ********************
// *** 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");
// ********************
Exemplo n.º 2
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);
Exemplo n.º 3
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);
Exemplo n.º 4
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
if ($deployDatabase) {
    MysqlTask::importDump($destinationDb, $mysqlDumpFile->getPath(), $destinationDbSchema);
}
// Sync files from preprod
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");
// ********************
// *** Tag
//
if ($build === 'prod') {
    SvnTask::commit($workingCopy, "Release to Production");
}
// ********************
// *** Notify
//
$cogecoCaReleaseEmail->bodyHtml = ViewTask::load('views/template-release-html.php', array('svnEntries' => $projectSvnLogEntries, 'deployeur' => $cogecoAccount->username), TRUE);
$cogecoCaReleaseEmail->bodyText = ViewTask::load('views/template-release-text.php', array('svnEntries' => $projectSvnLogEntries, 'deployeur' => $cogecoAccount->username), TRUE);
EmailTask::sendEmail($emailConnector, $cogecoCaReleaseEmail);
Exemplo n.º 5
0
SshTask::moveFile($remoteFileOld, $remoteFileNew->getPath());
//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);