Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] debug output for Dockerfile based lambda packaging #695

Open
gargana opened this issue Nov 3, 2021 · 0 comments
Open

Comments

@gargana
Copy link
Contributor

gargana commented Nov 3, 2021

Currently builds give very little details when packaging lambdas by Dockerfile.

I would like to see container logs in the taskcat output for more complex packaging

Making the following changes to _lamda_build.py I am able to get some ugly but useful docker logs.

from io import BytesIO
from docker import APIClient
def _docker_build(self, path, tag):
        #_, logs = self._docker.images.build(path=str(path), tag=tag)
        #build_logs = []
        #for line in logs:
        #    line = self._clean_build_log(line)
        #    if line:
        #        build_logs.append(line)
        #LOG.debug("docker build logs: \n{}".format("\n".join(build_logs)))

        cli = APIClient(base_url='unix:///var/run/docker.sock')
        build_logs = [line for line in cli.build(
          path=str(path), tag=tag
        )]
        output = ""
        for line in build_logs:
            print(line.decode())
        LOG.debug("docker build logs: \n{}".format("\n".join(output)))

Problems with this approach.

  1. Directly access the UNIX socket is brittle and would break on a number of systems.
  2. Formatting of the logs is very ugly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant