ansible / ansible-builder

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

find/use git, it is required to continue with installing #628

Closed Sispheor closed 10 months ago

Sispheor commented 10 months ago

Hi,

The install is complaining about Git not installed. Seems that system packages are installed AFTER galaxy libs. And so git is not yet present. Should I add it in prepend step? The dependencies should be a list so it can be executed with a defined order.

Here is my error:

#19 [galaxy 4/5] RUN ansible-galaxy role install  -r requirements.yml --roles-path "/usr/share/ansible/roles"
#19 0.682 [WARNING]: - ruzickap.proxy_settings was NOT installed successfully: could not
#19 0.682 find/use git, it is required to continue with installing
#19 0.682 https://github.com/ruzickap/ansible-role-proxy_settings.git
#19 0.683 ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
#19 0.683 Starting galaxy role install process
#19 ERROR: process "/bin/sh -c ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path \"/usr/share/ansible/roles\"" did not complete successfully: exit code: 1
------
 > [galaxy 4/5] RUN ansible-galaxy role install  -r requirements.yml --roles-path "/usr/share/ansible/roles":
0.682 [WARNING]: - ruzickap.proxy_settings was NOT installed successfully: could not
0.682 find/use git, it is required to continue with installing
0.682 https://github.com/ruzickap/ansible-role-proxy_settings.git
0.683 ERROR! - you can use --ignore-errors to skip failed roles and finish processing the list.
0.683 Starting galaxy role install process
------
Dockerfile:45
--------------------
  43 |     WORKDIR /build
  44 |     
  45 | >>> RUN ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path "/usr/share/ansible/roles"
  46 |     RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path "/usr/share/ansible/collections"
  47 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path \"/usr/share/ansible/roles\"" did not complete successfully: exit code: 1

My conf:

version: 3
images:
  base_image:
    name: quay.io/rockylinux/rockylinux:9
dependencies:
  python_interpreter:
    package_system: python3.11
    python_path: /usr/bin/python3.11
  ansible_core:
    package_pip: ansible-core~=2.15
  ansible_runner:
    package_pip: ansible-runner~=2.3
  system: bindep.txt
  python: requirements.txt
  galaxy: requirements.yml

additional_build_files:
  - src: ansible.cfg
    dest: configs

additional_build_steps:

  append_base:
    - RUN alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 0
    - RUN cat /etc/os-release

bindep.txt:

# The gcc compiler
gcc

# Base requirements for RPM distros
gcc-c++           [platform:rpm]
git               [platform:rpm]
libffi-devel      [platform:rpm]
openssl-devel     [platform:rpm]
python3-devel     [platform:rpm]
python38-devel     [platform:rpm]
openldap-devel     [platform:rpm]

# For SELinux
python3-libselinux  [platform:redhat]
python3-libsemanage [platform:redhat]

# Required for compressing collected log files in CI
gzip

Thanks for you support !

Sispheor commented 10 months ago

Workaround:

additional_build_steps:
  prepend_base: |
    RUN dnf install -y git
Shrews commented 10 months ago

The system dependencies are installed in the final image. So yes, you will need to install git in either a prepend_base or prepend_galaxy step, as in your workaround.

Sispheor commented 10 months ago

Roger that. Thanks !