I was struggling for a while to get my custom EE built with ansible-builder v3.0.0, until I noticed that I was using an example from the official AAP 4.4 docs that is not working for me at all:
---
version: 3
build_arg_defaults:
ANSIBLE_GALAXY_CLI_COLLECTION_OPTS: '--pre'
dependencies:
galaxy: requirements.yml
python:
- six
- psutil
system: bindep.txt
images:
base_image:
name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest
additional_build_files:
- src: files/ansible.cfg
dest: configs
additional_build_steps:
prepend_galaxy:
- ADD _build/configs/ansible.cfg ~/.ansible.cfg
prepend_final: |
RUN whoami
RUN cat /etc/os-release
append_final:
- RUN echo This is a post-install command!
- RUN ls -la /etc
But this way, ansible-builder did not find the ~/.ansible.cfg file on the EE image during the build, so it ended up switching to /etc/ansible.cfg (which obviously had not any of my customizations):
---> Running in 616ee7feb423
Using /etc/ansible.cfg as config file
Starting galaxy collection install process
Process install dependency map
ERROR! Failed to resolve the requested dependencies map. Could not satisfy the following requirements:
Finally, I fixed it by replacing ~./ansible.cfg with /home/runner/.ansible.cfg on the execution_environment.yml, like this:
---> Running in b52ce6947398
Using /home/runner/.ansible.cfg as config file
Starting galaxy collection install process
Process install dependency map
Starting collection install process
Now that I got my EE built & running, and before I blame the documentation for the struggle… Does anyone know if relative paths should be working when used on the execution_environment.yml file, or it’s just that the guide has this little -yet annoying- flaw, and instead of relative paths we should be using always absolute paths?
Thanks for researching further on this matter @samccann , I’ll take a closer look on the provided links myself. In the meantime let’s see what they say
Specifies the source file(s) to copy into the build context directory.
This may either be an absolute path (e.g., /home/user/.ansible.cfg),
or a path that is relative to the execution environment file.
Relative paths may be a glob expression matching one
or more files (e.g. files/*.cfg). Note that an absolute path
may not include a regular expression.
If src is a directory, the entire contents of that directory are
copied to dest.
Wow that was efficient to say the least! Now I believe I could have dig further into the issue myself, so you hadn’t to do all the research. I’ll try to get more familiarised with all the docs & stuff regarding EE’s from now on… Anyway, thanks for your answers! I’m happy I could lend a hand also
I’ve just submitted a PR against the controller doc to replace its definition related content with a reference to the same Builder doc. If someone already did it, sorry. @samccann could you please take a look? The replaced content is just a copy-paste of the Builder’s one.
Does anyone want to implement that easy fix issue Sandra created?