1

我正在使用这个 GitHub 操作: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"

它挂起,当我取消作业时,我在日志中看到:

  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.

这是一个等待交互式输入配置的 docker 容器的情况tzdata

如何在我自己的代码中解决这个问题?到目前为止,我能想到的唯一解决方案是 fork GitHub Action 的上游 repo,并将这一行添加到命令Dockerfile之前RUN apt-get

ARG DEBIAN_FRONTEND=noninteractive

但如果我能自己解决,我想避免为上游做出贡献。

有任何想法吗?

作为参考,这是DockerfileGitHub Action 的上游 repo 的当前:https ://github.com/roles-ansible/check-ansible-ubuntu-focal-action/blob/master/Dockerfile

FROM ubuntu:focal

LABEL "maintainer"="L3D <l3d@c3woc.de>"
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"]
4

2 回答 2

0

在我自己的代码中没有办法做到这一点,必须在上游完成更改。

我提出了一个拉取请求:https ://github.com/roles-ansible/check-ansible-ubuntu-focal-action/pull/1/files

这是差异:

@@ -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 \

幸运的是,我的 PR 在 3 分钟内就获得了批准合并。

于 2021-09-25T00:13:41.890 回答
-1

您可以尝试为包裹提供答案。软件包问题的每个答案都存储在 debian 的“选择”数据库中。您可以使用 来查看已安装数据包的答案debconf-get-selections,并且可以使用 为软件包(甚至尚未安装)添加答案debcinf-set-selections

在这种情况下,您可能希望将 tzdata 配置为某个合理的值(如 UTC 时区)。

于 2021-09-24T20:20:27.197 回答