$revisionToCheckOut = 0; $sourceDb = $localPublicDb; $destinationDb = $prodPublicDb; $syncDestinationDir1 = $preprodDir; $syncDestinationDir2 = $prodDir; $deployDatabase = TRUE; if ($build !== 'prod') { // Non-prod testing $cogecoCaReleaseEmail->to = array('*****@*****.**'); } $sourceDbSchema = $localPublicDb->getDbName(); $destinationDbSchema = $preprodPublicDb->getDbName(); $rsyncOptions1 = new RsyncOptions($workingCopy->dir, $syncDestinationDir1); $rsyncOptions1->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->excludesAppend(array('/dev/', '/db/', '/build.xml', '/build.properties')); $rsyncOptions2 = new RsyncOptions(new Dir($syncDestinationDir1->getPath()), new Dir($syncDestinationDir2->getPath())); $rsyncOptions2->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->useSsh(FALSE)->excludesAppend(array('/dev/', '/db/', '/build.xml', '/build.properties')); // ******************************* // Start the build script // ******************************* // Config::enableLogging(TRUE, TRUE); // ******************** // *** Initial output // Task::log("\n---------------------------------------\n"); Task::log("-------- Deploy Prod\n\n"); // Chicken quit if ($build === 'prod') { CliTask::promptQuit('Deploying to production! Continue? [y/n]: '); } // Prompt for user password, if it's not hardcoded
// Start the build script // ******************************* Config::enableLogging(); // ******************** // *** Initial output // Task::log("\n---------------------------------------\n"); Task::log("-------- Sync repository\n\n"); // Prompt for user password, if it's not hardcoded CliTask::promptAccountPassword($cogecoAccount); // ******************** // Prompt user input // // Prompt user to input a local folder to sync $workingCopy = CliTask::promptRepo(); Task::log("You chose " . $workingCopy->getRepoUrl() . "\n\n"); // Prompt user to chose a remote folder to sync to $selectedDir = CliTask::promptDir(array($devDir, $dev2Dir, $uatDir, $uat2Dir, $uat3Dir, $preprodDir)); Task::log("You chose " . $selectedDir->getPath() . "\n\n"); CliTask::promptQuit('Continue? [y/n]: '); // ******************** // *** Checkout // SvnTask::checkoutClean($workingCopy); SvnTask::createManifestFile($workingCopy, FALSE, TRUE); // ******************** // Sync files and folders // $rsyncOptions = new RsyncOptions($workingCopy->dir, $selectedDir); $rsyncOptions->chmod('Du=rwx,Dg=rwx,Do=rwx,Fu=rw,Fg=rw,Fo=r')->excludesAppend(array('/dev/', '/db/')); FileSyncTask::sync($rsyncOptions);
if ($build === 'prod') { $remoteFileOld = new File('/var/www/prod/logs/', 'orders.log', $prodHost); $sendOrdersEmail->to = array('*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**', '*****@*****.**'); } else { $remoteFileOld = new File('/var/www/prod/logs/', 'orders2.log', $prodHost); } // Common configs for test/prod $destinationDirPath = '\\eBusiness_Cust_Data_Mngt\\Orders_Archives'; $destDirPathPrefix = '\\\\mtl-fs1\\dept'; $destDirPathPrefixCygwin = 'S:'; $sharedDestinationDir = $destDirPathPrefix . $destinationDirPath; $localDestinationDir = $destDirPathPrefixCygwin . $destinationDirPath; $remoteFileNew = new File($remoteFileOld->dir, 'orders_' . Config::get('datetime.slug') . '.log'); $destinationFile = new File($localDestinationDir, $remoteFileNew->name); $rsyncOptions = new RsyncOptions($remoteFileNew, $destinationFile); $rsyncOptions->chmod('u=rw,g=rw,o='); // ******************************* // Start the build script // ******************************* Config::enableLogging(); // ******************** // *** Initial output // Task::log("\n---------------------------------------\n"); Task::log("- Move cogeco.ca orders.log to secured shared drive\n\n"); // Prompt for user password, if it's not hardcoded CliTask::promptAccountPassword($cogecoAccount); // ******************** // *** Move the file to the shared drive // // Firstly, move it on the remote server