-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
exit code is always -1
for steps that reference template defined in same yaml
#13297
Comments
I strongly recommend not including apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: steps-
spec:
entrypoint: hello-hello-hello
templateDefaults:
retryStrategy:
limit: 1
templates:
- name: hello-hello-hello
steps:
- - name: whalesay1
template: whalesay1
- name: whalesay1
container:
image: alpine:latest
command: [sh, -c]
args: ["exit 2"]
|
-1
for steps that reference template defined in same yaml
wow @jswxstw yours is even worse, 4 pods run, for me even 2 pods run is bad instead of 1! this is P1 issue right? |
Not really, the workflow I showed is equivalent to the following workflow: apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: steps-
spec:
entrypoint: hello-hello-hello
templates:
- name: hello-hello-hello
retryStrategy:
limit: 1
steps:
- - name: whalesay1
template: whalesay1
- name: whalesay1
retryStrategy:
limit: 1
container:
image: alpine:latest
command: [sh, -c]
args: ["exit 2"] Template |
but exit code 2 is not in the retrystrategy |
The node of template |
i'm thinking few things need to change:
for point 2 something like below func (woc *wfOperationCtx) mergedTemplateDefaultsInto(originalTmpl *wfv1.Template) error {
if woc.execWf.Spec.TemplateDefaults != nil {
originalTmplType := originalTmpl.GetType()
var tmplDefaultsMap map[string]interface{}
tmplDefaultsJson, err := json.Marshal(woc.execWf.Spec.TemplateDefaults)
if err != nil {
return err
}
err = json.Unmarshal(tmplDefaultsJson, &tmplDefaultsMap)
if err != nil {
return err
}
if originalTmplType == wfv1.TemplateTypeSteps {
delete(tmplDefaultsMap, "retryStrategy")
}
tmplDefaultsJson, err = json.Marshal(tmplDefaultsMap)
if err != nil {
return err
}
targetTmplJson, err := json.Marshal(originalTmpl)
if err != nil {
return err
}
resultTmpl, err := strategicpatch.StrategicMergePatch(tmplDefaultsJson, targetTmplJson, wfv1.Template{})
if err != nil {
return err
}
err = json.Unmarshal(resultTmpl, originalTmpl)
if err != nil {
return err
}
originalTmpl.SetType(originalTmplType)
}
return nil
} instead of argo-workflows/workflow/controller/operator.go Line 3988 in d1f2f01
|
It makes sense for me, but I'm afraid other members may have different opinions.
I'm afraid not. What if two parallel steps both failed? |
I don't think we can reasonably change the behavior of templateDefaults as is, it would be a breaking change. A new default for "just pods" would be acceptable, but we'd need some refactoring of the code around this because currently the sources of information when composing up individual nodes is large and this would expand that list again. |
Pre-requisites
:latest
image tag (i.e.quay.io/argoproj/workflow-controller:latest
) and can confirm the issue still exists on:latest
. If not, I have explained why, in detail, in my description below.What happened/what did you expect to happen?
with the below workflow and
retryStrategy
you would expect it not to retry since exit code 2 is not in theretryStrategy
but it will in fact retry becauselastRetry.exitCode
is always going to -1more context in #13228 (comment)
Version
3.4.11
Paste a small workflow that reproduces the issue. We must be able to run the workflow; don't enter a workflows that uses private images.
Logs from the workflow controller
see #12572 (comment)
Logs from in your workflow's wait container
The text was updated successfully, but these errors were encountered: