Ansible-builder and galaxy-ng

I get a failure building a Docker image created using ansible-builder create with the error below.

 => ERROR [galaxy 5/5] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install  -r requirements.yml --collections-path "/usr/share/ansible/collections"                                          3.5s
------                                                                                                                                                                                                                  
 > [galaxy 5/5] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install  -r requirements.yml --collections-path "/usr/share/ansible/collections":                                                     
1.970 Starting galaxy collection install process                                                                                                                                                                        
1.971 Process install dependency map                                                                                                                                                                                    
3.417 [WARNING]: Skipping Galaxy server https://galaxy.ansible.com/api/. Got an                                                                                                                                         
3.417 unexpected error when getting available versions of collection arista.eos: '/ap                                                                                                                                   
3.417 i/v3/plugin/ansible/content/published/collections/index/arista/eos/versions/'                                                                                                                                     
3.419 ERROR! Unexpected Exception, this is probably a bug: '/api/v3/plugin/ansible/content/published/collections/index/arista/eos/versions/'                                                                            
3.419 to see the full traceback, use -vvv                                                                                                                                                                               
------
Dockerfile:36
--------------------
  34 |     
  35 |     RUN ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path "/usr/share/ansible/roles"
  36 | >>> 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"
  37 |     
  38 |     # Builder build stage
--------------------
ERROR: failed to solve: process "/bin/sh -c ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install $ANSIBLE_GALAXY_CLI_COLLECTION_OPTS -r requirements.yml --collections-path \"/usr/share/ansible/collections\"" did not complete successfully: exit code: 250

However when I manually edit the Dockerfile, adding the line ENV ANSIBLE_GALAXY_SERVER=https://old-galaxy.ansible.com/ above where ansible-galaxy is used to build in collections & roles, the error does not appear.

I am running this on a Mac with the following

  • ansible-builder v3.0.0 installed with pip
  • ansible-core 2.15.5 installed with brew
  • python 3.11.6

I get the same behaviour if I remove ansible via brew and install ansible-core 2.13.13.

Should I pass an argument to ansible-build create to set the env var in the Dockerfile? Is it even possible to set arbitrary env vars in it?

I’ve found a way around the issue.

additional_build_steps:
  prepend_galaxy:
    - ENV ANSIBLE_GALAXY_SERVER="https://old-galaxy.ansible.com/"
2 Likes

Hi,
I want create a cusstom EE for using specifi collectopons
This is my execution-environment.yml file

---
version: 1

dependencies:
  galaxy: requirements.yml

additional_build_steps:
  prepend_galaxy:
    - ENV ANSIBLE_GALAXY_SERVER="https://old-galaxy.ansible.com/"

but I have an error when i run

ansible-builder build --tag=custom-bdi-awx-ee -t quay.io/ansible/awx-ee --container-runtime=docker --verbosity=3

ansible_builder.exceptions.DefinitionError: Keys (‘prepend_galaxy’,) are not allowed in ‘additional_build_steps’.

What am I doing wrong?

prepend_galaxy is part of the Version 3 format (Execution Environment Definition — Ansible Builder Documentation). Your definition file states its Version 1.

Thanks!
Issue fixed after updating ansible-builder to version 3.0.0

Hello,

Even though they seem related, looks like there are two different topics on the very same thread. @gwmngilfen would you be so kind to double-check if that’s the case and split this one into a separate thread on the get-help category, along with @felixfontein answer? Thanks! :slight_smile:

Hello @iamroddo!

Would you mind to tick the solved check on your own answer, please? This way this thread will appear as solved on the get-help category, so other community members can take advantage of it too. Thanks! :slight_smile:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.