Home > Blockchain >  GitHub Action Ansible check ubuntu:focal hangs on setting up tzdata without dialog
GitHub Action Ansible check ubuntu:focal hangs on setting up tzdata without dialog

Time:09-25

I am using this GitHub Action: https://github.com/roles-ansible/check-ansible-ubuntu-focal-action

name: Ansible check ubuntu:focal
on: [push, pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - name: ansible check with ubuntu:focal
      uses: roles-ansible/check-ansible-ubuntu-focal-action@master
      with:
        targets: "local.yml"
        group: "workstations"
        hosts: "localhost"

It hangs and when I cancel the job, I see this in the log:

  Setting up tzdata (2021a-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: The operation was canceled.

So that's a case of a docker container that waits for interactive input to configure tzdata.

How do I resolve this in my own code? The only solution I can think of so far, is to fork the upstream repo of the GitHub Action, and add this line to the Dockerfile before the RUN apt-get commands:

ARG DEBIAN_FRONTEND=noninteractive

But I want to avoid contributing to upstream if I can solve it on my own.

Any ideas?

For reference, this is the current Dockerfile of the upstream repo of the GitHub Action: https://github.com/roles-ansible/check-ansible-ubuntu-focal-action/blob/master/Dockerfile

FROM ubuntu:focal

LABEL "maintainer"="L3D <[email protected]>"
LABEL "repository"="https://github.com/roles-ansible/check-ansible-ubuntu-focal-action.git"
LABEL "homepage"="https://github.com/roles-ansible/check-ansible-ubuntu-focal-action"

LABEL "com.github.actions.name"="check-ansible-ubuntu-focal"
LABEL "com.github.actions.description"="Check ansible role or playbook with Ubuntu focal"
LABEL "com.github.actions.icon"="aperture"
LABEL "com.github.actions.color"="green"

RUN apt-get update -y && apt-get install -y \
    software-properties-common \
    build-essential \
    libffi-dev \
    libssl-dev \
    python3-dev \
    python3-pip \
    git \
    systemd

RUN pip3 install setuptools && pip3 install ansible

RUN ansible --version

ADD ansible-docker.sh /ansible-docker.sh
ENTRYPOINT ["/ansible-docker.sh"]

CodePudding user response:

There is no way to do it in my own code, the change must be done upstream.

I made a pull request: https://github.com/roles-ansible/check-ansible-ubuntu-focal-action/pull/1/files

This is the diff:

@@ -9,6  9,8 @@ LABEL "com.github.actions.description"="Check ansible role or playbook with Ubun
 9   9    LABEL "com.github.actions.icon"="aperture"
10  10    LABEL "com.github.actions.color"="green"
11  11
    12    ARG DEBIAN_FRONTEND=noninteractive
    13   
12  14    RUN apt-get update -y && apt-get install -y \
13  15    software-properties-common \
14  16    build-essential \

Fortunately my PR got approved and merged within only 3 minutes.

CodePudding user response:

You can try to provide the answer for the package. Every answer to package questions is stored in debian 'selection' database. You can see answers for already installed packets with debconf-get-selections, and you can add answers for packages (which are even not installed yet) using debcinf-set-selections.

In this case you may want to configure tzdata to some reasonable value (like UTC timezone).

  • Related