Skip to content

Commit

Permalink
Make the section header more descriptive
Browse files Browse the repository at this point in the history
Instead of just using the task name as section header, use "Executing task TASKNAME".
This makes the section headers more consistent with the section headers used by GitLab CI which uses e.g. "Executing "step_script" stage of the job script"
  • Loading branch information
ap0llo committed Sep 2, 2024
1 parent 14f7343 commit e06e5d7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/Cake.GitLabCI.Module/GitLabCIEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,17 @@ public GitLabCIEngine(ICakeDataService dataService, ICakeLog log, IConsole conso

private void OnBeforeSetup(object sender, BeforeSetupEventArgs e)
{
WriteSectionStart("Setup");
WriteSectionStart("setup", "Executing Setup");
}

private void OnAfterSetup(object sender, AfterSetupEventArgs e)
{
WriteSectionEnd("Setup");
WriteSectionEnd("setup");
}

private void OnBeforeTaskSetup(object sender, BeforeTaskSetupEventArgs e)
{
WriteSectionStart(GetSectionNameForTask(e.TaskSetupContext.Task.Name), e.TaskSetupContext.Task.Name);
WriteSectionStart(GetSectionNameForTask(e.TaskSetupContext.Task.Name), $"Executing task \"{e.TaskSetupContext.Task.Name}\"");
}

private void OnAfterTaskTeardown(object sender, AfterTaskTeardownEventArgs e)
Expand All @@ -65,17 +65,17 @@ private void OnAfterTaskTeardown(object sender, AfterTaskTeardownEventArgs e)

private void OnBeforeTeardown(object sender, BeforeTeardownEventArgs e)
{
WriteSectionStart("Teardown");
WriteSectionStart("teardown", "Executing Teardown");
}

private void OnAfterTeardown(object sender, AfterTeardownEventArgs e)
{
WriteSectionEnd("Teardown");
WriteSectionEnd("teardown");
}

private void WriteSectionStart(string sectionName, string sectionHeader = null)
private void WriteSectionStart(string sectionName, string sectionHeader)
{
_console.WriteLine("{0}", $"{AnsiEscapeCodes.SectionMarker}section_start:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{sectionName}\r{AnsiEscapeCodes.SectionMarker}{AnsiEscapeCodes.ForegroundBlue}{sectionHeader ?? sectionName}{AnsiEscapeCodes.Reset}");
_console.WriteLine("{0}", $"{AnsiEscapeCodes.SectionMarker}section_start:{DateTimeOffset.UtcNow.ToUnixTimeSeconds()}:{sectionName}\r{AnsiEscapeCodes.SectionMarker}{AnsiEscapeCodes.ForegroundBlue}{sectionHeader}{AnsiEscapeCodes.Reset}");
}

private void WriteSectionEnd(string sectionName)
Expand Down

0 comments on commit e06e5d7

Please sign in to comment.