diff --git a/config/lang/de.json b/config/lang/de.json index abfc36dfd4e81d4e66010bd3ff316aadcf9d6cfb..1a5ef39f412236844859fc6d0ce224c5575ace9a 100644 --- a/config/lang/de.json +++ b/config/lang/de.json @@ -237,6 +237,8 @@ "defaults-all-phases": "Default-Werte (für alle Phasen)", "delete": "Löschen", "deploy": "Deploy", + "deploy-configfile": "Konfiguration", + "deploy-configfile-hint": "Hier können Variablen in Bash-Syntax hinterlegt werden, die sich vom onbuild oder ondeploy Hook lesen lassen.", "deploy-hint": "Deploy der Queue von Phase [%s]", "deploy-impossible": "Deploy der Queue von Phase [%s] ist nicht möglich.", "deploy-settings": "Deployment-Einstellungen", diff --git a/config/lang/en.json b/config/lang/en.json index 5f70dc241f4d35d6eb768e75bcbe9cbb52199afd..969d944b89cc275167bb6fadbe8ab47123f1ed0a 100644 --- a/config/lang/en.json +++ b/config/lang/en.json @@ -239,6 +239,8 @@ "defaults-all-phases": "Default values (for all phases)", "delete": "Delete", "deploy": "Deploy", + "deploy-configfile": "Configuration", + "deploy-configfile-hint": "Here you can place variables in Bash syntax that onbuild oder ondeploy hook can read.", "deploy-hint": "Deploy queue of phase [%s]", "deploy-impossible": "Deploy queue of phase [%s] is not possible.", "deploy-settings": "Deployment settings", diff --git a/config/inc_user2roles.php b/hooks/templates/inc_user2roles.php.erb similarity index 64% rename from config/inc_user2roles.php rename to hooks/templates/inc_user2roles.php.erb index bba2fe5e5138e695fc503e0d5bc89d49c1861f59..a42b5862a2ae4f3c5682b3ac55453c1578a5fcd2 100644 --- a/config/inc_user2roles.php +++ b/hooks/templates/inc_user2roles.php.erb @@ -10,10 +10,6 @@ return array( // "authenticated" => array(), // "developer" => array(), // "projectmanager" => array(), - "admin" => array( - "cliadmin", // generic cli user from user class - "hahn", - "dschueler", - ), + "admin" => array(<%= @replace["adminusers"] %>), ); diff --git a/public_html/deployment/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php index 3b26e271ad3859ff74015d9138052a1ee638f9f5..a8f38502842d74c055d39dd4c18e885876886bb8 100644 --- a/public_html/deployment/classes/formgen.class.php +++ b/public_html/deployment/classes/formgen.class.php @@ -283,11 +283,11 @@ class formgen { case "textarea": $this->_checkReqiredKeys($elementData, array("name")); - $sFormElement.=' <textarea id="' . $sId . '" '; + $sFormElement.=' <textarea id="' . $sId . '" class="form-control col-sm-10" '; $aAllowedHtmlAttributes["text"] = explode(",", ""); $sFormElement.=$this->_addHtmlAtrributes(explode(",", "$sDefaultAttributes,name,onkeyup,onkeydown,onchange,placeholder,required,cols,rows"), $elementData); // $sFormElement.=$this->_addHtmlAtrributes(array("name", "value", "size", "placeholder", "required"), $elementData); - $sFormElement.='></textarea>'; + $sFormElement.='>'.$elementData['value'].'</textarea>'; $sFormElement.="\n"; $sLabelElement = $this->_addLabel($sLabelText, $sId, "control-label col-sm-2"); diff --git a/public_html/deployment/classes/htmlguielements.class.php b/public_html/deployment/classes/htmlguielements.class.php index 970d8c1408dbd8038135e8b3e73f5634ad78effa..7eb28ba75d56bac71977571f858d0ae39cb8b99e 100644 --- a/public_html/deployment/classes/htmlguielements.class.php +++ b/public_html/deployment/classes/htmlguielements.class.php @@ -151,6 +151,7 @@ class htmlguielements{ 'close'=>'fas fa-times', 'delete'=>'fas fa-trash', 'deploy'=>'fas fa-forward', + 'deploy-configfile'=>'far fa-file-code', 'filter'=>'fas fa-filter', 'foreman'=>'fas fa-hard-hat', 'gotop'=>'fas fa-arrow-up', diff --git a/public_html/deployment/classes/project.class.php b/public_html/deployment/classes/project.class.php index 64ff53c6668f0ce7f6798779d97f28c30db5c4be..976db48df1314270be79fc3a178d3d976bfa753b 100644 --- a/public_html/deployment/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -784,7 +784,7 @@ class project extends base { } // keep a few - while (count($aDirlist) >= $this->_aConfig["builtsToKeep"]) { + while (count($aDirlist) > $this->_aConfig["builtsToKeep"]) { $sVersion = array_shift($aDirlist); $sDir2 = $sDir . '/' . $sVersion; if ($this->_rmdir($sDir2)) { @@ -1621,10 +1621,11 @@ class project extends base { $sReturn.=$this->_execAndSend("ls -lisa $sTempBuildDir"); if (!$this->_iRcAll == 0) { - $this->_TempDelete($sTempBuildDir); - $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; + $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); - return $this->_oHtml->getBox("error", $sError); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); + return $this->_oHtml->getBox("error", $sError.$sReturn); } // -------------------------------------------------- @@ -1633,6 +1634,13 @@ class project extends base { $sReturn.=$this->_execAndSend('chmod 755 ' . $filename); $sReturn.=$this->_execAndSend('ls -l ' . $filename); } + // -------------------------------------------------- + $sCfgout=$sTempBuildDir . '/ci-custom-vars'; + if (isset($this->_aPrjConfig['deploy']["configfile"]) && $this->_aPrjConfig['deploy']["configfile"]){ + file_put_contents($sCfgout, $this->_aPrjConfig['deploy']["configfile"]); + $sReturn.=$this->_execAndSend('ls -l ' . $sCfgout); + $sReturn.=$this->_execAndSend('cat ' . $sCfgout); + } $sReturn.=$this->_oHtml->getBox("success", t('class-project-info-build-checkout-ok')); $aActionList['iActive'] ++; @@ -1661,6 +1669,7 @@ class project extends base { if (!$this->_iRcAll == 0) { $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); + $this->_TempFill($sError.$sReturn, $aActionList); $this->_TempDelete($sTempBuildDir); return $this->_oHtml->getBox("error", $sError . $sReturn); } @@ -1695,10 +1704,11 @@ class project extends base { // $this->_iRcAll = 0; $sReturn.=$this->_execAndSend('bash --login -c \'' . $sSetEnv.' '.$sTempBuildDir . '/' . $sHookfile . '\''); if (!$this->_iRcAll == 0) { - $this->_TempDelete($sTempBuildDir); - $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; + $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); - return $this->_oHtml->getBox("error", $sError); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); + return $this->_oHtml->getBox("error", $sError . $sReturn); } } else { $sReturn.=t('skip') . '<br>'; @@ -1740,17 +1750,19 @@ class project extends base { } if (!$sWebroot) { - $this->_TempDelete($sTempBuildDir); $sError = t('class-project-error-build-docroot-not-found'); $this->_logaction($sError, __FUNCTION__, "error"); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); return $this->_oHtml->getBox("error", $sError . $sReturn . $sError); } } if (!$this->_iRcAll == 0) { - $this->_TempDelete($sTempBuildDir); - $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir) . $sReturn; + $sError = sprintf(t('class-project-error-command-failed'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); - return $this->_oHtml->getBox("error", $sError); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); + return $this->_oHtml->getBox("error", $sError . $sReturn); } // $sReturn.=$this->_oHtml->getBox("success", "preparations ok - directory is ready for packaging now."); // generate info file @@ -1795,9 +1807,11 @@ class project extends base { } $sReturn.=$this->_execAndSend("ls -ld " . dirname($sPackageFileArchiv)); if (!file_exists(dirname($sPackageFileArchiv))) { - $this->_TempDelete($sTempBuildDir); + $sError = sprintf(t('"class-project-error-build-dir-was-not-created"'), $sTempBuildDir); $this->_logaction($sError, __FUNCTION__, "error"); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); return $this->_oHtml->getBox("error", $sError . $sReturn); } $this->_TempFill($sReturn, $aActionList); @@ -1828,9 +1842,10 @@ class project extends base { // TEST // $this->_iRcAll=1; if (!$this->_iRcAll == 0) { - $this->_TempDelete($sTempBuildDir); $sError = t('class-project-error-build-packaging-failed'); $this->_logaction($sError, __FUNCTION__, "error"); + $this->_TempFill($sError.$sReturn, $aActionList); + $this->_TempDelete($sTempBuildDir); return $this->_oHtml->getBox("error", $sError . $sReturn); } $aActionList['iActive'] ++; @@ -3345,8 +3360,10 @@ class project extends base { <ul class="nav nav-tabs"> <li class="active"><a href="#tab1" data-toggle="tab">' . $this->_oHtml->getIcon('list').t('setup-metadata') . '</a></li> <li><a href="#tab2" data-toggle="tab">' . $this->_oHtml->getIcon('repository').t('repositoryinfos') . '</a></li> - <li><a href="#tab3" data-toggle="tab">' . $this->_oHtml->getIcon('phase').t('phases') . '</a></li> - <li><a href="#tab4" data-toggle="tab">' . $this->_oHtml->getIcon('raw-data').t('raw-data') . '</a></li> + + <li><a href="#tab3" data-toggle="tab">' . $this->_oHtml->getIcon('deploy-configfile').t('deploy-configfile') . '</a></li> + <li><a href="#tab4" data-toggle="tab">' . $this->_oHtml->getIcon('phase').t('phases') . '</a></li> + <li><a href="#tab5" data-toggle="tab">' . $this->_oHtml->getIcon('raw-data').t('raw-data') . '</a></li> </ul> <div class="tab-content"> <div class="tab-pane active" id="tab1"> @@ -3475,11 +3492,27 @@ class project extends base { ), ), ), - // -------------------------------------------------- 'input' . $i++ => array( 'type' => 'markup', 'value' => ' </div><div class="tab-pane" id="tab3"> + <p>' . t('deploy-configfile-hint') . '</p>', + ), + 'textarea' . $i++ => array( + 'type' => 'textarea', + 'name' => 'deploy[configfile]', + 'label' => t("deploy-configfile"), + 'value' => $this->_aPrjConfig['deploy']["configfile"], + // 'required' => 'required', + 'validate' => 'isastring', + 'cols' => 100, + 'rows' => 10, + 'placeholder' => 'export myvariable="hello world"', + ), + // -------------------------------------------------- + 'input' . $i++ => array( + 'type' => 'markup', + 'value' => ' </div><div class="tab-pane" id="tab4"> <p>' . sprintf(t("class-project-info-setup-phaseinfos"), $this->getNextPhase()) . '</p>', ), ), @@ -3709,7 +3742,7 @@ class project extends base { 'type' => 'markup', 'value' => '</div>' - . '<div class="tab-pane" id="tab4">' + . '<div class="tab-pane" id="tab5">' . '<br><pre>'.print_r($this->_aPrjConfig, 1).'</pre>' . '</div>' diff --git a/public_html/deployment/main.css b/public_html/deployment/main.css index 3237c56ce43d24cb6191abbecc40baca516b97a8..0ccffde211603aaa43534bdef952a36af4edaf0f 100644 --- a/public_html/deployment/main.css +++ b/public_html/deployment/main.css @@ -271,6 +271,8 @@ input[type="radio"]:checked+label, input[type="checkbox"]:checked+label{ display: block; } +.tab-pane p {margin: 1em 10px;} + /* ----- visualized process ----- */ .visualprocess{float: left; padding: 1em; box-shadow: 0 0 0em #ddd;} .visualprocess .process{float:left; text-align: center; padding: 0 0 5px; }