aws-ia/taskcat

New Apline container build runs with Python 3.10, throws "AttributeError module 'collections' has no attribute 'Mapping'"

ShahradR opened this issue · 4 comments

Hello taskcat team!

I saw that the Docker image was recently updated and rebuilt, using python:3-alpine as the base image. Unfortunately, it looks like the latest Python container runs using Python 3.10, which might have broken a few things—specifically, Python 3.10 removes the Mappings class from the collections package, as highlighted in #714, and commands like test run now throw [ERROR ] : AttributeError module 'collections' has no attribute 'Mapping' when invoked from the container.

One fix might be to update the Dockerfile's parent image and pin the version to a specific release of Python and Alpine—I've updated the taskcat GitHub Action to use the python:3.8.13-alpine3.15 image to get people's pipelines working again, and it seems to be doing the trick!

To reproduce

Steps to reproduce the behavior:

  1. Pull the latest taskcat Docker image by running docker pull taskcat/taskcat:latest
  2. Run taskcat test run against the Docker container by running the command in the section below
  3. Notice that taskcat throws [ERROR ] : AttributeError module 'collections' has no attribute 'Mapping'

Command to invoke the Docker container

The following command was used to run taskcat in the Docker container. The mount path points to a test directory in the action-taskcat project, which contains a CloudFormation template that never creates any resources.

docker run \
  -it \
  --mount type=bind,source=/home/shahradr/action-taskcat/e2e/resources/default/,target=/mnt \
  --entrypoint taskcat \
  taskcat/taskcat:latest \
  test run

Questions regarding the system under test

Questions Answers
1. Are you testing a QuickStart or Custom template? Custom template
2. Attach or link a copy of the template if possible (remove any sensitive info) See example template
3. Provide the parameters that you passed. (remove any sensitive info) test run
4. How did you install taskcat? (docker or pip3) Docker
5. Are you using a profile, an instance role or access keys to run taskcat? Access keys
6. Is your AWS environment configured via aws configure? No

Expected behavior

taskcat should execute the test run command successfully, without throwing [ERROR ] : AttributeError module 'collections' has no attribute 'Mapping'

Screenshots

taskcat-docker-collections-error

Version

Application Version
taskcat 0.9.30
Python 3.10.4

Additional context

This issue was initially flagged in ShahradR/action-taskcat#298—I was installing some Node.js packages on top of the taskcat/taskcat:latest image to support the taskcat GitHub Action, which caused the container build to fail.

Thank you for your issue, I am looking into this.

Docker images have been fixed. They are still tagged as release-0.9.30 and latest.

Thank you so much for the quick response—super appreciated!!

I tried both tags: release-0.9.30 works perfectly, but it looks like we're getting a manifest unknown error with latestI think the tag might be missing from Docker Hub?

Here is the output when running the docker run command using the two tags.

Running the taskcat container with the latest tag

taskcat-latest-missing-manifest

Running the taskcat container with the release-0.9.30 tag

taskcat-0 9 30-working

Latest image tag issue resolved.