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

(aws-lambda-python): skip build lambda for all cdk commands #12684

Closed
2 tasks
rtrive opened this issue Jan 24, 2021 · 7 comments · Fixed by #12984
Closed
2 tasks

(aws-lambda-python): skip build lambda for all cdk commands #12684

rtrive opened this issue Jan 24, 2021 · 7 comments · Fixed by #12984
Labels
@aws-cdk/aws-lambda-python feature-request A feature should be added or improved. p2

Comments

@rtrive
Copy link

rtrive commented Jan 24, 2021

Is it possible to avoid to rebuild lambda at every cdk diff or cdk deploy if no updates are made on them?

Use Case

Every time that i need to change a single configuration parameter on a stack, all lambdas are rebuilt with docker and it takes too much time to deploy a single stack

Proposed Solution

Implement an hash check between lambda version or a flag that enable or disable lambda build

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

@rtrive rtrive added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 24, 2021
@ran-isenberg
Copy link

a must have feature IMHO

@AnatoliiHanziuk
Copy link

And why does cdk for aws-lambda-python requires docker?
When I write const fn = new PythonFunction(this, "Test", {entry:"",}); then after running cdk synth i receive error Cannot connect to the Docker daemon. It means that if I want to execute cdk synth for any other stack I need to have docker installed and running.

eladb pushed a commit that referenced this issue Feb 11, 2021
When a Python handler uses external dependencies, the hash calculated on the output is non-determinstic due to the fact that it includes timestamps. To resolve that, change the asset hash strategy to `SOURCE` which means that the bundle will only be re-created if one of the source files changes.

Fixes #12770
Fixes #12684
@eladb
Copy link
Contributor

eladb commented Feb 15, 2021

This is technically a duplicate of #12770

@eladb eladb closed this as completed Feb 15, 2021
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

mergify bot pushed a commit that referenced this issue Feb 24, 2021
When a Python handler uses external dependencies, the hash calculated on the output is non-determinstic due to the fact that it includes timestamps. To resolve that, change the asset hash strategy to `SOURCE` which means that the bundle will only be re-created if one of the source files changes.

Additionally, the Python image hash, which is also included in the asset hash (to ensure that if the build image changes, the bundle is invalidated) included the absolute path for the `Dockerfile`. This caused the image hash itself to change every time the image was built on a different system. To fix this, we stage the dependency files & dockerfile into a temp directory and build the image from there.

Fixes #12770
Fixes #12684


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@NGL321 NGL321 added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Dec 17, 2021
@NGL321
Copy link
Contributor

NGL321 commented Dec 17, 2021

Reopening as an internal support request noted that this behavior still occurs. I have reproduced this behavior in the latest release. According to the PS engineer:

The bundling.ts irrespective of changes to the entry code or stack code, it will call the cdk.DockerImage.fromBuild and generate the tagHash and do dockerExec. I think this is needed cause we are not sure if the build happened on the machine already but at the same I kinda see why cx doesn't want this to happen if they didn't touch any of the lambda stuff.

Since this is non-blocking and doesnt significantly impact performance I am leaving as a feature-request and setting priority to low.

@NGL321 NGL321 reopened this Dec 17, 2021
@eladb eladb removed their assignment Jan 25, 2022
@corymhall
Copy link
Contributor

This should be fixed with a combination of #19143 and #18082

@github-actions
Copy link

github-actions bot commented Mar 8, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-lambda-python feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants