Skip to content
Snippets Groups Projects
Commit eae46bdc authored by hahn's avatar hahn
Browse files

added converter task #4623

parent 0adb4dd0
Branches
No related tags found
1 merge request!9Rollout plugins - converter
......@@ -22,6 +22,22 @@ require_once("$sDocroot/../config/inc_projects_config.php");
require_once("$sDocroot/deployment/inc_functions.php");
require_once("$sDocroot/deployment/classes/project.class.php");
$aSkipped=array();
$aUntouched=array();
// ----------------------------------------------------------------------
// FUNCTIONS
// ----------------------------------------------------------------------
function getUrl($s){
return 'https://ci.iml.unibe.ch/deployment/'.$s.'/setup/';
}
// ----------------------------------------------------------------------
// MAIN
// ----------------------------------------------------------------------
echo "\n";
echo "===== IMLDEPLOYMENT - converter for rollout plugins\n";
echo "\n";
......@@ -38,9 +54,48 @@ foreach ($oPrj1->getProjects() as $sPrj) {
if(isset($aCfg['deploy']['enabled_rollout_plugin'])){
echo "SKIP: Project uses rollout plugin [".$aCfg['deploy']['enabled_rollout_plugin']."]\n";
} else {
echo "TODO: Project needs to be converted...\n";
print_r($aCfg['phases']['preview']['hosts']);
/*
echo "INFO: No rollout plugin is set - Project needs to be converted...\n";
$bSave=false;
if (preg_match('/_se$/', $aCfg['label'])){
echo "UNTOUCHED: project ending with _se\n";
$aUntouched[]=$sPrj.' - SE project - '.getUrl($sPrj);
/*
if ($aCfg['deploy']['enabled_rollout_plugin']){
$bSave=false;
echo " CONFLICT: rollout plugin was set to [".$aCfg['deploy']['enabled_rollout_plugin']."]\n";
echo " \n";
}
*
*/
} else {
foreach (array_keys($aCfg['phases']) as $sPhase){
echo "--- phase $sPhase \n";
if ($aCfg['phases'][$sPhase]['hosts']){
$bSave=true;
echo " TASK: target hosts detected: phases -> $sPhase -> hosts = " . $aCfg['phases'][$sPhase]['hosts'] . "\n";
echo " - set plugin [ssh] for rollout\n";
$aCfg['deploy']['enabled_rollout_plugin']='ssh';
echo " - set hosts for ssh plugin phases -> $sPhase -> plugins -> rollout -> ssh -> hosts = ".$aCfg['phases'][$sPhase]['hosts']."\n";
$aCfg['phases'][$sPhase]['plugins']['rollout']['ssh']['hosts']=$aCfg['phases'][$sPhase]['hosts'];
}
}
if(!$bSave){
echo "UNTOUCHED: No Deploy host was found.\n";
$aUntouched[]=$sPrj.' - no deploy host in any phase - '.getUrl($sPrj);
}
}
if($bSave){
echo "TODO: save new config\n";
} else {
echo "SKIP: do NOT saving config.\n";
$aSkipped[]=$sPrj;
}
// print_r($aCfg); exit;
/*
// convert
// ... and save
......@@ -57,4 +112,10 @@ foreach ($oPrj1->getProjects() as $sPrj) {
echo "\n";
}
echo "----------------------------------------------------------------------\n";
echo "processed: ".count($oPrj1->getProjects())."\n";
echo "skipped : ".count($aSkipped)."\n";
echo "untouched: ".count($aUntouched)." (watch them manually):\n";
print_r($aUntouched);
echo "done\n";
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment