OPC # 0006: OPC Git Trunk-Based management
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -2,6 +2,7 @@ using ControlPlane.Core.Models;
|
||||
using ControlPlane.Core.Services;
|
||||
using Docker.DotNet;
|
||||
using Docker.DotNet.Models;
|
||||
using LibGit2Sharp;
|
||||
|
||||
namespace ControlPlane.Api.Services;
|
||||
|
||||
@@ -49,6 +50,14 @@ public class ImageBuildService(
|
||||
|
||||
var record = await history.CreateBuildAsync(BuildKind.DockerImage, ImageName);
|
||||
|
||||
// Capture HEAD SHA so the build is traceable back to a specific commit
|
||||
try
|
||||
{
|
||||
using var repo = new Repository(repoRoot);
|
||||
record.CommitSha = repo.Head.Tip?.Sha;
|
||||
}
|
||||
catch { /* not a git repo or no commits yet — CommitSha stays null */ }
|
||||
|
||||
try
|
||||
{
|
||||
var socketUri = config["Docker:Socket"] ?? "npipe://./pipe/docker_engine";
|
||||
|
||||
Reference in New Issue
Block a user