0

I have integrated a Cypress test as a task in Tekton Pipeline. Issue that I am experiencing is that Cypress sometimes even if there is failed test it is marked by Tekton as success.

Is there a way to tell Tekton to mark it as failure if Cypress have failed tests?

1 Answers1

0

You should exit with non-0, to mark a step as failed.

If Tekton marks a task as succeeded, in your pipelinerun/taskrun: exit code was 0.

SYN
  • 4,476
  • 1
  • 20
  • 22
  • I see. So I need to tell Cypress if there is a failure in one of the tests exit code should be non-zero. – Lazar Slavković-Raco Mar 07 '23 at 09:12
  • 1
    Indeed. Or, if your tool doesn't have that option: I would add some script (shell, python, ...) checking for test output, matching patterns (ERROR, ...) to exit accordingly. Either in the same step, or adding a final step (depending on runtime availability: if you need jq, yq, ... the image running your test may be missing tools, you can write test output into some shared volume then process it from another step, running from another image, ...) – SYN Mar 08 '23 at 17:56
  • Thanks for pointers. I would need to investigate further. Marking it as answer – Lazar Slavković-Raco Mar 09 '23 at 10:13