我正在使用这个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"
挂起,当我取消作业时,我在日志中看到:
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,并在RUN apt-get
命令之前将这一行添加到Dockerfile
:
ARG DEBIAN_FRONTEND=noninteractive
但如果我能自己解决问题,我想避免对上游做出贡献。
任何想法?
作为参考,这是GitHub Action的上游repo的当前Dockerfile
: 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"]
在我自己的代码中没有办法做到这一点,更改必须在上游完成。
我做了一个拉请求: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分钟内就合并了。
您可以尝试为包提供答案。每个软件包问题的答案都存储在debian的"选择"数据库中。您可以使用debconf-get-selections
查看已经安装的包的答案,并且您可以使用debcinf-set-selections
添加包(甚至尚未安装)的答案。
在这种情况下,您可能希望将tzdata配置为一些合理的值(如UTC时区)。