ansible / ansible-builder

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

prepend_builder is not truly prepend #566

Closed j-random-geek closed 1 year ago

j-random-geek commented 1 year ago

Hi

I'm attempting to use ansible-navigator 3.0.0 to build execution environment images in a network where I don't have access to the internet. We have local mirrors for RPMs, for PyPi, and an Automation Hub for a subset of Ansible collections.

What I'm trying to do is use prepend_* to put in place the correct configuration in:

The Containerfile looks mostly good, and the early steps are working. However, this is inserted into the builder stage before my prepend_builder items (i.e. before i can put in my pip.conf) and this breaks the build:

RUN $PYCMD -m pip install --no-cache-dir bindep pyyaml requirements-parser

It comes from lines 131-134 of src/ansible_builder/containerfile.py:

        if image == "base":
            self.steps.append("RUN $PYCMD -m pip install --no-cache-dir bindep pyyaml requirements-parser")

        self._insert_custom_steps('prepend_builder')

Is there any reason we can't insert the prepend_builder steps before the "pip install"?

Thanks!

Richard

Shrews commented 1 year ago

What you are trying to do needs to be done using prepend_base while preparing the Base image. That's the earliest possible step for customization, and the Builder intermediary image is based off of the Base image, so it will use any changes you've defined for it.