dell / ansible-powerflex

Ansible Modules for Dell PowerFlex
Other
22 stars 15 forks source link

[BUG]: collection prevents Ansible builder from building EE #17

Closed tperrindell closed 1 year ago

tperrindell commented 2 years ago

Describe the bug If we try to include dellemc.powerflex in requirements.yml of EE, build fails

To Reproduce Steps to reproduce the behavior:

  1. Create requirements.txt including PyPowerFlex
  2. Create requirements.yml including dellemc.powerflex
  3. Try to build using ansible-builder Error:
Downloading https://galaxy.ansible.com/download/dellemc-powerflex-1.3.0.tar.gz to /home/runner/.ansible/tmp/ansible-local-1eq3rm21y/tmphd6d48af/dellemc-powerflex-1.3.0-qzzstdjv
Installing 'dellemc.powerflex:1.3.0' to '/usr/share/ansible/collections/ansible_collections/dellemc/powerflex'
dellemc.powerflex:1.3.0 was installed successfully
Downloading https://galaxy.ansible.com/download/community-general-5.5.0.tar.gz to /home/runner/.ansible/tmp/ansible-local-1eq3rm21y/tmphd6d48af/community-general-5.5.0-8o16y5vt
Installing 'community.general:5.5.0' to '/usr/share/ansible/collections/ansible_collections/community/general'
community.general:5.5.0 was installed successfully
--> 54bfe3e6f75
[2/3] STEP 1/6: FROM quay.io/ansible/ansible-builder:latest AS builder
[2/3] STEP 2/6: COPY --from=galaxy /usr/share/ansible /usr/share/ansible
--> 762ecbf34da
[2/3] STEP 3/6: ADD _build/requirements.txt requirements.txt
--> 00f83135644
[2/3] STEP 4/6: ADD _build/bindep.txt bindep.txt
--> b6045fce69b
[2/3] STEP 5/6: RUN ansible-builder introspect --sanitize --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
FileNotFoundError: [Errno 2] No such file or directory: '/usr/share/ansible/collections/ansible_collections/dellemc/powerflex/../requirements.txt'
Expected requirements file not present at: /usr/share/ansible/collections/ansible_collections/dellemc/requirements.txt
Error: error building at STEP "RUN ansible-builder introspect --sanitize --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt": error while running runtime: exit status 1

An error occured (rc=1), see output line(s) above for details.

Expected behavior the EE should build

Logs See above

System Information (please complete the following information):

Additional context It seems that the issue relies in the ../requirements.txt which tries to go up one level in the build. File : meta/execution-environment.yml :

[root@ansible-core collections]# cat meta/execution-environment.yml
---
version: 1
dependencies:
  galaxy: ../requirements.yml #Absolute/relative path of requirements.yml
  python: ../requirements.txt #Absolute/relative path of requirements.txt

Except that this tries to bring the build up to the level above.

anupamaloke commented 2 years ago

@tperrindell, this is a known issue and will be fixed as part of v1.4.0 which is going to be released in end of Sep. Meanwhile, please edit the meta/execution-environment.yml and make following changes:

---
version: 1
dependencies:
  galaxy: requirements.yml
  python: requirements.txt 
tperrindell commented 2 years ago

Hello Anupam !

Thanks for that, trying without the ../

Can you elaborate on why there is a requirements.yml containing dellemc.powerflex?

Isn't that a circular requirement?

Thanks

Jennifer-John commented 2 years ago

Hi @tperrindell,

To build an execution environment, the execution-environment.yml should be at the root of the collection. It cannot be built from the meta folder. The file in the meta folder is to verify python dependencies of the collection. We are working on the fix to update the file location without the ../

The docker image can be built using the ansible-builder command which will have the installed collection from galaxy which is mentioned in the requirements.yml and the dependencies from the requirements.txt. The outlined steps in readme mention about building image using docker.

Please do let me know if this clarifies your question?

Thanks, Jennifer.

Jennifer-John commented 1 year ago

Fixed as part of #18