Skip to content

Commit

Permalink
feat(debug): Java11 debug support (#1634)
Browse files Browse the repository at this point in the history
  • Loading branch information
jfuss committed Dec 6, 2019
1 parent ff7fcd0 commit 89c5ed0
Show file tree
Hide file tree
Showing 12 changed files with 273 additions and 177 deletions.
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
matrix:

- PYTHON_HOME: "C:\\Python36-x64"
PYTHON_VERSION: '3.6.8'
PYTHON_VERSION: '3.6.9'
PYTHON_ARCH: '64'
NOSE_PARAMETERIZED_NO_WARN: 1
INSTALL_PY_37_PIP: 1
Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/local/invoke/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def do_cli( # pylint: disable=R0914
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException
from samcli.commands.local.lib.exceptions import OverridesNotWellDefinedError
from samcli.local.docker.manager import DockerImagePullFailedException
from samcli.local.docker.lambda_debug_entrypoint import DebuggingNotSupported
from samcli.local.docker.lambda_debug_settings import DebuggingNotSupported

LOG.debug("local invoke command is called")

Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/local/start_api/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def do_cli( # pylint: disable=R0914
from samcli.commands.local.lib.local_api_service import LocalApiService
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException
from samcli.commands.local.lib.exceptions import OverridesNotWellDefinedError
from samcli.local.docker.lambda_debug_entrypoint import DebuggingNotSupported
from samcli.local.docker.lambda_debug_settings import DebuggingNotSupported

LOG.debug("local start-api command is called")

Expand Down
2 changes: 1 addition & 1 deletion samcli/commands/local/start_lambda/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def do_cli( # pylint: disable=R0914
from samcli.commands.local.lib.local_lambda_service import LocalLambdaService
from samcli.commands.validate.lib.exceptions import InvalidSamDocumentException
from samcli.commands.local.lib.exceptions import OverridesNotWellDefinedError
from samcli.local.docker.lambda_debug_entrypoint import DebuggingNotSupported
from samcli.local.docker.lambda_debug_settings import DebuggingNotSupported

LOG.debug("local start_lambda command is called")

Expand Down
17 changes: 11 additions & 6 deletions samcli/local/docker/lambda_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"""
import logging

from samcli.local.docker.lambda_debug_entrypoint import LambdaDebugEntryPoint
from samcli.local.docker.lambda_debug_settings import LambdaDebugSettings
from .container import Container
from .lambda_image import Runtime

Expand Down Expand Up @@ -71,11 +71,16 @@ def __init__(

image = LambdaContainer._get_image(image_builder, runtime, layers)
ports = LambdaContainer._get_exposed_ports(debug_options)
entry = LambdaContainer._get_entry_point(runtime, debug_options)
entry, debug_env_vars = LambdaContainer._get_debug_settings(runtime, debug_options)
additional_options = LambdaContainer._get_additional_options(runtime, debug_options)
additional_volumes = LambdaContainer._get_additional_volumes(debug_options)
cmd = [handler]

if not env_vars:
env_vars = {}

env_vars = {**env_vars, **debug_env_vars}

super(LambdaContainer, self).__init__(
image,
cmd,
Expand Down Expand Up @@ -168,7 +173,7 @@ def _get_image(image_builder, runtime, layers):
return image_builder.build(runtime, layers)

@staticmethod
def _get_entry_point(runtime, debug_options=None): # pylint: disable=too-many-branches
def _get_debug_settings(runtime, debug_options=None): # pylint: disable=too-many-branches
"""
Returns the entry point for the container. The default value for the entry point is already configured in the
Dockerfile. We override this default specifically when enabling debugging. The overridden entry point includes
Expand All @@ -181,11 +186,11 @@ def _get_entry_point(runtime, debug_options=None): # pylint: disable=too-many-b
"""

if not debug_options:
return None
return None, {}

debug_ports = debug_options.debug_ports
if not debug_ports:
return None
return None, {}

debug_port = debug_ports[0]
debug_args_list = []
Expand All @@ -195,7 +200,7 @@ def _get_entry_point(runtime, debug_options=None): # pylint: disable=too-many-b

# configs from: https://github.com/lambci/docker-lambda
# to which we add the extra debug mode options
return LambdaDebugEntryPoint.get_entry_point(
return LambdaDebugSettings.get_debug_settings(
debug_port=debug_port,
debug_args_list=debug_args_list,
runtime=runtime,
Expand Down
143 changes: 0 additions & 143 deletions samcli/local/docker/lambda_debug_entrypoint.py

This file was deleted.

Loading

0 comments on commit 89c5ed0

Please sign in to comment.