ansible / ansible-navigator

A text-based user interface (TUI) for Ansible.
https://ansible.readthedocs.io/projects/navigator/
Apache License 2.0
374 stars 99 forks source link

Image inspection fails in actions workflow #1642

Open cloin opened 9 months ago

cloin commented 9 months ago
ISSUE TYPE
SUMMARY

I am using github actions to build images and want to use ansible-navigator images to create a build artifact. When I try to do this, I get an error:

Image introspection failed, please check the logs and log an issue. 
Error: Process completed with exit code 1.
ANSIBLE-NAVIGATOR VERSION
ansible-navigator 3.5.0
CONFIGURATION

No valid settings file found, using all default values for settings.

I'm using a github actions workflow to successfully build the images and I'm using the following step to try to inspect the built images:

      - name: test ansible-navigator command
        run: |
          ansible-navigator --version
          podman images
          ansible-navigator images -m stdout
          ansible-navigator images localhost/${{ env.EE }}:${{ github.sha }} -d ansible_collections -m stdout --ll debug --ee false

podman images:

 REPOSITORY                                                          TAG                                       IMAGE ID      CREATED             SIZE
localhost/base-de                                                   pr-57-f8fd330                             6af975125f84  3 seconds ago       786 MB
localhost/base-de                                                   f8fd330d74ef744730f2f73ba904a6a552c18ff6  6af975125f84  3 seconds ago       786 MB

tail end of log file:

2023-11-29T18:04:52.272557+00:00 DEBUG 'ansible_navigator.runner.base.generate_run_command_args' Runner arg: cmdline_args:['/home/runner/.cache/ansible-navigator/image_introspect.py']
2023-11-29T18:04:52.273584+00:00 DEBUG 'ansible-runner._handle_command_wrap' containerization enabled
2023-11-29T18:04:52.273835+00:00 DEBUG 'ansible-runner.wrap_args_for_containerization' container engine invocation: podman run --rm --tty --interactive --workdir /runner/project -v /etc/ssh/:/etc/ssh/ --group-add=root --ipc=host -v /tmp/ansible-navigator__4dxq8t4/artifacts/:/runner/artifacts/:Z -v /tmp/ansible-navigator__4dxq8t4/:/runner/:Z -v /home/runner/.cache/ansible-navigator/:/home/runner/.cache/ansible-navigator/ --env-file /tmp/ansible-navigator__4dxq8t4/artifacts/7c140b66-c952-4ae4-8e5c-e7e721cb6b44/env.list --quiet --name ansible_runner_7c140b66-c952-4ae4-8e5c-e7e721cb6b44 --user=root ghcr.io/ansible/creator-ee:v0.20.0 /usr/bin/python3 /home/runner/.cache/ansible-navigator/image_introspect.py
2023-11-29T18:04:52.273877+00:00 DEBUG 'ansible-runner._handle_command_wrap' command: podman run --rm --tty --interactive --workdir /runner/project -v /etc/ssh/:/etc/ssh/ --group-add=root --ipc=host -v /tmp/ansible-navigator__4dxq8t4/artifacts/:/runner/artifacts/:Z -v /tmp/ansible-navigator__4dxq8t4/:/runner/:Z -v /home/runner/.cache/ansible-navigator/:/home/runner/.cache/ansible-navigator/ --env-file /tmp/ansible-navigator__4dxq8t4/artifacts/7c140b66-c952-4ae4-8e5c-e7e721cb6b44/env.list --quiet --name ansible_runner_7c140b66-c952-4ae4-8e5c-e7e721cb6b44 --user=root ghcr.io/ansible/creator-ee:v0.20.0 /usr/bin/python3 /home/runner/.cache/ansible-navigator/image_introspect.py
2023-11-29T18:05:10.450010+00:00 ERROR 'ansible_navigator.actions.images._parse' Unable to extract introspection from stdout
2023-11-29T18:05:10.450189+00:00 DEBUG 'ansible_navigator.actions.images._parse' error json loading output: 'not enough values to unpack (expected 2, got 1)'
2023-11-29T18:05:10.450249+00:00 DEBUG 'ansible_navigator.actions.images._parse' 
2023-11-29T18:05:10.450286+00:00 ERROR 'ansible_navigator.actions.images._parse' Image introspection failed (parsed), the return value was: 
2023-11-29T18:05:10.459746+00:00 DEBUG 'ansible_navigator.runner.base.__del__' delete temporary ansible-runner private_data_dir at path /tmp/ansible-navigator__4dxq8t4
LOG FILE

ansible-navigator.log: https://gist.github.com/cloin/25d534f57f6261a8656c6663ba500b17 github action step output: https://gist.github.com/cloin/1e21b21aee3f903816ebcb912915766d

STEPS TO REPRODUCE

Build definitions for this EE, base-de, available here: https://github.com/cloin/ee-builds/tree/main/base-de

Also occurs with other EE buids. I haven't gotten any to work yet.

cloin commented 9 months ago

As an alternative, I'm just using podman commands:

podman run -it ${{ env.EE }}:${{ env.IMAGE_TAG }} ansible --version  >> $COMMANDS_FILE
podman run -it ${{ env.EE }}:${{ env.IMAGE_TAG }} ansible-galaxy collection list  >> $COMMANDS_FILE
Qalthos commented 9 months ago

Have you tried building the image directly with ansible-builder instead? This seems like it is likely to be an issue in builder and not navigator's wrapping of it.