Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: avoid nil pointer dereference. Fixes #9269 #9787

Merged
merged 1 commit into from
Oct 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions workflow/controller/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,6 @@ func (woc *wfOperationCtx) setGlobalParameters(executionParameters wfv1.Argument
woc.globalParams[common.GlobalVarWorkflowParameters] = string(workflowParameters)
}
for _, param := range executionParameters.Parameters {
if param.Value == nil && param.ValueFrom == nil {
return fmt.Errorf("either value or valueFrom must be specified in order to set global parameter %s", param.Name)
}
if param.ValueFrom != nil && param.ValueFrom.ConfigMapKeyRef != nil {
cmValue, err := common.GetConfigMapValue(woc.controller.configMapInformer, woc.wf.ObjectMeta.Namespace, param.ValueFrom.ConfigMapKeyRef.Name, param.ValueFrom.ConfigMapKeyRef.Key)
if err != nil {
Expand All @@ -587,8 +584,10 @@ func (woc *wfOperationCtx) setGlobalParameters(executionParameters wfv1.Argument
} else {
woc.globalParams["workflow.parameters."+param.Name] = cmValue
}
} else {
} else if param.Value != nil {
woc.globalParams["workflow.parameters."+param.Name] = param.Value.String()
} else {
return fmt.Errorf("either value or valueFrom must be specified in order to set global parameter %s", param.Name)
}
}
if woc.wf.Status.Outputs != nil {
Expand Down