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

lifecycle hooks executed when conditions are not met(DAG) #11422

Closed
3 tasks done
GeunSam2 opened this issue Jul 22, 2023 · 4 comments · Fixed by #11682
Closed
3 tasks done

lifecycle hooks executed when conditions are not met(DAG) #11422

GeunSam2 opened this issue Jul 22, 2023 · 4 comments · Fixed by #11682

Comments

@GeunSam2
Copy link
Contributor

Pre-requisites

  • I have double-checked my configuration
  • I can confirm the issues exists when I tested with :latest
  • I'd like to contribute the fix myself (see contributing guide)

What happened/what you expected to happen?

A life cycle hook that should not be executed is executed.
When before task is fail in dag workflows, next step task's running lifecycle hook trigger without met any condition.

image
B.hooks.running should not have been executed.

Version

latest

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.

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: lifecycle-hook-tmpl-level-
spec:
  entrypoint: main
  templates:
    - name: main
      dag:
        tasks:
        - name: A
          hooks:
            running: 
              expression: tasks.A.status == "Running"
              template: http
            success:
              expression: tasks.A.status == "Succeeded"
              template: http
          template: failtask
        - name: B
          dependencies: [A]
          hooks:
            running: 
              expression: tasks.B.status == "Running"
              template: http
            success:
              expression: tasks.B.status == "Succeeded"
              template: http
          template: echo

    - name: echo
      container:
        image: alpine:3.6
        command: [sh, -c]
        args: ["echo sample"]

    - name: failtask
      container:
        image: alpine:3.6
        command: [sh, -c]
        args: ["exit 1"]

    - name: http
      http:
        url: "https://raw.githubusercontent.com/argoproj/argo-workflows/4e450e250168e6b4d51a126b784e90b11a0162bc/pkg/apis/workflow/v1alpha1/generated.swagger.json"


### Logs from the workflow controller

```text
kubectl logs -n argo deploy/workflow-controller | grep ${workflow}

Logs from in your workflow's wait container

kubectl logs -n argo -c wait -l workflows.argoproj.io/workflow=${workflow},workflow.argoproj.io/phase!=Succeeded
@GeunSam2 GeunSam2 changed the title lifecycle hooks executed when conditions are not met lifecycle hooks executed when conditions are not met(DAG) Jul 22, 2023
@sarabala1979
Copy link
Member

@GeunSam2 looks like task. b is changing to running and changed to skip or omitted. We need to take a look code.

Do you like to volunteer to fix this issue?

@sarabala1979 sarabala1979 added the P3 Low priority label Jul 27, 2023
@GeunSam2
Copy link
Contributor Author

yes. im interested in this issue.
I'll try to fix it.

@dylanslavin
Copy link

My team ran into the same issue recently. I'd be interested in helping with a fix, if that's a possibility.

@toyamagu-2021
Copy link
Member

toyamagu-2021 commented Aug 26, 2023

#11682 will fix this issue.

image

terrytangyuan pushed a commit that referenced this issue Aug 26, 2023
…1682)

Signed-off-by: toyamagu2021@gmail.com <toyamagu2021@gmail.com>
terrytangyuan pushed a commit that referenced this issue Sep 5, 2023
…1682)

Signed-off-by: toyamagu2021@gmail.com <toyamagu2021@gmail.com>
dpadhiar pushed a commit to dpadhiar/argo-workflows that referenced this issue May 9, 2024
) (argoproj#11682)

Signed-off-by: toyamagu2021@gmail.com <toyamagu2021@gmail.com>
Signed-off-by: Dillen Padhiar <dillen_padhiar@intuit.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants