Skip to content

Commit

Permalink
fix: only set ARGO_PROGRESS_FILE when needed. Partial fix for #13089 (
Browse files Browse the repository at this point in the history
  • Loading branch information
tooptoop4 authored and isubasinghe committed Oct 29, 2024
1 parent c6dc73f commit 15576bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
9 changes: 6 additions & 3 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,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(),
Expand Down
8 changes: 4 additions & 4 deletions workflow/controller/workflowpod_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1876,13 +1876,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,
})
Expand All @@ -1896,13 +1896,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,
})
Expand Down

0 comments on commit 15576bd

Please sign in to comment.