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 Oct 15, 2024
1 parent 98dd46c commit a8c3609
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 @@ -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(),
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 @@ -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,
})
Expand All @@ -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,
})
Expand Down

0 comments on commit a8c3609

Please sign in to comment.