Prevent tzdata install hang in GitLab CI Ubuntu image (!60)

The Ubuntu based GitLab CI jobs have recently started being terminated
after the default 1 hour timeout.  Installing / updating packages in the
image is updating the tzdata package which is prompting for input which
it will never receive, hence the hang.  The end of output from the job
looks like this:

    Setting up tzdata (2020a-0ubuntu0.20.04) ...
    debconf: unable to initialize frontend: Dialog
    debconf: (TERM is not set, so the dialog frontend is not usable.)
    debconf: falling back to frontend: Readline
    Configuring tzdata
    ------------------
    Please select the geographic area in which you live. Subsequent configuration
    questions will narrow this down by presenting a list of cities, representing
    the time zones in which they are located.
      1. Africa      4. Australia  7. Atlantic  10. Pacific  13. Etc
      2. America     5. Arctic     8. Europe    11. SystemV
      3. Antarctica  6. Asia       9. Indian    12. US
    Geographic area:
    ...
    ERROR: Job failed: execution took longer than 1h0m0s seconds

This is a well known issue [1][2][3].  Probably occurring now because of
a new release of tzdata not included in the base Ubuntu image we are
using.  Fix by telling the underlying dpkg tools this installation is
non-interactive.

[1] Avoiding user interaction with tzdata when installing certbot in a
    docker container
    https://askubuntu.com/questions/909277/avoiding-user-interaction-with-tzdata-when-installing-certbot-in-a-docker-contai
[2] How to install tzdata on a ubuntu docker image?
    https://serverfault.com/questions/949991/how-to-install-tzdata-on-a-ubuntu-docker-image
[3] apt-get install tzdata noninteractive
    https://stackoverflow.com/questions/44331836/apt-get-install-tzdata-noninteractive

Closes !60 - Fix GitLab CI job failures following Ubuntu docker image
             updates
This commit is contained in:
Mike Fleetwood 2020-05-22 15:59:35 +01:00 committed by Curtis Gedak
parent 16170368e7
commit 5fecdbfc96
1 changed files with 1 additions and 0 deletions

View File

@ -23,6 +23,7 @@ stages:
# Use official Ubuntu image https://hub.docker.com/_/ubuntu/.
image: ubuntu:latest
before_script:
- export DEBIAN_FRONTEND=noninteractive
- apt-get update
- apt-get install -y gnome-common yelp-tools libglib2.0-dev-bin
uuid-dev libparted-dev libgtkmm-3.0-dev make