taskcat
taskcat copied to clipboard
Patch docker logging
Overview
When taskcat -d package (note the debug mode) lambda code using a Dockerfile if the execution goes wrong the logs from the container are truncated. This doesn't allow one to easily diagnose problems within the container.
The changes made now collect the logs from a lower level directly from Docker and we get the full container logs not just the last ~n lines.
Testing/Steps taken to ensure quality
Ran taskcat -d paclage -s functions/source -z functions/output on the Amazon EKS Architecture quickstart.
Output
[INFO ] : Packaging lambda source from /Users/gargana/workspace/scratch/aws-quickstart/quickstart-amazon-eks/functions/source/ResourceReader using docker image taskcat-build-9f45ebd0ff885208a590b0db185459cd
[DEBUG ] : docker build logs:
{"stream":"Step 1/4 : FROM lambci/lambda:build-python3.7"}
{"stream":"\n"}
{"stream":" ---\u003e d115d451cc01\n"}
{"stream":"Step 2/4 : COPY . ."}
{"stream":"\n"}
{"stream":" ---\u003e Using cache\n"}
{"stream":" ---\u003e 1c16fedf81e6\n"}
{"stream":"Step 3/4 : RUN pip install -t . -r ./requirements.txt \u0026\u0026 find . -name \"*.dist-info\" -exec rm -rf {} \\; | true \u0026\u0026 find . -name \"*.egg-info\" -exec rm -rf {} \\; | true \u0026\u0026 find . -name \"*.pth\" -exec rm -rf {} \\; | true \u0026\u0026 find . -name \"__pycache__\" -exec rm -rf {} \\; | true \u0026\u0026 rm Dockerfile requirements.txt \u0026\u0026 curl -o awscli-exe-linux-x86_64.zip https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip \u0026\u0026 find . -exec touch -t 202007010000.00 {} + \u0026\u0026 zip -X -r lambda.zip ./"}
{"stream":"\n"}
{"stream":" ---\u003e Using cache\n"}
{"stream":" ---\u003e 642f3753457d\n"}
{"stream":"Step 4/4 : CMD mkdir -p /output/ \u0026\u0026 mv lambda.zip /output/"}
{"stream":"\n"}
{"stream":" ---\u003e Using cache\n"}
{"stream":" ---\u003e e081ffa261c2\n"}
{"aux":{"ID":"sha256:e081ffa261c2d038a68bacf587716a8adf48c99ea1c8af772f019199acfe7fdb"}}
{"stream":"Successfully built e081ffa261c2\n"}
{"stream":"Successfully tagged taskcat-build-9f45ebd0ff885208a590b0db185459cd:latest\n"}
[DEBUG ] : docker run logs:
Notes
Output could be prettified somewhat but the functionality is more important.
Testing Instructions
Checkout Amazon EKS Quick Start
git checkout https://github.com/aws-quickstart/quickstart-amazon-eks.git
run taskcat package with debug flag
taskcat -d package -s functions/source -z functions/outputs