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

feat: Error on --use-container for dotnet builds #1096

Merged
merged 7 commits into from
Apr 8, 2019

Conversation

sanathkr
Copy link
Contributor

@sanathkr sanathkr commented Apr 3, 2019

Issue #, if available:

Description of changes:
"sam build" for Dotnet does not really need to support building within a container because majority of the dotnet modules don't have native bindings and can compile on any platform and run successfully on Lambda.

PR is marked WIP because the exact error message and UX is still not signed off.

Checklist:

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about integ tests? Can we add --use-container tests to make sure this works. I we could go all out and make sure stdout has the correct logging but we should at least make sure we have integ tests for adding the flag and it doesn't crash or try to do the build in the container.

"""

unsupported = {
DOTNET_CLIPACKAGE_CONFIG: "We do not support building dotnet Lambda functions within a container. Most "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be based on the work workflow or the runtime/lang? If tomorrow we add a second DotNet workflow, do we run the risk of not updating this too?

I don't know the right answer here. My initial thought is we might want to do this on a lang (all DotNet versions and workflows), to keep things consistent but could see a reason to constrain to the Workflow itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I struggled with this as well. Ultimately, I realized that the workflow implementation is what dictates whether it can run within a container or not. So making the distinction based on workflow config seemed right here. We might find other cases to abstract it differently. Since this is an implementation detail, we can refactor later if needed

samcli/lib/build/app_builder.py Outdated Show resolved Hide resolved
samcli/lib/build/workflow_config.py Show resolved Hide resolved
@sanathkr sanathkr changed the title WIP: feat: Bypass containers for dotnet builds feat: Error on --use-container for dotnet builds Apr 5, 2019
@jfuss
Copy link
Contributor

jfuss commented Apr 5, 2019

Should we have integration tests for use container with dotnet?

@sanathkr
Copy link
Contributor Author

sanathkr commented Apr 5, 2019

Just pushed integration tests :)

Copy link
Contributor

@jfuss jfuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


with self.assertRaises(ContainerBuildNotSupported) as ctx:
self.builder._build_function_on_container(config,
"source_dir",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to pass in mode? we may need changes in app_builder.py as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, that's happening as part of the other PR that Jacob created

@@ -141,7 +141,7 @@ def supports_build_in_container(config):
"""

def _key(c):
return c.language + c.dependency_manager + str(c.application_framework)
return str(c.language) + str(c.dependency_manager) + str(c.application_framework)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be the hash function on the object? It’s much cleaner that way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole point of namedtuple is so you automatically get a sane hash function. I don't want to break that abstraction by defining a custom has that takes only a handful of properties. May be I am wrong here, so let me know if a custom hash is right way of doing things..

@sanathkr sanathkr dismissed sriram-mv’s stale review April 8, 2019 21:23

addressed in PR 1095

@sanathkr sanathkr merged commit 99c6ed4 into aws:develop Apr 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants