Post
I am having some trouble trying to utilize a local/custom(non-galaxy) collection with ansible-builder. I’ve had no problem using ansible-builder until I started looking at packing in some newer collections we’ve developed internally.
The following requirements file is what I am currently trying to use. There are examples of https and git(ssh) methods for installing the collection in question. This requirements file has no problem working on the ansible-galaxy command line via ansible-galaxy install -r requirements.yaml
or ansible-galaxy collection install -r requirements.yaml
My requirements.yaml
file
---
roles:
collections:
- ansible.posix
- ansible.utils
- community.general
- community.docker
- community.network
# This works with ansible galaxy
#- name: git@gitlab.flyingtoaster.dev:ansible_collections/flyingtoaster.docker.git
# type: git
# version: develop
# This works with ansible galaxy
- name: https://gitlab.flyingtoaster.dev/ansible_collections/flyingtoaster.docker.git
type: git
version: develop
...
ansible-builder build
command output:
Running command:
docker build -f context/Dockerfile -t toast/flyingtoaster-ee context
...showing last 20 lines of output...
#17 [galaxy 5/5] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install --pre -r requirements.yml --collections-path "/usr/share/ansible/collections"
#17 12.36 ERROR! Could not find git executable to extract the collection from the Git repository `https://gitlab.flyingtoaster.dev/ansible_collections/flyingtoaster.docker.git`.
#17 12.36 Starting galaxy collection install process
#17 12.36 Process install dependency map
#17 ERROR: 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: 1
------
> [galaxy 5/5] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install --pre -r requirements.yml --collections-path "/usr/share/ansible/collections":
12.36 ERROR! Could not find git executable to extract the collection from the Git repository `https://gitlab.flyingtoaster.dev/ansible_collections/flyingtoaster.docker.git`.
12.36 Starting galaxy collection install process
12.36 Process install dependency map
------
Dockerfile:43
--------------------
41 |
42 | RUN ansible-galaxy role install $ANSIBLE_GALAXY_CLI_ROLE_OPTS -r requirements.yml --roles-path "/usr/share/ansible/roles"
43 | >>> 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"
44 |
45 | # 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: 1
An error occurred (rc=1), see output line(s) above for details.
I’ve struggled to find any documentation around using custom scm/git repos in the requirements file specifically for ansible-builder. However seeing as this works just fine with the ansible-galaxy command line as documented, I struggle to understand where the hangup is. Also to be clear, the ansible-builder
command works as expected without any error when the internal git/scm item is removed from/commented out in the requirements file.
I greatly appreciate any assistance or pointing in the right direction that anyone can provide.
Thank you!