From a8c3609456738adb55de4056aca9d8c0c1d72a0d Mon Sep 17 00:00:00 2001 From: tooptoop4 <33283496+tooptoop4@users.noreply.github.com> Date: Wed, 16 Oct 2024 02:23:55 +1100 Subject: [PATCH] fix: only set `ARGO_PROGRESS_FILE` when needed. Partial fix for #13089 (#13743) --- workflow/controller/workflowpod.go | 9 ++++++--- workflow/controller/workflowpod_test.go | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/workflow/controller/workflowpod.go b/workflow/controller/workflowpod.go index 336d6e7406ad..def6833d1694 100644 --- a/workflow/controller/workflowpod.go +++ b/workflow/controller/workflowpod.go @@ -318,13 +318,16 @@ func (woc *wfOperationCtx) createWorkflowPod(ctx context.Context, nodeName strin {Name: common.EnvVarNodeID, Value: nodeID}, {Name: common.EnvVarIncludeScriptOutput, Value: strconv.FormatBool(opts.includeScriptOutput)}, {Name: common.EnvVarDeadline, Value: woc.getDeadline(opts).Format(time.RFC3339)}, - {Name: common.EnvVarProgressFile, Value: common.ArgoProgressPath}, } - // only set tick durations if progress is enabled. The EnvVarProgressFile is always set (user convenience) but the - // progress is only monitored if the tick durations are >0. + // only set tick durations/EnvVarProgressFile if progress is enabled. + // The progress is only monitored if the tick durations are >0. if woc.controller.progressPatchTickDuration != 0 && woc.controller.progressFileTickDuration != 0 { envVars = append(envVars, + apiv1.EnvVar{ + Name: common.EnvVarProgressFile, + Value: common.ArgoProgressPath, + }, apiv1.EnvVar{ Name: common.EnvVarProgressPatchTickDuration, Value: woc.controller.progressPatchTickDuration.String(), diff --git a/workflow/controller/workflowpod_test.go b/workflow/controller/workflowpod_test.go index ae6f4e9149f9..cd1cf6a9be2b 100644 --- a/workflow/controller/workflowpod_test.go +++ b/workflow/controller/workflowpod_test.go @@ -1989,13 +1989,13 @@ func TestProgressEnvVars(t *testing.T) { }) }) - t.Run("setting patch tick duration to 0 disables self reporting progress but still exposes the ARGO_PROGRESS_FILE env var as a convenience.", func(t *testing.T) { + t.Run("setting patch tick duration to 0 disables self reporting progress.", func(t *testing.T) { cancel, pod := setup(t, func(workflowController *WorkflowController) { workflowController.progressPatchTickDuration = 0 }) defer cancel() - assert.Contains(t, pod.Spec.Containers[0].Env, apiv1.EnvVar{ + assert.NotContains(t, pod.Spec.Containers[0].Env, apiv1.EnvVar{ Name: common.EnvVarProgressFile, Value: common.ArgoProgressPath, }) @@ -2009,13 +2009,13 @@ func TestProgressEnvVars(t *testing.T) { }) }) - t.Run("setting read file tick duration to 0 disables self reporting progress but still exposes the ARGO_PROGRESS_FILE env var as a convenience.", func(t *testing.T) { + t.Run("setting read file tick duration to 0 disables self reporting progress.", func(t *testing.T) { cancel, pod := setup(t, func(workflowController *WorkflowController) { workflowController.progressFileTickDuration = 0 }) defer cancel() - assert.Contains(t, pod.Spec.Containers[0].Env, apiv1.EnvVar{ + assert.NotContains(t, pod.Spec.Containers[0].Env, apiv1.EnvVar{ Name: common.EnvVarProgressFile, Value: common.ArgoProgressPath, })