stepci icon indicating copy to clipboard operation
stepci copied to clipboard

[Feature]: Set a "global" timeout for the entire workflow

Open AndrewFarley opened this issue 2 years ago • 3 comments

What happened?

I'd like to be able to set a job-level timeout for the entire job, not just per-step. This is vital for being able to use StepCI in a type of regular usage scheduled on a cron without having it "overlap" the next run.

What did you expect to happen?

If I could have a configuration such as...

version: "1.1"
name: Sample Workflow
tests:
  example:
    timeout: 20000  # Max of 20 seconds for the entire job
    steps:
      - name: Step 1 - Example Basic Auth with headers, and retries
         http:
           timeout: 10000
           retries: 1
           url: https://google.com/BasicAuth
           method: GET
           auth:
             basic:
               username: hello
               password: world
           check:
             status: "/^20/"
      - name: Step 2 - Example with params
         http:
           timeout: 10000
           url: https://google.com/QueryParams
           method: GET
           params:
             hello: world
             world: hello
          check:
            status: "/^20/"
      - name: Step 3 - CSS Selector
         http:
           timeout: 10000
           url: https://google.com/QueryParams
           method: GET
           check:
             selectors:
               title: Google

With this above configuration, your run would never take longer than 20 seconds, even though you have enough timeouts in the 3 steps present which COULD take it to 30 seconds. But because of the global timeout, if all the different steps timeout and take their max time, by the end of the second one the job will exit out (having had 20 seconds go by) and it would never execute the third one.

Version

HEAD/Latest as of Jan 15, 2023

Environment

node: ~18.x

How can we reproduce this bug?

No response

Relevant log output

No response

Would you be interested in working on a bugfix for this issue?

  • [ ] Yes! Assign me

AndrewFarley avatar Jan 14 '23 19:01 AndrewFarley

Note: This may only be relevant and might want to be moved into the stepci/runner codebase.

AndrewFarley avatar Jan 14 '23 19:01 AndrewFarley

Thank for starting the issue, Keep in mind, you can already specify timeout in your CI/CD

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idtimeout-minutes

mishushakov avatar Jan 14 '23 19:01 mishushakov

@mishushakov Timing it out elsewhere isn't handling it gracefully with a proper resultset map about the failure and what occurred and at what step it failed/stalled at. That doesn't really solve the underlying issue.

Note: I'd be happy to sponsor someone to add this feature if anyone's down

AndrewFarley avatar Jan 17 '23 04:01 AndrewFarley