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

Merge branch 'task4364-branchname-chars' into 'master'

Task4364 branchname chars; do not fetch all commit messages

See merge request !3
parents 2f776352 8f4d6e57
Branches
No related tags found
1 merge request!3Task4364 branchname chars; do not fetch all commit messages
Pipeline #221 passed
......@@ -10,6 +10,7 @@
*
* ----------------------------------------------------------------------
* 2020-06-16 v0.9 <axel.hahn@iml.unibe.ch>
* 2021-03-29 v1.2 <axel.hahn@iml.unibe.ch> support slashes in branch names
* ======================================================================
*/
......@@ -132,11 +133,11 @@
$aUriSplit= explode('/', preg_replace('/\?.*$/', '', $_SERVER["REQUEST_URI"]));
array_shift($aUriSplit);
array_shift($aUriSplit);
array_shift($aUriSplit);
_wd('<pre>$aUriSplit: '.print_r($aUriSplit, 1).'</pre>');
/*
/api/v1/projects/ci/build?auth=123
/api/v1/projects/ci/build/...
$aUriSplit: Array
(
[0] => v1
......@@ -173,11 +174,14 @@
$sPrjId = isset($aUriSplit[2]) ? $aUriSplit[2] : false;
$sPrjAction = isset($aUriSplit[3]) ? $aUriSplit[3] : false;
$sParam4 = isset($aUriSplit[4]) ? $aUriSplit[4] : false;
$sParam5 = isset($aUriSplit[5]) ? $aUriSplit[5] : false;
$sBranch = implode('/', array_slice($aUriSplit, 4));
// $sParam4 = isset($aUriSplit[4]) ? $aUriSplit[4] : false;
// $sParam5 = isset($aUriSplit[5]) ? $aUriSplit[5] : false;
$sMethod = $_SERVER['REQUEST_METHOD'];
_wd('$sPrjId = '.$sPrjId);
_wd('$sPrjAction = '.$sPrjAction);
_wd('$sBranch = ' . $sBranch);
$oCLog = new logger();
// try to init the given project
......@@ -208,8 +212,8 @@
switch($sPrjAction){
case "build":
if ($sParam4){
$aResult=$oProject->setBranchname($sParam4 . ($sParam5 ? '/'.$sParam5 : ''));
if ($sBranch){
$aResult=$oProject->setBranchname($sBranch);
}
$sBranchname=$oProject->getBranchname();
$aRepodata = $oProject->getRemoteBranches(true);
......
......@@ -200,6 +200,7 @@ class vcs implements iVcs {
/**
* helper: cache hash with all branches
* It saves 1.5 sec for reading 300 branches
* @return boolean
*/
private function _cacheRemoteBranches() {
......@@ -277,14 +278,14 @@ class vcs implements iVcs {
$sBranchKey = $sName;
$this->log(__FUNCTION__ . ' $sBranchKey = '.$sBranchKey);
$sMessage = $this->getCommitmessageByBranch($sName, $sRevision);
// $sMessage = $this->getCommitmessageByBranch($sName, $sRevision);
$aReturn[$sBranchKey] = array(
// 'debug'=> $aTmp,
'revision' => $sRevision,
'name' => $sName,
'label' => $sType . ': ' . $sBranch,
'type' => $sType,
'message' => $sMessage
// 'message' => $sMessage
);
}
}
......
......@@ -4,8 +4,9 @@
# API CLIENT :: API REQUEST TO IML CI SERVER
#
# ----------------------------------------------------------------------
# 2020-07-23 v1.0 <axel.hahn@iml.unibe.ch> first lines
# 2020-07-23 v1.0 <axel.hahn@iml.unibe.ch> first lines
# 2020-07-29 v1.1 <axel.hahn@iml.unibe.ch> check "/" in branch; check http status 200
# 2021-03-29 v1.2 <axel.hahn@iml.unibe.ch> support slashes in branch names
# ======================================================================
# ----------------------------------------------------------------------
......@@ -146,7 +147,8 @@ echo "IMLCI_PROJECT = $IMLCI_PROJECT"
echo "IMLCI_API_SECRET = $IMLCI_API_SECRET"
echo
echo $branch | grep '/.*/.*' >/dev/null && ( echo "WARNING: Do NOT use a branch containing a slash [/] in the name"; echo )
# task-4364: slashes are supported now
# echo $branch | grep '/.*/.*' >/dev/null && ( echo "WARNING: Do NOT use a branch containing a slash [/] in the name"; echo )
echo ACTION: $apiAction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment