Issue when deploying with Gitlab

I am able to build my site locally with both hugo server and hugo command even if it takes long time (about 30 or 50s),
But when trying to deploy with Gitlab pages, it failed regularly and I got the following message:

Updating/initializing submodules recursively...
$ hugo --gc
Building sites … ERROR: Job failed: execution took longer than 1h0m0s seconds

The repository is well clone but not able to deploy on the pages itself.

The message is a little bit laconic and I suspect an issue with subsidize, but as far as I know, I don’t use any subsmodule.
Any idea of how to solve the issue or at least identify where it comes from?

Ha, you talk about being laconic! My first thought is to use template metrics to figure out why the site takes so long to build locally, but maybe you’ve got your own thing going with some massive amount of data or something…

If you aren’t looking for advice reducing build time, I’d look at the issue as being the GitLab’s hardware not liking how long it is taking to clean up your project. If it is using the runners, it is possible your jobs are sharing capacity with a bunch of projects, and that could time it out. I’d try a dedicated runner, a different way to put the site files into the repo served as your site…

Also, how about removing --gc? Move whatever that cleans into a different part of the build chain. :thinking:

Check out Requesting Help and post repos if you want more eyes to look at your issue. :slight_smile:

Thanks maiki.
You’re right. I should have began with long time building site locally.
As suggested, I run template metrics and got the following result:

Building sites …

Template Metrics:

 cumulative       average       maximum
   duration      duration      duration  count  template
 ----------      --------      --------  -----  --------
17.7582265s  201.798028ms      1.08472s     88  _default\single.html
 4.3136064s   12.289476ms    651.0786ms    351  partials/page-summary.html
 2.5492578s   212.43815ms    1.0701762s     12  _default\list.html
 1.9551665s   39.901357ms    522.6987ms     49  _default\taxonomy.html
 719.5393ms    8.176582ms    505.6014ms     88  partials/aside.html
 527.5678ms    5.797448ms    503.9326ms     91  shortcodes/figure.html
 298.2495ms    3.389198ms     231.287ms     88  partials/related.html
  98.9129ms    1.978258ms     11.9893ms     50  _internal/_default/rss.xml
  89.8858ms     587.488µs      40.958ms    153  partials/header.html
   64.971ms      70.391µs      2.0052ms    923  partials/icons.html
   56.964ms     11.3928ms     27.9908ms      5  shortcodes/gallery.html
  48.9559ms     319.973µs      2.0003ms    153  partials/site-nav.html
  42.9315ms     122.311µs      2.9956ms    351  partials/post/post-date.html
  29.9712ms     29.9712ms     29.9712ms      1  404.html
  25.9697ms     169.736µs      2.0052ms    153  partials/pagination.html
   24.975ms     12.4875ms     14.9856ms      2  _default\terms.html
   21.976ms      21.976ms      21.976ms      1  sitemap.xml
  18.9824ms     333.024µs      5.9958ms     57  shortcodes/extract.html
  15.9859ms     15.9859ms     15.9859ms      1  index.html
  13.9797ms       91.37µs      1.0014ms    153  partials/meta/ogimage-maybe.html
  10.0016ms      65.369µs      1.0114ms    153  partials/global-styles.html
   9.9933ms      113.56µs      1.0022ms     88  partials/tags.html
   9.9909ms      9.9909ms      9.9909ms      1  partials/home/latest.html
   8.9918ms      8.9918ms      8.9918ms      1  shortcodes/children.html
    6.996ms       2.332ms      2.9978ms      3  partials/site-footer.html
   5.9944ms      39.179µs           1ms    153  partials/meta/http-referrer.html
   4.9955ms      4.9955ms      4.9955ms      1  partials/home/teaser.html
   4.9901ms     166.336µs       998.8µs     30  shortcodes/video.html
   4.0041ms       26.17µs      1.0038ms    153  partials/meta/name-author.html
   3.9927ms      1.3309ms      1.9991ms      3  partials/social.html
   2.9971ms      19.588µs       999.9µs    153  partials/async-scripts.html
    999.5µs      11.357µs       999.5µs     88  partials/toc.html
    999.1µs       58.77µs       999.1µs     17  partials/head/video.min.css
    998.8µs       6.528µs       998.8µs    153  partials/head/favicon.html
    998.8µs       6.528µs       998.8µs    153  partials/head/portfolio.min.css
      995µs     165.833µs         995µs      6  shortcodes/audio.html
         0s            0s            0s      2  shortcodes/hero.html
         0s            0s            0s      1  partials/head/site-verification.html
         0s            0s            0s      1  shortcodes/bicolumn.html
         0s            0s            0s      1  shortcodes/form-contact.html
         0s            0s            0s    153  partials/head/main.min.css
         0s            0s            0s      1  shortcodes/list.html
         0s            0s            0s      1  robots.txt

                   | EN

Pages | 190
Paginator pages | 14
Non-page files | 345
Static files | 13
Processed images | 663
Aliases | 35
Sitemaps | 1
Cleaned | 0

I guess that the single.html is the problem.
You’re right. I have to focus on reducing the building time but don’t know where to start from.
Could you suggest a process or something like that.