Skip to main content

Conditional execution

TLDR;

Opctl supports using if statements and predicates to make parts of your op run conditionally.

Example

  1. Start this op:
    name: conditionalExecution
    inputs:
    shouldRunContainer:
    description: whether to run the container or not
    boolean: {}
    run:
    if:
    - eq: [true, $(shouldRunContainer)]
    container:
    cmd: [echo, 'hello!']
    image: { ref: alpine }
  2. When prompted, enter true or false
  3. Observe you only see the container run and hello! logged when you enter true.