diff --git a/flyteplugins/go/tasks/pluginmachinery/tasklog/template.go b/flyteplugins/go/tasks/pluginmachinery/tasklog/template.go index ea5c5f373c..3b319f291e 100644 --- a/flyteplugins/go/tasks/pluginmachinery/tasklog/template.go +++ b/flyteplugins/go/tasks/pluginmachinery/tasklog/template.go @@ -113,16 +113,6 @@ func (input Input) templateVarsForScheme(scheme TemplateScheme) TemplateVars { TemplateVar{defaultRegexes.ContainerName, input.ContainerName}, TemplateVar{defaultRegexes.ContainerID, containerID}, TemplateVar{defaultRegexes.Hostname, input.HostName}, - TemplateVar{defaultRegexes.PodRFC3339StartTime, input.PodRFC3339StartTime}, - TemplateVar{defaultRegexes.PodRFC3339FinishTime, input.PodRFC3339FinishTime}, - TemplateVar{ - defaultRegexes.PodUnixStartTime, - strconv.FormatInt(input.PodUnixStartTime, 10), - }, - TemplateVar{ - defaultRegexes.PodUnixFinishTime, - strconv.FormatInt(input.PodUnixFinishTime, 10), - }, ) if gotExtraTemplateVars { vars = append(vars, input.ExtraTemplateVarsByScheme.Pod...) @@ -187,6 +177,20 @@ func (input Input) templateVarsForScheme(scheme TemplateScheme) TemplateVars { } } + vars = append( + vars, + TemplateVar{defaultRegexes.PodRFC3339StartTime, input.PodRFC3339StartTime}, + TemplateVar{defaultRegexes.PodRFC3339FinishTime, input.PodRFC3339FinishTime}, + TemplateVar{ + defaultRegexes.PodUnixStartTime, + strconv.FormatInt(input.PodUnixStartTime, 10), + }, + TemplateVar{ + defaultRegexes.PodUnixFinishTime, + strconv.FormatInt(input.PodUnixFinishTime, 10), + }, + ) + return vars } diff --git a/flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go b/flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go index ad6eef25a3..eedc2e622c 100644 --- a/flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go +++ b/flyteplugins/go/tasks/pluginmachinery/tasklog/template_test.go @@ -71,8 +71,12 @@ func Test_Input_templateVarsForScheme(t *testing.T) { PodUnixFinishTime: 12345, } taskExecutionBase := Input{ - LogName: "main_logs", - TaskExecutionID: dummyTaskExecID(), + LogName: "main_logs", + TaskExecutionID: dummyTaskExecID(), + PodRFC3339StartTime: "1970-01-01T01:02:03+01:00", + PodRFC3339FinishTime: "1970-01-01T04:25:45+01:00", + PodUnixStartTime: 123, + PodUnixFinishTime: 12345, } flyinBase := Input{ HostName: "my-host", @@ -178,6 +182,10 @@ func Test_Input_templateVarsForScheme(t *testing.T) { {defaultRegexes.ExecutionName, "my-execution-name"}, {defaultRegexes.ExecutionProject, "my-execution-project"}, {defaultRegexes.ExecutionDomain, "my-execution-domain"}, + {defaultRegexes.PodRFC3339StartTime, "1970-01-01T01:02:03+01:00"}, + {defaultRegexes.PodRFC3339FinishTime, "1970-01-01T04:25:45+01:00"}, + {defaultRegexes.PodUnixStartTime, "123"}, + {defaultRegexes.PodUnixFinishTime, "12345"}, }, nil, nil,