How to Fix “Job Failed: Execution Took Longer Than 10m0s” Error in GitLab Pipeline

Spread the love

Introduction:

 In the world of continuous integration and deployment, encountering timeout issues in GitLab pipelines can disrupt workflows, especially when dealing with large Docker images. Recently, I faced a similar issue where my GitLab pipeline failed during the image push step with the error:

JavaScript
 ERROR: Job failed: execution took longer than 10m0s seconds.

This error occurred because the Docker image was large, causing the upload to exceed the default GitLab Runner timeout of 10 minutes. In this article, I’ll walk you through how I resolved this error and successfully pushed the Docker image.

The Problem: Timeout in GitLab Runner

While running my pipeline, the Docker build step completed successfully. However, when pushing the Docker image, the pipeline failed due to a timeout error. Below is the exact error message I encountered:

JavaScript
WARNING: step_script could not run to completion because the timeout was exceeded. For more control over job and script timeouts see: https://docs.gitlab.com/ee/ci/runners/configure_runners.html#set-script-and-after_script-timeouts  
ERROR: Job failed: execution took longer than 10m0s seconds  

Upon investigation, I found that the runner had a default timeout of 10 minutes, which wasn’t sufficient for my pipeline to upload the large Docker image.

Steps to Resolve the Timeout Issue

To resolve this issue, I updated the timeout setting for my GitLab runner. Here’s how you can do it:

  1. Access Runner Settings:
    – Go to your GitLab project and navigate to Settings > CI/CD.
    – Scroll down to the Runners section and locate your configured runner.
  2. Edit the Runner Configuration:
    – Click the Edit button next to your runner.
  3. Increase the Timeout Limit:
    – Scroll down to the Maximum job timeout option.
    – By default, this is set to 600 seconds (10 minutes). Increase the timeout to a value that suits your pipeline requirements. For example, set it to 1800 seconds (30 minutes) for large image uploads.
  4. Save the Changes:
    – Click Save to update the runner configuration.
See also  Gitlab unable to get local issuer certificate

Once you’ve updated the timeout, rerun your pipeline. The increased timeout should now allow sufficient time for the Docker image to be pushed successfully.

Conclusion:

 Timeout errors like Job failed: execution took longer than 10m0s seconds can be frustrating, but they are often resolved with simple configuration changes. By increasing the timeout in the GitLab Runner settings, you can handle long-running tasks like uploading large Docker images without interruptions.

If you’re running your own GitLab Runner, it’s essential to understand the configuration options available and optimize them for your CI/CD requirements. I hope this guide helps you overcome similar issues in your pipelines and keeps your deployments running smoothly.

Feel free to share your thoughts or ask questions in the comments section below!

Leave a Comment

PHP Code Snippets Powered By : XYZScripts.com