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

pre conditions not working #810

Closed
kriyanshii opened this issue Feb 5, 2025 · 5 comments · Fixed by #813
Closed

pre conditions not working #810

kriyanshii opened this issue Feb 5, 2025 · 5 comments · Fixed by #813
Assignees
Milestone

Comments

@kriyanshii
Copy link
Contributor

this is the example yaml that shows the usage of pre condition;

  params: foo
  steps:
    - name: step1
      command: echo start
      output: OUT1
    - name: foo
      command: echo foo
      depends:
        - step1
      preconditions:
        - condition: $OUT1
          expected: start
    - name: bar
      command: echo bar
      depends:
        - step1
      preconditions:
        - condition: "$1"
          expected: bar

this is the output:



{"time":"2025-02-05T22:34:14.521804567+05:30","level":"INFO","msg":"DAG execution initiated","DAG":"test","requestID":"80154e04-094f-46c1-8969-7278fa9a404f","logFile":"/home/kriyanshi/.dagu/logs/test/start_test.20250205.22:34:14.519.80154e04.log"}
{"time":"2025-02-05T22:34:14.529858957+05:30","level":"INFO","msg":"Initializing status file: /home/kriyanshi/.dagu/data/test-48b48a4e4c6906747466e84cc9826a38/test.20250205.17:04:14.529Z.80154e04.dat"}
{"time":"2025-02-05T22:34:14.544885896+05:30","level":"INFO","msg":"DAG execution started","reqId":"80154e04-094f-46c1-8969-7278fa9a404f","name":"test","params":["foo"]}
{"time":"2025-02-05T22:34:14.548462329+05:30","level":"INFO","msg":"Step execution started","step":"step1"}
{"time":"2025-02-05T22:34:14.565154033+05:30","level":"INFO","msg":"Step execution finished","step":"step1","status":4}
{"time":"2025-02-05T22:34:14.653424532+05:30","level":"INFO","msg":"Checking pre conditions for \"foo\""}
{"time":"2025-02-05T22:34:14.656410766+05:30","level":"INFO","msg":"Pre conditions failed for \"foo\""}
{"time":"2025-02-05T22:34:14.659711016+05:30","level":"INFO","msg":"Checking pre conditions for \"bar\""}
{"time":"2025-02-05T22:34:14.665852367+05:30","level":"INFO","msg":"Pre conditions failed for \"bar\""}
{"time":"2025-02-05T22:34:14.770496823+05:30","level":"INFO","msg":"DAG execution finished","status":4}

Summary ->
+--------------------------------------+------+---------------------------+---------------------------+----------+--------+-------+
| REQUESTID                            | NAME | STARTED AT                | FINISHED AT               |   STATUS | PARAMS | ERROR |
+--------------------------------------+------+---------------------------+---------------------------+----------+--------+-------+
| 80154e04-094f-46c1-8969-7278fa9a404f | test | 2025-02-05T22:34:14+05:30 | 2025-02-05T22:34:14+05:30 | finished | foo    |       |
+--------------------------------------+------+---------------------------+---------------------------+----------+--------+-------+
Details ->
+---+-------+---------------------------+---------------------------+----------+---------+-------------------------------------------------------+
| # | STEP  | STARTED AT                | FINISHED AT               | STATUS   | COMMAND | ERROR                                                 |
+---+-------+---------------------------+---------------------------+----------+---------+-------------------------------------------------------+
| 1 | step1 | 2025-02-05T22:34:14+05:30 | 2025-02-05T22:34:14+05:30 | finished | start   |                                                       |
| 2 | foo   | -                         | -                         | skipped  | foo     | condition was not met: Condition=$OUT1 Expected=start |
| 3 | bar   | -                         | -                         | skipped  | bar     | condition was not met: Condition=$1 Expected=bar      |
+---+-------+---------------------------+---------------------------+----------+---------+-------------------------------------------------------+

clearly it is not getting the value of $OUT1 of $1

@ghansham
Copy link

ghansham commented Feb 5, 2025

Thanks @kriyanshii for raising the issue. I encountered something similar at my end.

@yottahmd
Copy link
Collaborator

yottahmd commented Feb 5, 2025

Thank you for raising this issue with the example. Sorry for the inconvenience! I will fix this as soon as I can.

@yottahmd yottahmd added this to the v1.16.1 milestone Feb 5, 2025
@kriyanshii
Copy link
Contributor Author

somehow in context_step.go you have implemented

opts = append(opts, cmdutil.WithVariables(c.outputVariables.Variables()))

but you haven't implemented same for pre conditions.

@yottahmd yottahmd self-assigned this Feb 6, 2025
yottahmd added a commit that referenced this issue Feb 9, 2025
@kriyanshii
Copy link
Contributor Author

thank you so much!!

@yottahmd
Copy link
Collaborator

yottahmd commented Feb 9, 2025

Thank you so much, too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants