taskcat icon indicating copy to clipboard operation
taskcat copied to clipboard

Latest TaskCat docker image fail after lint

Open zhangwenjia0326 opened this issue 4 years ago • 6 comments

Describe the bug The TaskCat docker image that was pushed 16 hours ago with tag latest fail any test after lint complete. Error is the same for any test we run:

taskcat test run


| |_ __ _ | | _____ __ | | | _/ / __| |/ / __/ _ | __| | || (| _ \ < (| (| | | __,|/|____,|__|

version 0.9.19

[0;30;43m[WARN ][0m : A newer version of taskcat is available (0.9.20) [0;30;47m[INFO ][0m : To upgrade pip version [0;30;47m[ pip install --upgrade taskcat][0m [0;30;47m[INFO ][0m : To upgrade docker version [0;30;47m[ docker pull taskcat/taskcat ][0m

[0;30;47m[INFO ][0m : Lint passed for test ........ [0;30;41m[ERROR ][0m : DockerException Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

To Reproduce Steps to reproduce the behavior:

  1. Are you testing a QuickStart or Custom template? Custom template
  2. Attach or link a copy of the template if possible: can be reproduced with any template
  3. Provide the parameters that you passed: can be reproduced with any parameter passed in
  4. How did you install taskcat? 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? with environment variable AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_DEFAULT_REGION

Expected behavior Taskcat test should pass for template/test that's healthy.

Screenshots If applicable, add screenshots to help explain your problem. image This is the error we are getting no matter what test/template is ran against the docker image.

**Version (Please make sure you are running the latest version of taskcat)

  • docker image with latest tag

Note: Python Version (python3 required)

To find versions: Via taskcat: taskcat -V Via pip3: pip3 show taskcat

Note: both version should match

To update taskcat run: for docker : docker pull taskcat/taskcat for pip3: pip3 install --upgrade taskcat

Additional context Ideally, I hope you could maybe consider start versioning your docker images, instead of only maintaining latest tag. This make testing very hard, and if the most recent version is broken, we don't have the option to revert to a previous version of the docker image.

Thank you so much!!

zhangwenjia0326 avatar Sep 02 '20 15:09 zhangwenjia0326

Hi there,

I've encountered the same issue.

In our case (we are executing Taskcat in Gitlab Runner setup), we added the docker socket binding while registering Gitlab runner. It appear to address the issue.

Link for your reference.

https://docs.gitlab.com/ee/ci/docker/using_docker_build.html#use-docker-socket-binding

https://stackoverflow.com/questions/63201603/what-is-the-result-of-mounting-var-run-docker-sock-in-a-docker-in-docker-scen

I4son avatar Sep 03 '20 10:09 I4son

@I4son thank you so much for the suggestion. Just to clarify, did you also start encountering this within the last 48 hours with the new latest image? Or has this always been a required additional setup?

For us, we have developers using this image on local laptop for testing, as well as in our Jenkinsfile as a customized execution environment. Both use cases start failing with this same error yesterday.

I will for sure give your solution a try in our Jenkins setup to fix our CI/CD.

But still want to understand from TaskCat team why this is needed?

Edit: Docker socket bind also fixed the issue for us, but seems like this is a pretty unsafe practice: https://dev.to/petermbenjamin/docker-security-best-practices-45ih#docker-engine, so still hoping TaskCat team could offer a way around this. Thank you!!

zhangwenjia0326 avatar Sep 03 '20 13:09 zhangwenjia0326

from what I can see taskcat doesn't currently support the dockerhub image (https://github.com/aws-quickstart/taskcat#installation).

It seems the dockerhub image was pretty old and recently got updated to latest. The latest taskcat has a dependency on docker to do lambda function zip builds. For the time being I would suggest one of the following:

  • build your own images, locking to a specific version (I think 0.8.x was what the previous image contained).
  • run the taskcat docker container with privileged mode enabled, which is required for docker in docker.
  • if you don't need docker packaging of lambda functions you could try adding package_lambda: false to your projects .taskcat.yml.

jaymccon avatar Sep 09 '20 20:09 jaymccon

This:

package_lambda: false

That really needs to mention that it also depends on docker. I've been trying to work thru https://workshop.quickstart.awspartner.com/ and it simply fails with

[ERROR  ] : DockerException Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

When docker is not present. That is especially annoying when working on Windows via VS Code inside a devcontainer. It is kind of ... unexpected.

serverhorror avatar Mar 28 '21 10:03 serverhorror

I also ran into this issue and had to overcome using package_lambda:false. Can we highlight this in the documentation so that one doesn't have to scan through issues for work around? Thanks.

pmankad96 avatar May 17 '21 23:05 pmankad96

I also had the same issue. package_lambda: false Fixed it although I didn't have any lambda functions nor any scripts. There should be a check somewhere if lambda functions exist before invoking docker to prevent this from happening. The false switch is just a temporary workaround.

hamadsuniverse avatar Jun 08 '21 10:06 hamadsuniverse