diff --git a/public_html/deployment/config/inc_projects_config.php b/public_html/deployment/config/inc_projects_config.php index ba6b840691598fc57506ffc4b58079653fcf2cb0..f3d71fa4cd0edb142e70058a30bc93bb2b332820 100644 --- a/public_html/deployment/config/inc_projects_config.php +++ b/public_html/deployment/config/inc_projects_config.php @@ -35,28 +35,26 @@ $aConfig=array( // override for local development // ---------------------------------------------------------------------- -if ($_SERVER && array_key_exists("SERVER_NAME", $_SERVER)){ - switch ($_SERVER["SERVER_NAME"]) { - case "localhost": - case "dev.ci.iml.unibe.ch": - $aConfig['workDir']="D:\imldeployment"; - $aProjects["scrudu"]["phases"]["preview"]["url"]="http://localhost/deployment/"; - break; - case "ci.iml.unibe.ch": - - // synch der Pakete nur auf dem Livesystem - $aConfig['mirrorPackages']=array( - 'puppet'=>array( - 'type'=>'rsync', - 'runas'=>'www-data', // nur fuer commandline - 'target'=>'ladmin@calcium.iml.unibe.ch:/share/imldeployment', - )); - break; - - default: - break; - } +switch (php_uname("n")) { + case "USER": + case "dev.ci.iml.unibe.ch": + $aConfig['workDir']="D:\imldeployment"; + break; + + case "ci.iml.unibe.ch": + + // synch der Pakete nur auf dem Livesystem + $aConfig['mirrorPackages']=array( + 'puppet'=>array( + 'type'=>'rsync', + 'runas'=>'www-data', // nur fuer commandline + 'target'=>'ladmin@calcium.iml.unibe.ch:/share/imldeployment', + )); + break; + + default: + break; } $aConfig=array_merge($aConfig, array( diff --git a/public_html/index.php b/public_html/index.php index dfe84acff0ebb972a9143d754c8c1ded285d58c1..03d62698ce6de42ef81eb44abd9c25c9b188ff26 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -1,5 +1,5 @@ <?php - echo '<h1>' . $_SERVER["SERVER_NAME"] . '</h1><hr>'; + echo '<h1>' . php_uname("n") . '</h1><hr>'; ?> <a href="http://www.iml.unibe.ch/">IML Startseite</a> | diff --git a/shellscripts/cron_deployment.php b/shellscripts/cron_deployment.php index b0853ccb18e0930f9d11288b1e50d6e5042f7d26..51cd39fa37e91f4271d8cf699ce2615a0734511c 100644 --- a/shellscripts/cron_deployment.php +++ b/shellscripts/cron_deployment.php @@ -1,4 +1,10 @@ <?php +/** + * + * CRONJOB + * deploy all queued packages + * + */ // http://iml:deployment@ci.iml.unibe.ch/deployment/?prj=ci&action=deploy&par3=preview&confirm=1 @@ -11,8 +17,15 @@ echo "<h1>===== IMLDEPLOYMENT - deploy all projects =====</h1>\n"; foreach ($oPrj1->getProjects() as $sPrj) { $oPrj = new project($sPrj); + echo "----- $sPrj:\n"; foreach ($oPrj->getActivePhases() as $sPhase) { - echo $oPrj->deploy($sPhase); + $aTmp=$oPrj->getPhaseInfos($sPhase); + echo "$sPhase: "; + if (array_key_exists("version", $aTmp)){ + echo $oPrj->deploy($sPhase); + } else { + echo "SKIP - es ist nichts in der Queue<br>\n"; + } } echo "<br>\n"; } diff --git a/shellscripts/cron_sync_packages.php b/shellscripts/cron_sync_packages.php index 5120b41fedecdf931f3e732d9653319d380b0fa3..a4c3810803ae75767530578dcee717d034fad222 100644 --- a/shellscripts/cron_sync_packages.php +++ b/shellscripts/cron_sync_packages.php @@ -1,43 +1,43 @@ -<?php - /** - * - * FOR CRONJOB - * sync archive files - * - */ - - require_once(dirname(__DIR__)."/public_html/deployment/config/inc_projects_config.php"); - - echo "\n========= SYNC archive files ==========\n"; - - if (array_key_exists('mirrorPackages', $aConfig) && count($aConfig['mirrorPackages']) ){ - foreach (array_keys($aConfig["phases"]) as $sPhase){ - echo "\n\n===== phase $sPhase \n"; - foreach($aConfig['mirrorPackages'] as $sLabel=>$aTarget){ - echo "--- $sLabel\n"; - if (array_key_exists('type', $aTarget)){ - $sCmd=false; - $sSource=$aConfig["packageDir"]."/$sPhase/*"; - $sTarget=$aTarget['target']."/$sPhase"; - switch ($aTarget['type']) { - case 'rsync': - $sCmd="ls -l $sSource 2>/dev/null && /usr/bin/rsync --delete -rLv $sSource $sTarget"; - break; - default: - echo "ERROR: type ".$aTarget['type']." ist not supported (yet) - skipping."; - break; - } // switch - if ($sCmd) { - if ($aTarget['runas']) { - $sCmd="su - " . $aTarget['runas'] . " -c \"" . $sCmd . "\""; - } - echo "\$ $sCmd\n"; - $sOut=shell_exec($sCmd); - echo $sOut; - } - } - } // foreach - } // foreach - } - echo "\n\ndone.\n"; +<?php +/** + * + * CRONJOB + * sync archive files + * + */ + + require_once(dirname(__DIR__)."/public_html/deployment/config/inc_projects_config.php"); + + echo "\n========= SYNC archive files ==========\n"; + + if (array_key_exists('mirrorPackages', $aConfig) && count($aConfig['mirrorPackages']) ){ + foreach (array_keys($aConfig["phases"]) as $sPhase){ + echo "\n\n===== phase $sPhase \n"; + foreach($aConfig['mirrorPackages'] as $sLabel=>$aTarget){ + echo "--- $sLabel\n"; + if (array_key_exists('type', $aTarget)){ + $sCmd=false; + $sSource=$aConfig["packageDir"]."/$sPhase/*"; + $sTarget=$aTarget['target']."/$sPhase"; + switch ($aTarget['type']) { + case 'rsync': + $sCmd="ls -l $sSource 2>/dev/null && /usr/bin/rsync --delete -rLv $sSource $sTarget"; + break; + default: + echo "ERROR: type ".$aTarget['type']." ist not supported (yet) - skipping."; + break; + } // switch + if ($sCmd) { + if ($aTarget['runas']) { + $sCmd="su - " . $aTarget['runas'] . " -c \"" . $sCmd . "\""; + } + echo "\$ $sCmd\n"; + $sOut=shell_exec($sCmd); + echo $sOut; + } + } + } // foreach + } // foreach + } + echo "\n\ndone.\n"; ?> \ No newline at end of file