Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • coscine/backend/scripts/graphdeployer
1 result
Select Git revision
Loading items
Show changes
Commits on Source (3)
......@@ -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;
}
......
......@@ -7,7 +7,7 @@
<AssemblyName>Coscine.GraphDeployer</AssemblyName>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>2.0.0</Version>
<Version>2.0.1</Version>
</PropertyGroup>
<PropertyGroup>
......
......@@ -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; }
};
}