Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
eeba9a05
Commit
eeba9a05
authored
1 year ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
fix project setup and changing git url
parent
cf06b06b
No related branches found
No related tags found
1 merge request
!62
V2.0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
public_html/deployment/classes/project_gui.class.php
+1
-1
1 addition, 1 deletion
public_html/deployment/classes/project_gui.class.php
public_html/deployment/classes/vcs.git.class.php
+25
-7
25 additions, 7 deletions
public_html/deployment/classes/vcs.git.class.php
with
26 additions
and
8 deletions
public_html/deployment/classes/project_gui.class.php
+
1
−
1
View file @
eeba9a05
...
...
@@ -935,7 +935,7 @@ class projectgui extends project {
);
// detect access to repo url
$aBranches
=
$this
->
getRemoteBranches
();
$aBranches
=
$this
->
getRemoteBranches
(
true
);
// $aRepodata = $this->getRepoRevision();
// if (is_array($aRepodata) && array_key_exists("message", $aRepodata)) {
...
...
This diff is collapsed.
Click to expand it.
public_html/deployment/classes/vcs.git.class.php
+
25
−
7
View file @
eeba9a05
...
...
@@ -251,7 +251,8 @@ class vcs implements iVcs {
$this
->
log
(
__FUNCTION__
.
"(bIgnoreCache = "
.
(
$bIgnoreCache
?
'true'
:
'false'
)
.
") start"
);
$aReturn
=
array
();
if
(
!
$this
->
getUrl
())
{
$sGitUrl
=
$this
->
getUrl
();
if
(
!
$sGitUrl
)
{
return
false
;
}
...
...
@@ -266,17 +267,29 @@ class vcs implements iVcs {
$this
->
log
(
__FUNCTION__
.
" - sWorkdir =
$sWorkdir
"
);
$sGitCmd
=
'export GIT_SSH="'
.
$this
->
_sWrapper
.
'" ; export PKEY="'
.
$this
->
_sKeyfile
.
'" ; '
;
if
(
is_dir
(
$sWorkdir
.
".git"
))
{
// if a subdir .git exists:
// Verify if git remote -v contains the current git url
// If not, we delete it
$sPreCmd
=
'cd "'
.
$sWorkdir
.
'" 2>&1 && git remote -v 2>&1 | grep "'
.
$sGitUrl
.
'" >/dev/null || ( echo "DELETING .git dir..."; rm -rf .git && rc=$?; echo "rc=$rc"; sleep 1; exit $rc) '
;
$this
->
log
(
__FUNCTION__
.
" - start PRE command <code>
$sPreCmd
</code>"
);
exec
(
$sPreCmd
,
$aPreLines
,
$iRc
);
if
(
!
$iRc
==
0
){
$this
->
log
(
__FUNCTION__
.
" <code>"
.
print_r
(
$aPreLines
,
1
)
.
"</code> rc=
$iRc
"
);
}
}
if
(
!
is_dir
(
$sWorkdir
.
".git"
))
{
$sGitCmd
.
=
'mkdir -p "'
.
$sWorkdir
.
'" && cd "'
.
$sWorkdir
.
'" && '
;
$sGitCmd
.
=
'git init >/dev/null && '
;
$sGitCmd
.
=
'git remote add origin "'
.
$
this
->
ge
tUrl
()
.
'" 2>&1 && '
;
$sGitCmd
.
=
'git remote add origin "'
.
$
sGi
tUrl
.
'" 2>&1 && '
;
}
else
{
$sGitCmd
.
=
'cd "'
.
$sWorkdir
.
'" 2>&1 && '
;
}
$sGitCmd
.
=
'git ls-remote --heads --tags origin 2>&1 ;'
;
$this
->
log
(
__FUNCTION__
.
" start command <code>
$sGitCmd
</code>"
);
$this
->
log
(
__FUNCTION__
.
"
-
start command <code>
$sGitCmd
</code>"
);
exec
(
$sGitCmd
,
$aOutput
,
$iRc
);
$this
->
log
(
__FUNCTION__
.
" command ended with rc=
$iRc
"
.
'<pre>'
.
implode
(
"
\n
"
,
$aOutput
)
.
'</pre>'
,
(
$iRc
==
0
?
'info'
:
'error'
));
$this
->
log
(
__FUNCTION__
.
"
-
command ended with rc=
$iRc
"
.
'<pre>'
.
implode
(
"
\n
"
,
$aOutput
)
.
'</pre>'
,
(
$iRc
==
0
?
'info'
:
'error'
));
if
(
$iRc
==
0
)
{
// use cache that getCommitmessageByBranch can access it
...
...
@@ -324,9 +337,12 @@ class vcs implements iVcs {
$this
->
_aRemoteBranches
=
$aReturn
;
$this
->
log
(
__FUNCTION__
.
' '
.
count
(
$aReturn
)
.
' branches: <pre>'
.
print_r
(
$this
->
_aRemoteBranches
,
1
)
.
'</pre>'
);
$this
->
_cacheRemoteBranches
();
}
}
else
{
$this
->
_aRemoteBranches
=
$oCache
->
read
();
// $this->_aRemoteBranches = $oCache->read();
$this
->
log
(
__FUNCTION__
.
" - No git access? --> deleting cache of former fetched branches..."
);
$oCache
->
delete
();
$this
->
_aRemoteBranches
=
[];
}
}
return
$this
->
_aRemoteBranches
;
}
...
...
@@ -339,8 +355,10 @@ class vcs implements iVcs {
public
function
getRemoteBranches
(
$bIgnoreCache
=
false
)
{
$this
->
log
(
__FUNCTION__
.
"(
$bIgnoreCache
) start"
);
if
(
!
$this
->
_aRemoteBranches
||
$bIgnoreCache
)
{
$this
->
log
(
__FUNCTION__
.
"(
$bIgnoreCache
)
uncached
"
);
$this
->
log
(
__FUNCTION__
.
"(
$bIgnoreCache
)
--> fetching fresh data
"
);
$this
->
_fetchRemoteBranches
(
$bIgnoreCache
);
}
else
{
$this
->
log
(
__FUNCTION__
.
"(
$bIgnoreCache
) --> returning cached data"
);
}
return
$this
->
_aRemoteBranches
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment