willhallonline / docker-ansible

Ansible inside Docker containers: Alpine, Ubuntu, Rocky & Debian with Ansible 2.16, 2.15, 2.14, 2.13, 2.12, 2.11, 2.10 and 2.9 + Mitogen
https://www.willhallonline.co.uk/project/docker/docker-ansible/
MIT License
376 stars 135 forks source link

Ansible 2.16 unexpectedly in 2.14-alpine-* and 2.15-alpine-* tags #75

Open PhipBlitch-Arcadia opened 6 months ago

PhipBlitch-Arcadia commented 6 months ago

In the 2.14-alpine- and 2.15-alpine- tags, It seems like something is pulling in the 2.16.4 version of ansible-core. pip3 reports the expected version, but the cli tools all report 2.16.4:

% docker run --rm -it willhallonline/ansible:2.14-alpine-3.18 /bin/sh
/ansible # pip3 list | grep ansible
ansible                   7.7.0
ansible-core              2.14.14
/ansible # ansible-playbook --version
ansible-playbook [core 2.16.4]
% docker run --rm -it willhallonline/ansible:2.14-alpine-3.19 /bin/sh
/ansible # pip3 list | grep ansible
ansible                   7.7.0
ansible-core              2.14.14
/ansible # ansible-playbook --version
ansible-playbook [core 2.16.4]

The pattern holds through the 2.15-alpine-* tags as well.

Non-alpine tags appear normal:

% docker run --rm -it willhallonline/ansible:2.14-bookworm-slim /bin/sh
# pip3 list | grep ansible
ansible                   7.7.0
ansible-core              2.14.14
# ansible-playbook --version
ansible-playbook [core 2.14.14]

The 2.13-alpine-* tags also seem fine:

docker run --rm -it willhallonline/ansible:2.13-alpine-3.17 /bin/sh
/ansible # pip3 list | grep ansible
ansible            6.7.0
ansible-core       2.13.13
/ansible # ansible-playbook --version
ansible-playbook [core 2.13.13]
willhallonline commented 6 months ago

This will be some kind of dependency that has come through (from ansible-lint or ansible). This has actually been a consistent issue with managing older versions. I find it incredibly frustrating 😠 . I'll try to work out why it is happening.

PhipBlitch-Arcadia commented 6 months ago

I imagine that would be frustrating indeed! Thank you for building and maintaining this project - it is such a useful tool for bringing an old and neglected ansible project up to date!

PhipBlitch-Arcadia commented 6 months ago

I took another look, and it appears to be happening in the step

pip3 install --ignore-installed ansible-lint==${ANSIBLE_LINT}

which seems like a reasonable consequence of --ignore-installed. However I assume it's there because without it this line blows up on ERROR: Cannot uninstall 'packaging'.

I don't know if this would be sufficient for all the builds, but I was able to get the correct result under alpine:3.16 / 2.14.14 / 7.7.0 by freezing the packages up to that point into a requirements file:

pip3 install -r <(pip3 freeze) ansible-lint=${ANSIBLE_LINT}