Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

444
Views
Argo stop workflow early, mark complete

Imagine I have a workflow with 5 steps.

Step 2 may or may not create a file as its output (which is then used as input to subsequent steps).

  • If the file is created, I want to run the subsequent steps.
  • If no file gets created in step 2, I want to mark the workflow as completed and not execute steps 3 through to 5.

I'm sure there must be a simple way to do this yet I'm failing to figure out how.

I tried by making step 2 return non-zero exit code when no file is created and then using when: "{{steps.step2.outputs.exitCode}} == 0" on step 3, but that still executes step 4 and 5 (not to mention marks step 2 as "failed")

So I'm out of ideas, any suggestions are greatly appreciated.

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

By default, a step that exits with a non-zero exit code fails the workflow.

I would suggest writing an output parameter to determine whether the workflow should continue.

- name: yourstep
  container:
    command: [sh, -c]
    args: ["yourcommand; if [ -f /tmp/yourfile ]; then echo continue > /tmp/continue; fi"]
  outputs:
    parameters:
    - name: continue
      valueFrom:
        default: "stop"
        path: /tmp/continue

Alternatively, you can override the fail-on-nonzero-exitcode behavior with continueOn.

continueOn:
  failed: true

I'd caution against continueOn.failed: true. If your command throws a non-zero exit code for an unexpected reason, the workflow won't fail like it should, and the bug might go un-noticed.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!