Closed Peter1295 closed 1 week ago
It doesn't look like the verbose output you are providing matches the execution-environment.yml
file you reference in the GithHub gist from CaptainStealthy (https://gist.github.com/CaptainStealthy/6c54a5ed3ba66e9d7ee87481e4e178c2#file-execution-environment-yml). The output seems to indicate you are using a version 1 format of the EE, not version 3, which is what the example in the gist is using (see the first line from that example EE that indicates the version).
Maybe provide the actual EE you are using for further evaluation.
I stumbled upon your question looking for a similar answer. I eventually found my way through it.
Two things got me through this. As @Shrews mentioned, try building using a the format supported by the new ansible-builder 3.1.0: (correct the YAML spacing - code does not format nicely) `--- version: 3 images: base_image: name: registry.redhat.io/ansible-automation-platform-24/ee-minimal-rhel8:latest
dependencies: galaxy: requirements.yml
options: package_manager_path: /usr/bin/microdnf
` Take heed to the options - It may trip you up on the base image later.
2) Be careful when not building outside of a python venv.
Sorry for a late reply, I was able to create custom EE by changing to version 3. Dummy mistakes by lack of knowledge.
Thank you for a support @Shrews
Hello, I am trying to build custom EE with added dependencies and 1 collection, but it gives me an error _"can't open file '/output/scripts/introspect.py': [Errno 2] No such file or directory" even it exist. As I am not experienced into building EE, I have used this manual https://gist.github.com/CaptainStealthy/6c54a5ed3ba66e9d7ee87481e4e178c2 as reference.
Environment:
Ubuntu 22.04.2 LTS running on WSL
Docker version: 27.1.2
Ansible-builder version: 3.1.0
Python version: 3.10.12
Log output:
root@PXP-PF2CBB7S:/home/plaurencik/custom-ee/KSM# ansible-builder build --container-runtime=docker --verbosity=3 -f execution-environment.yml Found version 1, consider upgrading to version 3 or above Ansible Builder is generating your execution environment build context. File context/_build/requirements.yml is already up-to-date. File context/_build/requirements.txt is already up-to-date. File context/_build/bindep.txt is already up-to-date. File context/_build/scripts/assemble is already up-to-date. File context/_build/scripts/install-from-bindep is already up-to-date. File context/_build/scripts/introspect.py is already up-to-date. File context/_build/scripts/check_galaxy is already up-to-date. File context/_build/scripts/check_ansible is already up-to-date. File context/_build/scripts/pip_install is already up-to-date. File context/_build/scripts/entrypoint is already up-to-date. Ansible Builder is building your execution environment image. Tags: ansible-execution-env:latest Running command: docker build -f context/Dockerfile -t ansible-execution-env:latest context
0 building with "default" instance using docker driver
1 [internal] load build definition from Dockerfile
1 transferring dockerfile: 2.36kB done
1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 9)
1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 23)
1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 40)
1 WARN: FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 61)
1 DONE 0.0s
2 [internal] load metadata for quay.io/ansible/ansible-runner:latest
2 ...
3 [internal] load metadata for quay.io/ansible/ansible-builder:latest
3 DONE 10.6s
2 [internal] load metadata for quay.io/ansible/ansible-runner:latest
2 DONE 10.6s
4 [internal] load .dockerignore
4 transferring context: 2B done
4 DONE 0.0s
5 [builder 1/9] FROM quay.io/ansible/ansible-builder:latest@sha256:75c4e4b5be6aab3386381b1e202ad382002f6830fd4b524bcd5ddc718e4f6a89
5 DONE 0.0s
6 [base 1/3] FROM quay.io/ansible/ansible-runner:latest@sha256:001a4bde411be863d54c1d293f3d2e7b0ff0e67ef5d7b2f9f7fb56b61694f4e8
6 DONE 0.0s
7 [internal] load build context
7 transferring context: 18.21kB done
7 DONE 0.0s
8 [base 2/3] COPY _build/scripts/ /output/scripts/
8 CACHED
9 [base 3/3] COPY _build/scripts/entrypoint /opt/builder/bin/entrypoint
9 CACHED
10 [galaxy 1/6] RUN /output/scripts/check_galaxy
10 CACHED
11 [galaxy 2/6] COPY _build /build
11 DONE 0.1s
12 [galaxy 3/6] WORKDIR /build
12 DONE 0.1s
13 [galaxy 4/6] RUN mkdir -p /usr/share/ansible
13 DONE 0.4s
14 [galaxy 5/6] RUN ansible-galaxy role install -r requirements.yml --roles-path "/usr/share/ansible/roles"
14 1.084 Skipping install, no requirements found
14 DONE 1.2s
15 [galaxy 6/6] RUN ANSIBLE_GALAXY_DISABLE_GPG_VERIFY=1 ansible-galaxy collection install -r requirements.yml --collections-path "/usr/share/ansible/collections"
15 0.842 Starting galaxy collection install process
15 0.842 Process install dependency map
15 37.82 Starting collection install process
15 37.82 Downloading https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/keepersecurity-keeper_secrets_manager-1.2.3.tar.gz to /home/runner/.ansible/tmp/ansible-local-1xm_im6gs/tmpy2560fko/keepersecurity-keeper_secrets_manager-1.2.3-jflsu0sm
15 54.49 Installing 'keepersecurity.keeper_secrets_manager:1.2.3' to '/usr/share/ansible/collections/ansible_collections/keepersecurity/keeper_secrets_manager'
15 54.51 keepersecurity.keeper_secrets_manager:1.2.3 was installed successfully
15 DONE 54.6s
16 [builder 4/9] RUN /output/scripts/pip_install /usr/bin/python3
16 CACHED
17 [builder 6/9] COPY _build/requirements.txt requirements.txt
17 CACHED
18 [builder 2/9] WORKDIR /build
18 CACHED
19 [builder 3/9] COPY _build/scripts/pip_install /output/scripts/pip_install
19 CACHED
20 [builder 5/9] COPY --from=galaxy /usr/share/ansible /usr/share/ansible
20 CACHED
21 [builder 7/9] COPY _build/bindep.txt bindep.txt
21 CACHED
22 [builder 8/9] RUN /usr/bin/python3 /output/scripts/introspect.py introspect --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
22 ...
23 [final 1/4] COPY --from=galaxy /usr/share/ansible /usr/share/ansible
23 CACHED
22 [builder 8/9] RUN /usr/bin/python3 /output/scripts/introspect.py introspect --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt
22 0.391 /usr/bin/python3: can't open file '/output/scripts/introspect.py': [Errno 2] No such file or directory
22 ERROR: process "/bin/sh -c $PYCMD /output/scripts/introspect.py introspect --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt" did not complete successfully: exit code: 2
Dockerfile:57
55 | COPY _build/requirements.txt requirements.txt 56 | COPY _build/bindep.txt bindep.txt 57 | >>> RUN $PYCMD /output/scripts/introspect.py introspect --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt 58 | RUN /output/scripts/assemble 59 |
ERROR: failed to solve: process "/bin/sh -c $PYCMD /output/scripts/introspect.py introspect --user-pip=requirements.txt --user-bindep=bindep.txt --write-bindep=/tmp/src/bindep.txt --write-pip=/tmp/src/requirements.txt" did not complete successfully: exit code: 2