ansible / ansible-builder

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

Error when building an EE without requirements.yml #641

Closed NotAFile closed 2 months ago

NotAFile commented 8 months ago

The behaviour of #290 appears to have returned again:

execution-image.yml

---
version: 3

images:
  base_image:
    name: quay.io/centos/centos:stream9

dependencies:
    ansible_core:
        package_pip: ansible-core==2.15.0
    ansible_runner:
        package_pip: ansible-runner==2.3.2
    galaxy: requirements.yml

additional_build_files:
    - src: files/ansible.cfg
      dest: configs

additional_build_steps:
    prepend_final:
        - COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg

options:
    package_manager_path: /usr/bin/microdnf

requirements.yml

---
collections: []

Error:

Error: building at STEP "COPY _build/configs/ansible.cfg /etc/ansible/ansible.cfg": checking on sources under [...] copier: stat: "/_build/configs/ansible.cfg": no such file or directory
Akasurde commented 8 months ago

@NotAFile Thanks for reporting this issue. I can reproduce this error when requirements.yml file is without any requirements.

Shrews commented 2 months ago

The error message in the original description is incorrect. Correct error being produced is:

[3/4] STEP 11/13: COPY --from=galaxy /usr/share/ansible /usr/share/ansible
Error: building at STEP "COPY --from=galaxy /usr/share/ansible /usr/share/ansible": checking on sources under "/var/lib/containers/storage/overlay/55a1a8f1f359696d8dedc18b4bae914608e3504b7743ac031230f0b831480f61/merged": copier: stat: "/usr/share/ansible": no such file or directory

Doesn't seem that it has reappeared since I tested with both devel branch and version 3.0 and the error is in both.

Not sure how to deal with this quite yet since we don't parse the Galaxy file (simply pass it along to ansible-galaxy) and there is otherwise no indicator that anything was actually installed (thus producing the /usr/share/ansible directory). It might be best to simply create this as an empty directory up front, then the COPY command should not fail.