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.
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:
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.