fix: enhance step log retrieval with prefix matching for parameterized steps

This commit is contained in:
lilong.129
2025-06-23 21:42:09 +08:00
parent b320bbda31
commit e6ce61368e
2 changed files with 7 additions and 5 deletions

View File

@@ -221,8 +221,9 @@ func (g *HTMLReportGenerator) getStepLogs(stepName string, startTime int64, elap
for _, logEntry := range g.LogData {
// Check for step boundaries to control inclusion
if logEntry.Message == RUN_STEP_START {
if stepFieldValue, exists := logEntry.Fields["step"]; exists {
if stepFieldValue == stepName {
if stepFieldValue, exists := logEntry.Fields["step"].(string); exists {
// use prefix matching for parameterized steps
if strings.HasPrefix(stepName, stepFieldValue) {
inCurrentStep = true
stepLogs = append(stepLogs, logEntry)
continue
@@ -234,8 +235,9 @@ func (g *HTMLReportGenerator) getStepLogs(stepName string, startTime int64, elap
}
if logEntry.Message == RUN_STEP_END {
if stepFieldValue, exists := logEntry.Fields["step"]; exists {
if stepFieldValue == stepName {
if stepFieldValue, exists := logEntry.Fields["step"].(string); exists {
// use prefix matching for parameterized steps
if strings.HasPrefix(stepName, stepFieldValue) {
stepLogs = append(stepLogs, logEntry)
inCurrentStep = false
continue