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
No related branches found
No related tags found
1 merge request!3Task4364 branchname chars; do not fetch all commit messages
Pipeline #221 passed
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
* *
* ---------------------------------------------------------------------- * ----------------------------------------------------------------------
* 2020-06-16 v0.9 <axel.hahn@iml.unibe.ch> * 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
* ====================================================================== * ======================================================================
*/ */
...@@ -136,7 +137,7 @@ ...@@ -136,7 +137,7 @@
_wd('<pre>$aUriSplit: '.print_r($aUriSplit, 1).'</pre>'); _wd('<pre>$aUriSplit: '.print_r($aUriSplit, 1).'</pre>');
/* /*
/api/v1/projects/ci/build?auth=123 /api/v1/projects/ci/build/...
$aUriSplit: Array $aUriSplit: Array
( (
[0] => v1 [0] => v1
...@@ -173,11 +174,14 @@ ...@@ -173,11 +174,14 @@
$sPrjId = isset($aUriSplit[2]) ? $aUriSplit[2] : false; $sPrjId = isset($aUriSplit[2]) ? $aUriSplit[2] : false;
$sPrjAction = isset($aUriSplit[3]) ? $aUriSplit[3] : false; $sPrjAction = isset($aUriSplit[3]) ? $aUriSplit[3] : false;
$sParam4 = isset($aUriSplit[4]) ? $aUriSplit[4] : false; $sBranch = implode('/', array_slice($aUriSplit, 4));
$sParam5 = isset($aUriSplit[5]) ? $aUriSplit[5] : false;
// $sParam4 = isset($aUriSplit[4]) ? $aUriSplit[4] : false;
// $sParam5 = isset($aUriSplit[5]) ? $aUriSplit[5] : false;
$sMethod = $_SERVER['REQUEST_METHOD']; $sMethod = $_SERVER['REQUEST_METHOD'];
_wd('$sPrjId = '.$sPrjId); _wd('$sPrjId = '.$sPrjId);
_wd('$sPrjAction = '.$sPrjAction); _wd('$sPrjAction = '.$sPrjAction);
_wd('$sBranch = ' . $sBranch);
$oCLog = new logger(); $oCLog = new logger();
// try to init the given project // try to init the given project
...@@ -208,8 +212,8 @@ ...@@ -208,8 +212,8 @@
switch($sPrjAction){ switch($sPrjAction){
case "build": case "build":
if ($sParam4){ if ($sBranch){
$aResult=$oProject->setBranchname($sParam4 . ($sParam5 ? '/'.$sParam5 : '')); $aResult=$oProject->setBranchname($sBranch);
} }
$sBranchname=$oProject->getBranchname(); $sBranchname=$oProject->getBranchname();
$aRepodata = $oProject->getRemoteBranches(true); $aRepodata = $oProject->getRemoteBranches(true);
......
...@@ -200,6 +200,7 @@ class vcs implements iVcs { ...@@ -200,6 +200,7 @@ class vcs implements iVcs {
/** /**
* helper: cache hash with all branches * helper: cache hash with all branches
* It saves 1.5 sec for reading 300 branches
* @return boolean * @return boolean
*/ */
private function _cacheRemoteBranches() { private function _cacheRemoteBranches() {
...@@ -277,14 +278,14 @@ class vcs implements iVcs { ...@@ -277,14 +278,14 @@ class vcs implements iVcs {
$sBranchKey = $sName; $sBranchKey = $sName;
$this->log(__FUNCTION__ . ' $sBranchKey = '.$sBranchKey); $this->log(__FUNCTION__ . ' $sBranchKey = '.$sBranchKey);
$sMessage = $this->getCommitmessageByBranch($sName, $sRevision); // $sMessage = $this->getCommitmessageByBranch($sName, $sRevision);
$aReturn[$sBranchKey] = array( $aReturn[$sBranchKey] = array(
// 'debug'=> $aTmp, // 'debug'=> $aTmp,
'revision' => $sRevision, 'revision' => $sRevision,
'name' => $sName, 'name' => $sName,
'label' => $sType . ': ' . $sBranch, 'label' => $sType . ': ' . $sBranch,
'type' => $sType, 'type' => $sType,
'message' => $sMessage // 'message' => $sMessage
); );
} }
} }
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
# ---------------------------------------------------------------------- # ----------------------------------------------------------------------
# 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 # 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" ...@@ -146,7 +147,8 @@ echo "IMLCI_PROJECT = $IMLCI_PROJECT"
echo "IMLCI_API_SECRET = $IMLCI_API_SECRET" echo "IMLCI_API_SECRET = $IMLCI_API_SECRET"
echo 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 echo ACTION: $apiAction
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment