From 1393854a8b6f6d5213f694e2a3b52b4282b600d7 Mon Sep 17 00:00:00 2001 From: Paul Clata <1316831+pclata@users.noreply.github.com> Date: Wed, 12 Oct 2022 12:48:12 -0700 Subject: [PATCH] fix(logs): flush Argo workflow log stream (#364) --- CHANGELOG.md | 4 ++++ service/internal/workflow/workflow.go | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aec7e5c0..41560f07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.15.2] - 2022-10-12 +### Changed +* Flush Argo Workflow log stream + ## [0.15.1] - 2022-10-11 ### Changed * Remove Argo Workflow status call from log streaming diff --git a/service/internal/workflow/workflow.go b/service/internal/workflow/workflow.go index 644cc843..8fefe82b 100644 --- a/service/internal/workflow/workflow.go +++ b/service/internal/workflow/workflow.go @@ -133,8 +133,8 @@ func (a ArgoWorkflow) Logs(ctx context.Context, workflowName string) (*Logs, err } // LogStream returns a log stream for a workflow. -func (a ArgoWorkflow) LogStream(ctx context.Context, workflowName string, w http.ResponseWriter) error { - stream, err := a.svc.WorkflowLogs(ctx, &argoWorkflowAPIClient.WorkflowLogRequest{ +func (a ArgoWorkflow) LogStream(argoCtx context.Context, workflowName string, w http.ResponseWriter) error { + stream, err := a.svc.WorkflowLogs(argoCtx, &argoWorkflowAPIClient.WorkflowLogRequest{ Name: workflowName, Namespace: a.namespace, LogOptions: &v1.PodLogOptions{ @@ -157,6 +157,7 @@ func (a ArgoWorkflow) LogStream(ctx context.Context, workflowName string, w http } fmt.Fprintf(w, "%s: %s\n", event.PodName, event.Content) + w.(http.Flusher).Flush() } }