Fixing GitLab pipeline stuck on tzdata configuration
Are your pipelines stuck forever waiting one one job to finish? Does that job always time out? And in the console output for that job, is it stuck at the following point?
Yes, being stuck at "Configuring tzdata" is a nightmare often faced for new pipeline elements, especially those which use a newer docker image than other jobs in the pipeline.
I've had this issue before, fixed it before, and figured I would never see it again. Then, when I added a job to test the building of pipeline assets on a newer version of Ubuntu, the issue came back. All I did was copy the existing job, and change the image. Other than that, everything was the same, and should have worked - so I thought.
The fix for this is usually to have any
apt-get update or
apt update lines preceded by
DEBIAN_FRONTEND=noninteractive, so you would have some yaml that looks as follows:
before_script: - DEBIAN_FRONTEND=noninteractive apt-get update
The job I copied and added a newer Ubuntu image to use has the following snippet:
when: on_success before_script: - DEBIAN_FRONTEND=noninteractive apt-get update script: - apt install -y nodejs npm - nodejs --version - npm --version - npm cache clean --force - npm install --global gulp-cli - npm install - gulp release
That has always worked, no issues, so I wasn't expecting any issues buy putting this against a new image. It took a bit of digging around, and trial and error, but again it is resolved by adding
DEBIAN_FRONTEND=noninteractive to just the right point. In this case, the first line of the
script: section on the new job. The new job now reads:
when: on_success before_script: - DEBIAN_FRONTEND=noninteractive apt-get update script: - DEBIAN_FRONTEND=noninteractive apt install -y nodejs npm - nodejs --version - npm --version - npm cache clean --force - npm install --global gulp-cli - npm install - gulp release
And now my pipeline completes. Simple, but annoying.
The lesson here is that if you're doing something likely to change the kernel, make that process noninteractive. It will save loads of time, and sanity.