Hugo job on Gitlab fails

Hello!

I am using All inOne theme with Hugo. Repo: https://gitlab.com/rootkea/rootkea.gitlab.io

Whenever I try to push to the repo the Gitlab job fails with the following log:

Cloning repository...
Cloning into '/builds/rootkea/rootkea.gitlab.io'...
Checking out 6d8dc6f1 as master...
Skipping Git submodules setup
$ hugo
Building sites … Total in 36 ms
Error: Error building site: "/builds/rootkea/rootkea.gitlab.io/content/blog/2018-01/mac小白探索记1-基本设置与常用软件.md:45:5": failed to extract shortcode: template for shortcode "center" not found
ERROR: Job failed: exit code 255  

It complains about missing center shortcode but I can see center.html in themes/AllinOne/layouts/shortcodes/ What am I missing?

BTW, the build gets completed successfully on local machine. So I’m guessing it’s either a version issue or an incorrect Gitlab configuration.

Thank you!

Hi — since it builds locally but not in GitLab CI, my hunch is that it isn’t cloning your repo recursively, so your theme repo is not cloned, and this would explain the missing shortcode.

Checkout their docs on handling git submodules in CI:

https://docs.gitlab.com/ee/ci/git_submodules.html#using-git-submodules-in-your-ci-jobs

Thanks for the link!
Adding following CI variable to .gitlab-ci.yml fixed the issue:

variables:
  GIT_SUBMODULE_STRATEGY: recursive 

Now the site gets build successfully but doesn’t quite look like the one built locally. That is, it is missing css, images etc. Not sure why. Still looking into it.

Happy to hear it’s building in CI now

For this, check if the asset paths are relative or absolute

Oops! I used foo.gitlab.com instead of foo.gitlab.io in baseURL
Thank you for all your help! :slight_smile: