Skip to content
Snippets Groups Projects
Commit c4d226b2 authored by Hahn Axel (hahn)'s avatar Hahn Axel (hahn)
Browse files

task#1390 - CI Webgui: update config - activate phase by checkbox, activate phase without checkbox

parent b641e871
Branches
No related tags found
No related merge requests found
......@@ -123,12 +123,12 @@
"class-project-info-deploy-moving-queue-to-repo": "Verschiebe queue in das Puppet-Verzeichnis...",
"class-project-info-deploy-synching-package": "Synchronisiere Paket - %s",
"class-project-info-deploy-skip-sync": "SKIP: Synchronisationstyp "%s" wird (noch) nicht unterstützt.",
"class-project-info-deploy-start-puppet": "Starte Puppet Agent...",
"class-project-info-deploy-start-puppet-skip": "SKIP: es wurde kein Puppet Host definiert. Die Installation erfolgt beim nächsten Start des Puppet Agent auf dem Zielsystem (ca. 30 min).",
"class-project-info-deploy-start-by-method": "Starte Installation auf Zielhosts",
"class-project-info-deploy-start-by-method-skip": "SKIP: es gibt nichts zu tun. Wurde keine Installationsart und/ oder kein Ziel Host definiert.",
"class-project-info-deploy-successful": "Das Deployment wurde erfolgreich abgeschlossen.",
"class-project-info-accept-overview": "Info: in der Phase "%s" ist installiert:",
"class-project-info-accept-version-and-next-phase": "Die aktuelle Version [%s] wird nun in die Queue der Phase [%s] gestellt.",
"class-project-info-setup-phaseinfos": "Gib die URLs der jeweiligen Phasen an. Wird keine URL eingetragen, ist die jeweilige Phase nicht aktiv.<br>Der Puppet-Host ist optional anzugeben und für die erste Phase %s wichtig. Der Sysadmin muss zudem diesen Host in Puppet konfigurieren.",
"class-project-info-setup-phaseinfos": "Aktiviere die Phasen des Projektes und gib die URLs der jeweiligen Applikationen an.<br>Der Sysadmin muss zudem die einzelnen Hosts in Puppet konfigurieren - bitte neu zuverwendende Server mit ihm abstimmen.",
"class-project-info-setup-ssh-and-puppet-ok": "OK - SSH-Verbindung zu %s und Aufruf des Puppet Agent erfolgreich.",
"class-project-info-setup-projectId": "ID des neuen Projekts",
"class-project-info-setup-projectId-placeholder": "Projekt: Kleinbuchstaben a-z, Ziffern, Minus, Unterstrich",
......@@ -227,6 +227,9 @@
"deploytimes": "Deployment Zeitpunkte",
"deploytimes-immediately": "Ein Archiv in der Queue wird sofort ins Repo gestellt.",
"deploymethod": "Deployment-Methode",
"deploymethod-none": "Keine Aktion anstossen.",
"deploymethod-puppet": "Puppet aufrufen",
"deploymethod-sshproxy": "Skript via SSH-Proxy starten",
"description": "Beschreibung",
"developer": "Entwickler",
"dir-archive": "Archiv-Verzeichnis",
......@@ -256,6 +259,8 @@
"phase": "Phase",
"phase-details": "Details",
"phase-details-hint": "Details zur Phase [%s]",
"phase-is-active": "Phase aktivieren",
"phase-targethosts": "Zielsysteme",
"phases": "Phasen",
"project": "Projekt",
"projectdescription": "Kurzbeschreibung",
......@@ -286,6 +291,7 @@
"versions": "Versionen",
"warning": "WARNUNG",
"way-of-packages": "Weg der Pakete",
"yes": "ja",
"onhold": "Queue",
"ready2install" : "Puppet",
......
......@@ -124,12 +124,12 @@
"class-project-info-deploy-synching-package": "Synchronizing package - %s",
"class-project-info-deploy-skip-sync": "SKIP: Synchronisation type &quot;%s&quot; is not supported (yet).",
"class-project-info-deploy-start-puppet": "Starting Puppet Agent...",
"class-project-info-deploy-start-puppet-skip": "SKIP: no puppet host was defined. The installation will be done at the next run of the puppet agent (every 30 min).",
"class-project-info-deploy-start-by-method": "Starting installation to target hosts",
"class-project-info-deploy-start-by-method-skip": "SKIP: nothing to do. No method an/ or target host were defined.",
"class-project-info-deploy-successful": "The deployment was finished successfully.",
"class-project-info-accept-overview": "Info: in the phase &quot;%s&quot; is installed:",
"class-project-info-accept-version-and-next-phase": "The current version [%s] will be put to the queue of phase [%s].",
"class-project-info-setup-phaseinfos": "Enter the urls of each phase. Where you don't enter a url the phase is not active.<br>The puppet host is optional and important for the first phase %s. Additionally the system administrator must configure this host to run the puppet agent on demand.",
"class-project-info-setup-phaseinfos": "Activate the needed phases for your project. Enter the urls of each phase.<br>Fore new hosts: contact the system administrator - he must configure the hosts before the project can be installed there.",
"class-project-info-setup-ssh-and-puppet-ok": "OK - SSH connection to %s and the start of Puppet Agent was successful.",
"class-project-info-setup-projectId": "ID of the new project",
"class-project-info-setup-projectId-placeholder": "Project: lowercase letters a-z, digits, minus, underscore",
......@@ -226,6 +226,10 @@
"defaultbranch": "[default: master or trunk]",
"deploy": "Deploy",
"deploy-hint": "Deploy queue of phase [%s]",
"deploymethod": "Deployment method",
"deploymethod-none": "None. Do not trigger any action.",
"deploymethod-puppet": "Run Puppet on target host(s)",
"deploymethod-sshproxy": "Run a script via SSH-proxy",
"deploytimes": "Deploy time window",
"deploytimes-immediately": "A package in the queue will be deployed immediately.",
"description": "Description",
......@@ -241,6 +245,7 @@
"fileprefix-label": "File prefix <span class=\"error\"><br>It cannot be changed after the first build!</span>",
"finished": "Fisnished",
"gotop": "top",
"hosts": "Hosts",
"hostname4puppet": "Hostname to start puppet agent",
"inactive": "inactive",
"info": "Info",
......@@ -256,6 +261,8 @@
"phase": "Phase",
"phase-details": "Details",
"phase-details-hint": "Details of phase [%s]",
"phase-is-active": "Activate phase",
"phase-targethosts": "Target hosts",
"phases": "Phases",
"project": "Project",
"projectdescription": "Short description",
......@@ -286,6 +293,7 @@
"versions": "Versions",
"warning": "WARNING",
"way-of-packages": "Weg der Pakete",
"yes": "yes",
"onhold": "Queue",
"ready2install" : "Puppet",
......
......@@ -808,7 +808,7 @@ class project extends base {
*/
public function isActivePhase($sPhase) {
return (
array_key_exists($sPhase, $this->_aPrjConfig["phases"]) && array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) && $this->_aPrjConfig["phases"][$sPhase]["url"]
array_key_exists("active", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["active"][0] : false
);
}
......@@ -1869,19 +1869,43 @@ class project extends base {
// --------------------------------------------------
// move the queue link to the repo name
// run action to install
// --------------------------------------------------
// TODO: run puppet agent on target server(s) - for preview only
if (array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) && $this->_aPrjConfig["phases"][$sPhase]["puppethost"]
) {
$sReturn.='<h3>' . t("class-project-info-deploy-start-puppet") . '</h3>';
$sDeploymethod = array_key_exists("deploymethod", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["deploymethod"] : "none";
$sTargethosts=array_key_exists("hosts", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["hosts"] : '';
$sReturn.='<h3>' . t("class-project-info-deploy-start-by-method") . ' :: '.$sDeploymethod.'</h3>'
.'<p>'
.t("deploymethod-$sDeploymethod").'<br>'
.t("phase-targethosts").': '.($sTargethosts ? $sTargethosts : t("none"))
.'</p>'
;
if ($sDeploymethod==="none" || !$sTargethosts){
$sReturn.=t("class-project-info-deploy-start-by-method-skip") . "<br>";
} else {
$aTargethosts=explode(',', $sTargethosts);
foreach ($aTargethosts as $sTargethost){
$sReturn.='<h4>' . $sDeploymethod . ' - '.$sTargethost.'</h4>';
$sCmd='';
switch($sDeploymethod){
case 'puppet':
$sCmd = 'ssh ' . $this->_aConfig["installPackages"]["user"]
. '@' . $this->_aPrjConfig["phases"][$sPhase]["puppethost"]
. ' ' . $this->_aConfig["installPackages"]["command"];
// | fgrep -i Deploy
break;;
// TODO: we don't have any proxy yet
case 'sshproxy__AS_EXAMPLE_ONLY':
$sCmd = 'ssh ' . $this->_aConfig["installPackages"]["sshproxy"]["user"]
. '@' . $this->_aConfig["installPackages"]["sshproxy"]["host"]
. ' ' . sprintf($this->_aConfig["installPackages"]["sshproxy"]["command"], $sTargethost);
break;;
}
if ($sCmd){
// $sReturn.=$sCmd.'<br>';
$sReturn.=$this->_execAndSend("$sCmd");
} else {
$sReturn.=t("class-project-info-deploy-start-puppet-skip") . "<br>";
}
}
}
$aActionList['iActive'] ++;
$this->_TempFill($sReturn, $aActionList);
......@@ -2987,13 +3011,33 @@ class project extends base {
);
foreach (array_keys($this->getPhases()) as $sPhase) {
$sUrl = array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["url"] : "";
// $aTmp=parse_url($sUrl); $sPuppethost=$aTmp["host"];
// for migration - take "puppethost":
$sPuppethost = array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["puppethost"] : "";
$bActivePhase = $sPuppethost>'';
$bActivePhase = array_key_exists("active", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["active"][0] : $bActivePhase;
$sDeployhosts = array_key_exists("puppethost", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["puppethost"] : "";
$sDeployhosts = array_key_exists("hosts", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["hosts"] : $sDeployhosts;
$sDeploymethod = $sPuppethost ? "puppet" : "none";
$sDeploymethod = array_key_exists("deploymethod", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["deploymethod"] : $sDeploymethod;
$sUrl = array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["url"] : "";
// TODO:
/*
$bActivePhase = $this->isActivePhase();
$sUrl = array_key_exists("url", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["url"] : "";
$sDeploymethod = array_key_exists("deploymethod", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["deploymethod"] : "";
$sDeployhosts = array_key_exists("hosts", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["hosts"] : "none";
*/
$sDeploytimes = array_key_exists("deploytimes", $this->_aPrjConfig["phases"][$sPhase]) ? $this->_aPrjConfig["phases"][$sPhase]["deploytimes"] : "";
$sDivId4PhaseSettings='divSettings'.$sPhase;
$sDivId4TargetHosts='divSettings'.$sPhase.'hosts';
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'markup',
'value' => ''
// .'<pre>'.print_r($this->_aPrjConfig["phases"][$sPhase], 1).'</pre>'
. '<a class="'.$sPhase.'">'
. t("phase") . ' ' . $sPhase
. ($sUrl . $sPuppethost ? '' : ' (' . t("inactive") . ')')
......@@ -3002,6 +3046,30 @@ class project extends base {
. '<tbody>'
. '<tr><td class="' . ($sUrl . $sPuppethost ? $sPhase : '') . '">'
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'checkbox',
'name' => 'phases[' . $sPhase . '][active]',
'label' => t("phase-is-active"),
// 'value' => $bUsePuppet,
'required' => false,
'validate' => 'isastring',
// 'size' => 100,
// 'placeholder' => '...',
'options' => array(
'1' => array(
'label' => t("yes"),
'checked' => $bActivePhase,
'onclick' => '$(\'#'.$sDivId4PhaseSettings.'\').css(\'display\', (this.checked ? \'block\' : \'none\') )',
),
),
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'markup',
'value' => ''
.'<div id="'.$sDivId4PhaseSettings.'" '.($bActivePhase ? '' : ' style="display: none;"').'">'
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'text',
'name' => 'phases[' . $sPhase . '][url]',
......@@ -3012,16 +3080,51 @@ class project extends base {
'size' => 100,
'placeholder' => 'http://' . $sPhase . '.[' . t("project") . '].[...]/',
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'radio',
'name' => 'phases[' . $sPhase . '][deploymethod]',
'label' => t("deploymethod"),
// 'value' => $bUsePuppet,
// 'required' => 'required',
'validate' => 'isastring',
// 'size' => 100,
// 'placeholder' => '...',
'options' => array(
'none' => array(
'label' => t("deploymethod-none"),
'checked' => $sDeploymethod==="none",
'onclick' => '$(\'#'.$sDivId4TargetHosts.'\').css(\'display\', (this.checked ? \'none\' : \'block\') )',
),
'puppet' => array(
'label' => t("deploymethod-puppet"),
'checked' => $sDeploymethod==="puppet",
'onclick' => '$(\'#'.$sDivId4TargetHosts.'\').css(\'display\', (this.checked ? \'block\' : \'none\') )',
),
'sshproxy' => array(
'label' => t("deploymethod-sshproxy"),
'checked' => $sDeploymethod==="sshproxy",
'onclick' => '$(\'#'.$sDivId4TargetHosts.'\').css(\'display\', (this.checked ? \'block\' : \'none\') )',
),
),
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'markup',
'value' => ''
.'<div id="'.$sDivId4TargetHosts.'" '.($sDeploymethod!=="none" ? '' : ' style="display: none;"').'">'
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'text',
'name' => 'phases[' . $sPhase . '][puppethost]',
'label' => t("hostname4puppet"),
'value' => $sPuppethost,
'name' => 'phases[' . $sPhase . '][hosts]',
'label' => t("phase-targethosts"),
'value' => $sDeployhosts,
// 'required' => 'required',
'validate' => 'isastring',
'size' => 100,
'placeholder' => '',
'placeholder' => 'FQDN1,FQDN2',
);
/*
if ($sPuppethost) {
// add ssh host key
......@@ -3047,44 +3150,6 @@ class project extends base {
. '</div></div>',
);
}
/*
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'text',
'name' => 'phases[' . $sPhase . '][hosts]',
'label' => t("hosts"),
'value' => $sPuppethost,
// 'required' => 'required',
'validate' => 'isastring',
'size' => 100,
'placeholder' => 'FQDN1,FQDN2,...',
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'radio',
'name' => 'phases[' . $sPhase . '][deploymethod]',
'label' => t("deploymethod"),
// 'value' => $bUsePuppet,
'required' => 'required',
'validate' => 'isastring',
// 'size' => 100,
// 'placeholder' => '...',
'options' => array(
'none' => array(
'label' => t("none"),
'checked' => false,
),
'puppet' => array(
'label' => t("usepuppet"),
'checked' => false,
),
'sshproxy' => array(
'label' => t("sshproxy"),
'checked' => false,
),
),
);
*
*/
// when to deploy
......@@ -3098,6 +3163,11 @@ class project extends base {
'size' => 100,
'placeholder' => implode(", ", $this->_aConfig["phases"][$sPhase]["deploytimes"]),
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'markup',
'value' => ''
.'</div></div>'
);
$aForms["setup"]["form"]['input' . $i++] = array(
'type' => 'markup',
'value' => '</td></tr></tbody></table>',
......
......@@ -203,7 +203,7 @@ input[type="radio"], input[type="checkbox"] {
float: left;
}
input[type="radio"]:checked+label, input[type="checkbox"]:checked+label{
color:#000;background: #f8f8d0 !important;
color:#000; font-weight: bold;
}
.checkbox label, .radio label {
display: block;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment