Gitlab CI fails to build hugo with fundor333/hugo

Hi all,

I’ve been using Gitlab CI/CD pages for years now with my blog and the image from fundor333/hugo.
Recently, after some months pause, I tried to push some changes and surprise, I got:

unning with gitlab-runner 15.3.0~beta.42.gdb7789ca (db7789ca)
  on blue-3.shared.runners-manager.gitlab.com/default zxwgkjAP
Preparing the "docker+machine" executor
00:08
Using Docker executor with image fundor333/hugo ...
Pulling docker image fundor333/hugo ...
Using docker image sha256:1608f1a19663712f7bf1157166b43e1be244a7380ed5f71efe476f1accddfe5a for fundor333/hugo with digest fundor333/hugo@sha256:a180074026caedf6daa127c35f8a91ebf6cd05d68a8acfcd2d1445702df45332 ...
Synchronizing submodule url for 'themes/tranquilpeak'
Cloning into '/builds/playthings/playthings.gitlab.io/themes/tranquilpeak'...
Submodule path 'themes/tranquilpeak': checked out '295d0fb3dd3d48f01902424cf90e6eed58768275'
Entering 'themes/tranquilpeak'
Entering 'themes/tranquilpeak'
Executing "step_script" stage of the job script
00:01
Using docker image sha256:1608f1a19663712f7bf1157166b43e1be244a7380ed5f71efe476f1accddfe5a for fundor333/hugo with digest fundor333/hugo@sha256:a180074026caedf6daa127c35f8a91ebf6cd05d68a8acfcd2d1445702df45332 ...
/bin/sh: eval: line 126: hugo: not found
$ hugo
Cleaning up project directory and file based variables

For some reason it does not seem to find Hugo anymore.
I’m not sure what I can do at this point.

I also tried to run the container locally on my laptop and got the same.

Hi, the problem isn’t Gitlab CI, but rather the image you are using. I just checked this myself:

root@os-docker:/home/ian# docker run fundor333/hugo
/bin/sh: hugo: not found

however, when I choose a different hugo container image:

root@os-docker:/home/ian# docker run gohugoio/hugo
hugo is the main command, used to build your Hugo site.

Hugo is a Fast and Flexible Static Site Generator
built with love by spf13 and friends in Go.

Complete documentation is available at http://gohugo.io/.

Usage:
  hugo [flags]
  hugo [command]

it works and find hugo. So the problem is the hugo image you are pulling.

Thanks @iwalker.
Seems I rushed a bit.
Apparently Alpine is now lacking the libc and libstdc++ libraries needed to run Hugo.
The image I specified is based on Alpine…
Love changes that happen with time and surprise people :slight_smile:

Tested with that broken image and:

  • apk add libstdc++
  • apk add gcompat

fix it.

Will probably create my own image now :slight_smile:

1 Like

Ah nice :slight_smile: well at least you can pull the (broken) image, then make your changes and push it back to a docker registry, or even container registry on your gitlab installation, and then use that in your CI/CD perhaps?

I found a nicer workaround at the moment after scouting around a bit.
I changed the .gitlab-ci.yml and added this part:

pages:
  image: fundor333/hugo
  script:
    - apk add gcompat
    - apk add libstdc++
    - hugo

the apk commands:)
Now works like a charm.

1 Like

In a community group, we are using the GitLab registry provided image for pages, .gitlab-ci.yml · main · everyonecancontribute / web / everyonecancontribute.gitlab.io · GitLab

image: registry.gitlab.com/pages/hugo:latest

Afaik its also based on Alpine.