Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GraphDeployer
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Coscine
backend
scripts
GraphDeployer
Commits
73963725
Commit
73963725
authored
1 year ago
by
Petar Hristov
Browse files
Options
Downloads
Patches
Plain Diff
Fix: Added support for reference too
parent
3ee45d34
No related branches found
No related tags found
1 merge request
!20
Fix: Added support for reference too
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/GraphDeployer/Deployer.cs
+12
-7
12 additions, 7 deletions
src/GraphDeployer/Deployer.cs
src/GraphDeployer/Models/ConfigurationModels/GraphDeployerConfiguration.cs
+1
-1
1 addition, 1 deletion
.../Models/ConfigurationModels/GraphDeployerConfiguration.cs
with
13 additions
and
8 deletions
src/GraphDeployer/Deployer.cs
+
12
−
7
View file @
73963725
...
...
@@ -66,7 +66,7 @@ public class Deployer(ILogger<Deployer> logger, IOptionsMonitor<GraphDeployerCon
_logger
.
LogInformation
(
"Working with {repoName}"
,
graphRepo
.
Name
);
// Clone the repository inside the Working Folder
var
success
=
CloneRepo
(
graphRepo
.
Url
,
WorkingFolder
,
_graphDeployerConfiguration
.
GitLab
.
Token
,
graphRepo
.
Branch
);
var
success
=
CloneRepo
(
graphRepo
.
Url
,
WorkingFolder
,
_graphDeployerConfiguration
.
GitLab
.
Token
,
graphRepo
.
Ref
);
if
(
success
)
{
...
...
@@ -180,16 +180,21 @@ public class Deployer(ILogger<Deployer> logger, IOptionsMonitor<GraphDeployerCon
try
{
var
cloneOptions
=
new
CloneOptions
();
if
(!
string
.
IsNullOrWhiteSpace
(
branchName
))
{
cloneOptions
.
BranchName
=
branchName
;
}
// Perform the clone operation
_logger
.
LogDebug
(
"Starting clone of repository: \"{projectUrl}\" into \"{projectPath}\""
,
projectUrl
,
projectPath
);
var
repo
=
Repository
.
Clone
(
url
,
projectPath
,
cloneOptions
);
var
repo
=
Repository
.
Clone
(
url
,
projectPath
);
var
localRepo
=
new
Repository
(
repo
);
_logger
.
LogDebug
(
"Repository successfully cloned on branch \"{branch}\"."
,
localRepo
.
Head
.
FriendlyName
);
// First clone on, then checkout, as direct cloning of commit SHA is not supported
if
(!
string
.
IsNullOrWhiteSpace
(
branchName
))
{
Commands
.
Checkout
(
localRepo
,
branchName
);
}
// Retrieve the reference of the repository, either the branch name or the commit hash
var
repoRef
=
localRepo
.
Head
.
IsTracking
?
localRepo
.
Head
.
FriendlyName
:
localRepo
.
Head
.
Tip
.
Sha
;
_logger
.
LogInformation
(
"Repository successfully cloned and switched on ref \"{ref}\"."
,
repoRef
);
return
true
;
}
...
...
This diff is collapsed.
Click to expand it.
src/GraphDeployer/Models/ConfigurationModels/GraphDeployerConfiguration.cs
+
1
−
1
View file @
73963725
...
...
@@ -52,6 +52,6 @@ public class GraphDeployerConfiguration
{
public
required
string
Name
{
get
;
init
;
}
public
required
Uri
Url
{
get
;
init
;
}
public
string
?
Branch
{
get
;
init
;
}
public
string
?
Ref
{
get
;
init
;
}
};
}
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