ansible / ansible-builder

An Ansible execution environment builder
Other
289 stars 93 forks source link

rockylinux 9 base image: no dnf? 🤔 #629

Closed Sispheor closed 10 months ago

Sispheor commented 10 months ago

Hello there 👋

I'm on the last step of my build ✊

I'm using rockylinux:9 as base image. And I have this error during the final step

#27 3.233 + /usr/bin/dnf install -y gcc gcc-c++ libffi-devel openldap-devel openssl-devel python3-devel python3-libselinux python3-libsemanage
#27 3.245 Traceback (most recent call last):
#27 3.245   File "/usr/bin/dnf", line 61, in <module>
#27 3.245     from dnf.cli import main
#27 3.245 ModuleNotFoundError: No module named 'dnf'
#27 ERROR: process "/bin/sh -c /output/scripts/assemble" did not complete successfully: exit code: 1
------
 > [builder 7/7] RUN /output/scripts/assemble:
3.233 openldap-devel
3.233 openssl-devel
3.233 python3-devel
3.233 python3-libselinux
3.233 python3-libsemanage' ']'
3.233 + /usr/bin/dnf install -y gcc gcc-c++ libffi-devel openldap-devel openssl-devel python3-devel python3-libselinux python3-libsemanage
3.245 Traceback (most recent call last):
3.245   File "/usr/bin/dnf", line 61, in <module>
3.245     from dnf.cli import main
3.245 ModuleNotFoundError: No module named 'dnf'
------
Dockerfile:72
--------------------
  70 |     COPY _build/bindep.txt bindep.txt
  71 |     RUN $PYCMD /output/scripts/introspect.py introspect --sanitize --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
  72 | >>> RUN /output/scripts/assemble
  73 |     
  74 |     # Final build stage
--------------------
ERROR: failed to solve: process "/bin/sh -c /output/scripts/assemble" did not complete successfully: exit code: 1

I checked, dnf is well present in this image

docker run -it --rm quay.io/rockylinux/rockylinux:9 dnf --version
4.14.0
  Installed: dnf-0:4.14.0-5.el9_2.noarch at Sat May 13 20:19:12 2023
  Built    : Rocky Linux Build System (Peridot) <releng@rockylinux.org> at Tue May  9 07:56:10 2023

  Installed: rpm-0:4.16.1.3-22.el9.x86_64 at Sat May 13 20:19:10 2023
  Built    : Rocky Linux Build System (Peridot) <releng@rockylinux.org> at Sat Apr 22 00:46:07 2023

Thank for your help !

Shrews commented 10 months ago

This isn't really a bug with ansible-builder, but rather with the process you have created. We don't generally handle issues that aren't directly related to a bug with builder, but in this case, based on your previous issue (https://github.com/ansible/ansible-builder/issues/628), you are asking builder to install and use python 3.11 for all future commands, but immediately switching the python alternative to python 3.10 in your append_base section. This is inviting disaster.

Shrews commented 10 months ago

As an FYI, it can be helpful to interact with the Ansible community at https://forum.ansible.com/ if you are having issues building your execution environment.

Sispheor commented 10 months ago

Yep you are right. It's totally related to the fact I tried to change the version of Python. And actually I don't need it. I just removed the python version override from my config and my build is now ok.

Thanks for you quick support anyway !