Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure build steps use non-interactive package installs. #593

Merged
merged 1 commit into from
Apr 23, 2022

Conversation

Alexhuszagh
Copy link
Contributor

Fixes #589. Some libraries, such as tzdata, can ask for user input
during installation, which is problematic when building a Docker image,
since it prevents automatation and stdin i typically not attached. This
has also been an issue upgrading Docker images to the latest Ubuntu
versions.

Fixes cross-rs#589. Some libraries, such as `tzdata`, can ask for user input
during installation, which is problematic when building a Docker image,
since it prevents automatation and stdin i typically not attached. This
has also been an issue upgrading Docker images to the latest Ubuntu
versions.
@reitermarkus
Copy link
Member

Does it make sense to set this in lib.sh instead?

@Alexhuszagh
Copy link
Contributor Author

Alexhuszagh commented Mar 20, 2022

Does it make sense to set this in lib.sh instead?

That should work, I'll redo this PR then. Seems like a much "drier" approach. One of the issues though is it's not only the command install_packages that installs packages. Other scripts do too, such as:

  • android-ndk.sh
  • android-system.sh

And a lot of the Dockerfiles, such as Dockerfile.i686-pc-windows-gnu, Dockerfile.asmjs-unknown-emscripten, and Dockerfile.aarch64-unknown-linux-gnu, do as well. Just for resilience reasons, it would be good to ensure they're all using non-interactive prompts. RPM packages never ask for user input with -y, so at least we only have to worry about Ubuntu-based Docker images here.

So I'm not sure what the best solution is here.

@Alexhuszagh
Copy link
Contributor Author

Currently, merely updating install_packages to use DEBIAN_FRONTEND=noninteractive is insufficient. I've attempted the following patch, but this causes other steps to fail:

--- a/docker/lib.sh
+++ b/docker/lib.sh
@@ -6,7 +6,8 @@ install_packages() {
 
         for pkg in "${@}"; do
             if ! dpkg -L "${pkg}" >/dev/null 2>/dev/null; then
-                apt-get install --assume-yes --no-install-recommends "${pkg}"
+                DEBIAN_FRONTEND=noninteractive apt-get install --assume-yes \
+                    --no-install-recommends "${pkg}"
 
                 purge_list+=( "${pkg}" )
             fi

Here, we have the failing step of Dockerfile.armv5te-unknown-linux-gnueabi, which produces the tzdata error above.

RUN apt-get update && apt-get install --assume-yes --no-install-recommends \
    g++-arm-linux-gnueabi \
    crossbuild-essential-armel \
    libc6-dev-armel-cross && \
    /qemu.sh arm

We could export this only in Dockerfiles that currently require non-interactive tzdata, but this seems to be a fragile solution. The currently affected Dockerfiles are:

  • armv5te-unknown-linux-gnueabi
  • i686-pc-windows-gnu

Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r+

bors bot added a commit that referenced this pull request Apr 19, 2022
593: Ensure build steps use non-interactive package installs. r=Emilgardis a=Alexhuszagh

Fixes #589. Some libraries, such as `tzdata`, can ask for user input
during installation, which is problematic when building a Docker image,
since it prevents automatation and stdin i typically not attached. This
has also been an issue upgrading Docker images to the latest Ubuntu
versions.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
@bors
Copy link
Contributor

bors bot commented Apr 19, 2022

Build failed:

@Emilgardis
Copy link
Member

oh yeah, need someone else to r+ #690

@Emilgardis
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Apr 22, 2022
593: Ensure build steps use non-interactive package installs. r=Emilgardis a=Alexhuszagh

Fixes #589. Some libraries, such as `tzdata`, can ask for user input
during installation, which is problematic when building a Docker image,
since it prevents automatation and stdin i typically not attached. This
has also been an issue upgrading Docker images to the latest Ubuntu
versions.

688: Bump `cmake` to version `3.23.1` r=Emilgardis a=Jules-Bertholet



Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
Co-authored-by: Jules Bertholet <jules.bertholet@gmail.com>
@bors
Copy link
Contributor

bors bot commented Apr 22, 2022

Build failed (retrying...):

bors bot added a commit that referenced this pull request Apr 22, 2022
593: Ensure build steps use non-interactive package installs. r=Emilgardis a=Alexhuszagh

Fixes #589. Some libraries, such as `tzdata`, can ask for user input
during installation, which is problematic when building a Docker image,
since it prevents automatation and stdin i typically not attached. This
has also been an issue upgrading Docker images to the latest Ubuntu
versions.

Co-authored-by: Alex Huszagh <ahuszagh@gmail.com>
@Emilgardis
Copy link
Member

bors cancel

#695

@bors
Copy link
Contributor

bors bot commented Apr 22, 2022

Canceled.

@Emilgardis
Copy link
Member

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 23, 2022

Build succeeded:

@bors bors bot merged commit 89e88a3 into cross-rs:main Apr 23, 2022
@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure DEBIAN_FRONTEND=noninteractive is set during image builds
3 participants