OPC # 0006: OPC Git Trunk-Based management
Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -51,7 +51,12 @@ public class ReleaseService(
|
||||
return blocked;
|
||||
}
|
||||
|
||||
var record = await history.CreateReleaseAsync(targetEnv, ImageName);
|
||||
// Resolve the Clarity branch for this environment and stamp the HEAD SHA
|
||||
// before creating the record so we capture "what was deployed" accurately.
|
||||
var branch = targetEnv switch { "fdev" => "develop", "staging" => "staging", "uat" => "uat", _ => "main" };
|
||||
var currentSha = promotions.GetBranchTipSha("Clarity", branch);
|
||||
|
||||
var record = await history.CreateReleaseAsync(targetEnv, ImageName, currentSha);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -183,9 +188,16 @@ public class ReleaseService(
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Stamp OPC ticket numbers from recent commits on the target branch.
|
||||
var branch = targetEnv switch { "fdev" => "develop", "staging" => "staging", "uat" => "uat", _ => "main" };
|
||||
try { record.OpcNumbers = await promotions.ExtractOpcNumbersAsync("Clarity", branch, 50, ct); }
|
||||
// Stamp the exact OPC ticket numbers introduced by this release:
|
||||
// diff from previous release's SHA to this release's SHA on the Clarity branch.
|
||||
try
|
||||
{
|
||||
var prev = await history.GetLastSuccessfulReleaseForEnvAsync(targetEnv);
|
||||
// Exclude the current (in-flight) record — it's not succeeded yet
|
||||
var prevSha = prev?.Id == record.Id ? null : prev?.CommitSha;
|
||||
if (currentSha is not null)
|
||||
record.OpcNumbers = await promotions.ExtractOpcNumbersDeltaAsync("Clarity", currentSha, prevSha, ct);
|
||||
}
|
||||
catch { /* git not configured — continue without OPC stamp */ }
|
||||
|
||||
await history.UpdateReleaseAsync(record);
|
||||
|
||||
Reference in New Issue
Block a user