Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set default Timeout on Github action pipeline

Normally, my pipelines take 15 minutes to execute.

Recently, for some strange reasons, some pipelines take between 45 minutes and 6 hours to fail.

Is it possible to set a default timeout limit on GitHub Action's pipeline (for example, auto cancel after 30 minutes)?

like image 667
Kevin ABRIOUX Avatar asked Nov 27 '19 15:11

Kevin ABRIOUX


People also ask

What is the default timeout for GitHub Actions?

We often set a “pip” timeout of 1 or 2 minutes to ensure the CI is using wheels instead of compiling from source, which can take tens of minutes or fail. A job-level timeout can likewise be set.

How do I run jobs sequentially in GitHub Actions?

To run jobs sequentially, you can define dependencies on other jobs using the jobs. <job_id>. needs keyword. Each job runs in a runner environment specified by runs-on .

What is GitHub Head_ref?

github.head_ref. string. The head_ref or source branch of the pull request in a workflow run. This property is only available when the event that triggers a workflow run is either pull_request or pull_request_target . github.job.

What is action minutes GitHub?

GitHub Actions is a feature provided by GitHub to create workflows which can run on triggering any GitHub event, for eg run the build of the project on creation of a pull request. GitHub actions can be configured by creation of a workflow in the form of a yaml file and placing it under .

How do I set timeouts in the pipeline?

There are two timeout can be set: project timeout and runner timeout. It is possible to set timeout per job from Settings -> CI/CD -> General pipelines runner's timeout can be set from Settings -> CI/CD -> Runners, select the runner from Runners activated for this project and edit the Maximum job timeout from the runner edit form.

How long should a GitHub action pipeline take to execute?

Normally, my pipelines take 15 minutes to execute. Recently, for some strange reasons, some pipelines take between 45 minutes and 6 hours to fail. Is it possible to set a default timeout limit on GitHub Action's pipeline (for example, auto cancel after 30 minutes)?

What is the use of set timeout in GitLab-Runner?

timeout allows you to configure a timeout for a specific job. For example: build: script: build.sh timeout: 3 hours 30 minutes test: script: rspec timeout: 3h 30m The job-level timeout can exceed the project-level timeout but can’t exceed the Runner-specific timeout. Can you set the timeout while running the gitlab-runner locally?

How do I set a global timeout in a CI Project?

You can set a global timeout in "Project settings -> CI/CD Pipelines -> Timeout" or "Project settings -> Builds -> Timeout" in older versions. As of version 12.3, you can set a timeout per stage in your CI .yml file using timeout: timeout allows you to configure a timeout for a specific job. For example:


1 Answers

You can change default time limit in two ways

  • job.<id>.timeout-minutes sets a timeout for a whole job
  • job.<id>.steps.timeout-minutes sets a timeout for a single step

Your scenario:

my-job:
 runs-on:         ubuntu-latest
 timeout-minutes: 30
like image 54
Samira Avatar answered Oct 22 '22 14:10

Samira