github.com/argoproj/argo-events@v1.9.1/docs/sensors/trigger-conditions.md (about)

     1  # Trigger Conditions
     2  
     3  > v1.0 and after
     4  
     5  Triggers can be executed based on different dependency `conditions`.
     6  
     7  An example with `conditions`:
     8  
     9  ```yaml
    10  apiVersion: argoproj.io/v1alpha1
    11  kind: Sensor
    12  metadata:
    13    name: example
    14  spec:
    15    dependencies:
    16      - name: dep01
    17        eventSourceName: webhook-a
    18        eventName: example01
    19      - name: dep02
    20        eventSourceName: webhook-a
    21        eventName: example02
    22     - name: dep03
    23       eventSourceName: webhook-b
    24       eventName: example03
    25    triggers:
    26      - template:
    27          conditions: "dep02"
    28          name: trigger01
    29          http:
    30            url: http://abc.com/hello1
    31            method: GET
    32      - template:
    33          conditions: "dep02 && dep03"
    34          name: trigger02
    35          http:
    36            url: http://abc.com/hello2
    37            method: GET
    38      - template:
    39          conditions: "(dep01 || dep02) && dep03"
    40          name: trigger03
    41          http:
    42            url: http://abc.com/hello3
    43            method: GET
    44  ```
    45  
    46  `Conditions` is a boolean expression contains dependency names, the trigger
    47  won't be executed until the expression resolves to true. The operators in
    48  `conditions` include:
    49  
    50  - `&&`
    51  - `||`
    52  
    53  ## Triggers Without Conditions
    54  
    55  If `conditions` is missing, the default conditions to execute the trigger is
    56  `&&` logic of all the defined dependencies.
    57  
    58  ## Conditions Reset
    59  
    60  When multiple dependencies are defined for a trigger, the trigger won't be executed until the condition expression is resolved to `true`. Sometimes you might want to reset all the stakeholders of the conditions, `conditions reset` is the way to do it.
    61  
    62  For example, your trigger has a condition as `A && B`, both `A` and `B` are expected to have an event everyday. One day for some reason, `A` gets an event but `B` doesn't, then it ends up with today's `A` and tomorrow's `B` triggering an action, which might not be something you want. To avoid that, you can reset the conditions as following:
    63  
    64  ```yaml
    65  spec:
    66    triggers:
    67      - template:
    68          conditions: "dep01 && dep02"
    69          conditionsReset:
    70            - byTime:
    71                # Reset conditions at 23:59
    72                cron: "59 23 * * *"
    73                # Optional, defaults to UTC
    74                # More info for timezone: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    75                timezone: America/Los_Angeles
    76          name: trigger01
    77  ```