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

Merge branch 'task-1726-gitssh-extensions' into 'master'

Task 1726 gitssh extensions

See merge request !62
parents dc21ea6e 9446ac5f
Branches
No related tags found
No related merge requests found
Showing with 304 additions and 118 deletions
......@@ -76,6 +76,7 @@
"class-project-error-build-dir-was-not-created": "Das Verzeichnis %s wurde nicht angelegt.",
"class-project-error-build-type-not-supported": "Repository Typ %s wird nicht unterstützt.",
"class-project-error-build-docroot-not-found": "Es gibt kein Unterverzeichnis "public_html" oder "public" im Arbeitsverzeichnis.",
"class-project-error-build-packaging-failed": "Build schlug beim Erstellen der Pakete fehl.",
"class-project-error-command-failed": "Eines der Kommandos ist fehlgeschlagen (s. Fehlermeldung in der Ausgabe).<br>Frage ggf. den Administrator. Das Arbeitsverzeichnis wird f&uumlr eine Analyse nicht gel&ouml;scht.",
"class-project-error-getPhaseInfos-package-not-found": "Die Paket-Datei (.tgz) wurde nicht gefunden: %s",
"class-project-error-getPhaseInfos-requires-phase": "Die Methode getPhaseInfos erfordert die Angabe eine Phase.",
......@@ -219,8 +220,12 @@
"branch-switch": "Switche Branch/ Tag ... Moment ...",
"build": "Build",
"build-hint": "neues Paket erstellen und in Phase [%s] stellen.",
"build-hint-overview": "neues Paket aus<br>Tag/ Revision erstellen<br>und im Archiv ablegen.",
"build-from": "Build vom",
"build-type": "Build Typ",
"build-failes": "Build-Fehler",
"build-failes-hint": "Hier sind die Ausgaben der letzten fehlerfaften Builds einsehbar.",
"build-failes-none": "Es wurden noch keine Build-Fehler aufgezeichnet.",
"commitmessage": "Commit-Message",
"change": "Wechseln",
"cleanup": "Cleanup",
......@@ -297,6 +302,7 @@
"projectname": "Projektname",
"projectmanager": "Projektleiter",
"queue": "Queue",
"queue-hint-overview": "neuestes Paket<br>in der ersten<br>Phase %s<br>installieren",
"raw-data": "Raw data",
"replacement-fields": "erkannte Platzhalter:",
"replacement-fields-not-found": "Es wurden keine Platzhalter im Format <em>@replace[&quot;Name&quot;]</em> im Template gefunden.",
......
......@@ -75,6 +75,7 @@
"class-project-error-build-dir-was-not-created": "The directory %s was not created.",
"class-project-error-build-type-not-supported": "Repository type %s is not supported.",
"class-project-error-build-docroot-not-found": "There is no subdirectory &quot;public_html&quot; or &quot;public&quot; in the working directory.",
"class-project-error-build-packaging-failed": "Build failed while creating the packages.",
"class-project-error-command-failed": "The execution of a command failed (see error message in the output below).<br>Ask your admin. The working directory was NOT deleted that you can analyze the problem.",
"class-project-error-getPhaseInfos-package-not-found": "The package file (.tgz) was not found: %s",
"class-project-error-getPhaseInfos-requires-phase": "The method getPhaseInfos requires the name of a pfase.",
......@@ -221,8 +222,12 @@
"branch-switch": "Switching branch/ tag ... please wait ...",
"build": "Build",
"build-hint": "Create new package and rollout to first active phase [%s].",
"build-hint-overview": "Create new package<br>from tag/ revision<br>and put to archive.",
"build-from": "Build date",
"build-type": "Build type",
"build-failes": "Build-Errors",
"build-failes-hint": "Here you can view to the output of the latest failed builds.",
"build-failes-none": "No failed builds were recorded yet.",
"change": "Change",
"commitmessage": "Commit message",
"contact": "contact",
......@@ -299,6 +304,7 @@
"projectname": "Project name",
"projectmanager": "Projekt manager",
"queue": "Queue",
"queue-hint-overview": "Install newest<br>package in the first<br>phase %s",
"raw-data": "Raw data",
"replacement-fields": "Detected placeholders:",
"replacement-fields-not-found": "No placeholder in the syntax <em>@replace[&quot;name&quot;]</em> were found in the template.",
......
......@@ -8,11 +8,14 @@ $aConfig = array(
// Basispfad:
'workDir' => '/var/imldeployment',
'tmpDir' => '/var/tmp/imldeployment',
'versionsToKeep' => 10, // for cleanup: keep n unused versions
'builtsToKeep' => 3, // for cleanup: keep n failed builds
'versionsToKeep' => 5, // for cleanup: keep n unused versions
'builtsToKeep' => 3,
'build' => array(
'env' => 'export RVMSCRIPT="/usr/local/rvm/scripts/rvm";',
'hooks' => array(
'build-postclone' => 'hooks/onbuild-postclone',
'build-precompress' => 'hooks/onbuild', // TODO: remove this
'build-precompress' => 'hooks/onbuild',
),
),
'lang' => 'de', // for available languages see ./config/lang/*.json
// rsync of archives
......
......@@ -178,7 +178,7 @@ if (!isset($aConfig) || !is_array($aConfig)) {
// check required keys in the config
foreach (array(
'auth',
'hooks',
'build',
'installPackages',
'lang',
'phases',
......
......@@ -93,11 +93,18 @@ class htmlguielements{
'comment'=>'glyphicon-comment',
'revision'=>'glyphicon-tag',
'link-extern'=>'glyphicon-globe',
'host'=>'fa-hdd-o',
'hostgroup'=>'fa-sitemap',
'templatefile'=>'fa-file-code-o',
'targetfile'=>'fa-file-o',
'replace'=>'fa-random',
'sign-info'=>'',
'sign-warning'=>'',
'sign-error'=>'fa-bolt',
'sign-ok'=>'',
),
);
......@@ -312,7 +319,7 @@ class htmlguielements{
foreach ($aTabData['tabs'] as $sTabLabel=>$sTabContent){
$iCounter++;
$iTab++;
$sId="tab${iCounter}";
$sId="tab-generated-${iCounter}";
$sTabs.= ($iTab==1 ? '<li class="active"' : '<li')
. ' role="presentation">'
. '<a href="#'.$sId.'" data-toggle="tab">' . $sTabLabel . '</a></li>'
......
......@@ -138,6 +138,40 @@ class logger {
. '<script>$(\'#'.$sMaxRowId.'\').css(\'color\', \'#f00\');</script>';
return $sOut;
}
/**
* render output of all logging messages for cli output
* @return string
*/
public function renderCli(){
if (!$this->bShowDebug){
return false;
}
$sOut='';
$sStarttime=$this->aMessages[0]["time"];
$iCounter=0;
$sMaxRowId=false;
$iMaxtime=-1;
$sWarnings=false;
$iLasttime=$sStarttime;
foreach ($this->aMessages as $aLogentry){
$iCounter++;
$iDelta=$aLogentry["time"]-$iLasttime;
$sOut.=$aLogentry["level"].' '
. $iCounter.' '
.sprintf("%01.3f", $aLogentry["time"]-$sStarttime).' '
.sprintf("%01.3f", $iDelta).' '
.$aLogentry["level"].' '
.$aLogentry["message"].' '
. "\n"
;
$iLasttime=$aLogentry["time"];
}
// $iTotal=$iLasttime-$sStarttime;
return $sOut;
}
}
?>
This diff is collapsed.
......@@ -17,6 +17,7 @@ $aParams = array();
// ----------------------------------------------------------------------
// verifiy config
// ----------------------------------------------------------------------
/*
$aErrors=array();
if (!isset($aConfig) || !is_array($aConfig)) {
$aErrors[]="* \$aConfig does not exist. The config was not included before including " . __FILE__ . " in the request/ script.\n";
......@@ -73,7 +74,7 @@ $aParams = array();
die("FATAL ERROR on config.<br>" . implode("<br>\n", $aErrors));
}
*/
// remark: $_SERVER does not exist in CLI
if (isset($_SERVER) && is_array($_SERVER) && array_key_exists("REQUEST_URI", $_SERVER)) {
/*
......@@ -211,6 +212,11 @@ function getTopArea() {
$sBaseUrl = '/deployment/';
$sWikiBaseUrl = 'https://intranet.iml.unibe.ch/wiki/doku.php';
$sCurrentProject=(array_key_exists("prj", $aParams) && $aParams["prj"] <> "all") ? $aParams["prj"] : false;
$sCurrentAction=(array_key_exists("action", $aParams) && $aParams["action"]) ? $aParams["action"] : false;
$sCurrentPar3=(array_key_exists("par3", $aParams) && $aParams["par3"]) ? $aParams["par3"] : false;
$sLiActive=' class="active"';
$sReturn = '
<span id="top"></span>
<nav class="navbar navbar-inverse" role="navigation">
......@@ -251,22 +257,27 @@ function getTopArea() {
'label'=>t("menu").' <span class="caret"></span>',
))
.'<ul class="dropdown-menu" role="menu">
<li>'.$oHtml->getLink(array(
<li'.($sCurrentPar3=== 'new' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . 'all/setup/new/',
'icon'=>'new',
'label'=>t("menu-new-project"),
)).'</li>
<li>'.$oHtml->getLink(array(
<li'.($sCurrentPar3=== 'actionlog' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . 'all/setup/actionlog/',
'icon'=>'actionlog',
'label'=>t("menu-logs"),
)).'</li>
<li>'.$oHtml->getLink(array(
<li'.($sCurrentPar3=== 'checklang' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . 'all/setup/checklang/',
'icon'=>'checklang',
'label'=>t("menu-checklang"),
)).'</li>
<li>'.$oHtml->getLink(array(
<li'.($sCurrentProject=='' && $sCurrentAction=='setup' && $sCurrentPar3=='' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . 'all/setup/',
'icon'=>'setup',
'label'=>t("menu-settings"),
......@@ -291,7 +302,9 @@ function getTopArea() {
$oPrj1 = new project();
foreach ($oPrj1->getProjects() as $sPrj) {
$oPrj = new project($sPrj);
$sReturn.='<li>'
$sReturn.='<li'
. ($sCurrentProject===$oPrj->getId() ? $sLiActive:'')
. '>'
. $oHtml->getLink(array(
'href'=>$sBaseUrl . $sPrj .'/',
'icon'=>'project',
......@@ -319,9 +332,9 @@ function getTopArea() {
))
.'
<ul class="dropdown-menu" role="menu">
<li>'
<li'.($sCurrentAction===false ? $sLiActive :'') .'>'
. $oHtml->getLink(array(
'href'=>$sBaseUrl . $sPrj .'/',
'href'=>$sBaseUrl . $aParams["prj"] .'/',
'icon'=>'project-home',
'label'=>t("project-home"),
))
......@@ -330,7 +343,7 @@ function getTopArea() {
$aPhases = $oPrj->getActivePhases();
if (count($aPhases)) {
$sReturn.='<li role="separator" class="divider"></li>
<li>'
<li'.($sCurrentAction==='build' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . $aParams["prj"] . '/build/',
'icon'=>'build',
......@@ -340,26 +353,27 @@ function getTopArea() {
<li role="separator" class="divider"></li>
<li class="dropdown-header">'.t("menu-project-phases").'</li>';
foreach ($aPhases as $sPhase) {
$sReturn.='<li><a href="' . $sBaseUrl . $aParams["prj"] . '/phase/' . $sPhase . '/">' . $oHtml->getIcon('phase').$sPhase . '</a></li>';
$sReturn.='<li'.(isset($aParams['par3']) && $aParams['par3']===$sPhase ? $sLiActive :'') .'>'
. '<a href="' . $sBaseUrl . $aParams["prj"] . '/phase/' . $sPhase . '/">' . $oHtml->getIcon('phase').$sPhase . '</a></li>';
}
}
$sReturn.='
<li role="separator" class="divider"></li>
<li>'
<li'.($sCurrentAction==='setup' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . $aParams["prj"] . '/setup/',
'icon'=>'setup',
'label'=>t("menu-project-settings"),
))
.'</li>
<li>'
<li'.($sCurrentAction==='cleanup' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . $aParams["prj"] . '/cleanup/',
'icon'=>'cleanup',
'label'=>t("menu-project-cleanup"),
))
.'</li>
<li>'
<li'.($sCurrentAction==='delete' ? $sLiActive :'') .'>'
.$oHtml->getLink(array(
'href'=>$sBaseUrl . $aParams["prj"] . '/delete/',
'icon'=>'delete',
......
......@@ -208,7 +208,7 @@ span.pre{
background-color: #fea;
color: #653;
}
.badge-light{background-color:#eee; color:#aaa;}
.center{text-align: center;}
.inactive{color:#999; font-style: italic;}
.versioninfo{
......@@ -241,10 +241,10 @@ input[type="radio"]:checked+label, input[type="checkbox"]:checked+label{
/* ----- visualized process ----- */
.visualprocess{float: left; padding: 1em; box-shadow: 0 0 0em #ddd;}
.visualprocess .process{float:left; text-align: center; padding: 0 0 5px; min-height: 220px; }
.visualprocess .process.phases{border-left: 2px dashed #ddd; padding-left: 1em;}
.visualprocess .process{float:left; text-align: center; padding: 0 0 5px; }
.visualprocess .process.box{border: 2px dashed #ddd; padding: 1em; min-height: 25em;}
.visualprocess .process img{}
.visualprocess .action{float:left;padding: 9em 2em; background: #fff;}
.visualprocess .action{float:left;padding: 3em 1em 1em 1em; background: #fff;}
.visualprocess .process .title{margin-bottom: 2em; font-weight: bold; font-size: 150%; color:#aaa;}
.visualprocess .process .details{background: #fff; min-height: 6em;}
......
......@@ -32,14 +32,41 @@ if (!array_key_exists("prj", $aParams)) {
require_once("./classes/project.class.php");
$oPrj = new project($aParams["prj"]);
$iCountOfBranches=0;
$iCountOfBuildErrors=count($oPrj->getBuildErrors());
$iCountOfpackages=count($oPrj->getVersions());
$iCountOfPhases=count($oPrj->getActivePhases());
$sBuildErrorContent='<p>'.t('build-failes-hint').'</p>';
if($iCountOfBuildErrors){
$aTabdata=array();
$aErrorfiles=$oPrj->getBuildErrors();
rsort($aErrorfiles);
foreach ($aErrorfiles as $sNumber=>$sErrorfile){
$aTabdata[$oHtml->getIcon('targetfile').' '.$sErrorfile]=''
// . 'file: ' . $oHtml->getIcon('targetfile'). ''.$sErrorfile.'<br>'
// . 'date: ' . .'<br>'
// . 'age: ' . .'<br>'
. $oPrj->getBuildErrorContent($sErrorfile);
}
$sBuildErrorContent.=$oHtml->getNav(array(
'options' => array(
'type'=>'pills',
'justified'=>0,
),
'tabs'=>$aTabdata)
);
} else {
$sBuildErrorContent=$oHtml->getBox('info', t('build-failes-none'));
}
$sListOfBranches='<h4>'.t('branch-select').'</h4><ol>';
foreach($oPrj->getRemoteBranches() as $aBranch){
$sListOfBranches.='<li title="'.$aBranch['revision'].'">'.$aBranch['label'] . '</li>';
$iCountOfBranches++;
}
$sListOfBranches.='</ol>';
$sPhaseTabs='';
$sPhaseDetails='';
$sOut = '
......@@ -48,9 +75,10 @@ if (!array_key_exists("prj", $aParams)) {
<ul class="nav nav-tabs">
<li class="active"><a href="#tab1" data-toggle="tab">' . $oHtml->getIcon('workflow') . t("way-of-packages") . '</a></li>
<li><a href="#tab2" data-toggle="tab">' . $oHtml->getIcon('repository') . t("repositoryinfos") . '</a></li>
<li><a href="#tab3" data-toggle="tab">' . $oHtml->getIcon('package') . t("packages") . '</a></li>
<li><a href="#tab4" data-toggle="tab">' . $oHtml->getIcon('phase') . t('phases') . '</a></li>
<li><a href="#tab2" data-toggle="tab">' . $oHtml->getIcon('repository') . t("repositoryinfos") . ($iCountOfBranches ? ' <span class="badge badge-light">'.$iCountOfBranches.'</span>' : '' ).'</a></li>
<li><a href="#tab3" data-toggle="tab">' . $oHtml->getIcon('sign-error') . t("build-failes") . ($iCountOfBuildErrors ? ' <span class="badge badge-light">'.$iCountOfBuildErrors.'</span>' : '' ).'</a></li>
<li><a href="#tab4" data-toggle="tab">' . $oHtml->getIcon('package') . t("packages") . ($iCountOfpackages ? ' <span class="badge badge-light">'.$iCountOfpackages.'</span>' : '' ).'</a></li>
<li><a href="#tab5" data-toggle="tab">' . $oHtml->getIcon('phase') . t('phases') . ($iCountOfPhases ? ' <span class="badge badge-light">'.$iCountOfPhases.'</span>' : '' ) . '</a></li>
</ul>
<br>
<div class="tab-content">
......@@ -61,19 +89,24 @@ if (!array_key_exists("prj", $aParams)) {
</div>
<div class="tab-pane" id="tab2">
<h3 id="h3repo">' . $oHtml->getIcon('repository') . t("repositoryinfos") . '</h3>
<div style="max-width: 40em;">
' . $oPrj->renderRepoInfo() . '
' . $sListOfBranches . '
<div style="max-width: 40em;">'
. $oPrj->renderRepoInfo()
// . $oPrj->renderSelectRemoteBranches()
. $sListOfBranches . '
' . ($oPrj->canAcceptPhase() ? '<br>'.$oPrj->renderLink("build") : '') . '
</div>
</div>
<div class="tab-pane" id="tab3">
<h3 id="h3versions">' . $oHtml->getIcon('sign-error') . t("build-failes") . '</h3>
'.$sBuildErrorContent.'
</div>
<div class="tab-pane" id="tab4">
<h3 id="h3versions">' . $oHtml->getIcon('package') . t("packages") . '</h3>
' . $oPrj->renderVersionUsage() .'
</div>
<div class="tab-pane" id="tab4">
<div class="tab-pane" id="tab5">
<h3 id="h3phases">' . $oHtml->getIcon('phase') . t("phases") . '</h3>
'.($oPrj->getActivePhases()
......@@ -81,8 +114,6 @@ if (!array_key_exists("prj", $aParams)) {
. t("page-overview-phase-infos")
. '</p>'
. $oPrj->renderPhaseInfo()
. $sPhaseTabs
. $sPhaseDetails
: $oHtml->getBox("info", t("page-overview-no-phase")) .$oPrj->renderLink("setup")
).'
</div>
......
......@@ -13,7 +13,7 @@ if (array_key_exists("ajax", $_GET)) {
$sProcesses = "<h2 class=\"warning\">please wait ...</h2>"
. shell_exec("uptime") . "<br><pre>"
. shell_exec("ps -f | egrep -v '/(apache|httpd)' | fgrep -v 'ps -f' | fgrep -v grep")
. shell_exec("ps -f --forest | egrep -v '/(apache|httpd)' | fgrep -v 'ps -f' | fgrep -v grep")
. "</pre>";
$sOut = file_exists($sTmpFile) ? file_get_contents($sTmpFile) : "waiting for " . $sTmpFile;
......
......@@ -8,6 +8,7 @@
// http://iml:deployment@ci.iml.unibe.ch/deployment/?prj=ci&action=deploy&par3=preview&confirm=1
$iStart=date('U');
$sDocroot = (dirname(__dir__)) . "/public_html";
$processUser = posix_getpwuid(posix_geteuid());
......@@ -15,6 +16,17 @@ if ($processUser['name']=="root"){
die("Do not start the script as user root\n");
};
echo "\n<h1>===== IMLDEPLOYMENT - cache git branches :: ".(date("Y-m-d H:i:s"))." =====</h1>\n\n";
$sLockfile="/tmp/cache-gitbranches.lock";
if (file_exists($sLockfile)){
$iAge=date('U')-filemtime($sLockfile);
$iMagAge=60*60 * 3;
if ($iAge < 60*60 * 3){
die("ABORT: lock file exists: $sLockfile (age: $iAge sec ... needs to wait up to $iMagAge sec or the running script is finished)\n");
}
echo "INFO: ignoring existing lock file $sLockfile (age: $iAge sec is older $iMagAge sec)\n";
}
require_once("$sDocroot/deployment/classes/logger.class.php");
global $oCLog;
$oCLog = new logger();
......@@ -25,7 +37,9 @@ require_once("$sDocroot/deployment/classes/project.class.php");
$oPrj1 = new project();
echo "<h1>===== IMLDEPLOYMENT - cache git branches =====</h1>\n";
echo "creating lock file $sLockfile\n";
file_put_contents($sLockfile, "started ".date("Y-m-d H:i:s"));
foreach ($oPrj1->getProjects() as $sPrj) {
$oPrj = new project($sPrj);
......@@ -35,4 +49,9 @@ foreach ($oPrj1->getProjects() as $sPrj) {
}
echo "<br>\n";
}
echo "done\n";
echo "\n\n---------- done\n";
echo "removing lock file $sLockfile\n";
unlink($sLockfile);
echo "Script needed ".(date('U')-$iStart) . " s\n\n";
// echo $oCLog->renderCli();
\ No newline at end of file
......@@ -10,5 +10,5 @@ if [ -z "$PKEY" ]; then
# if PKEY is not specified, run ssh using default keyfile
ssh "$@"
else
ssh -i "$PKEY" "$@"
ssh -i ${PKEY} "$@"
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment