Skip to content

PoC for Lambda smart deploy - #1

Closed
remi00 wants to merge 4 commits into
masterfrom
lambda-smart-deploy-wip
Closed

remi00 wants to merge 4 commits into
masterfrom
lambda-smart-deploy-wip

Conversation

@remi00

@remi00 remi00 commented Jul 13, 2021 •

Copy link
Copy Markdown
Owner

This changes won't be needed.

See new PR #2 with much reduced changes

What it does?

  • Adjust format of artifact paths to <prefix>/<stage>/<function_name>/<hash>
  • Adjust how the ZIP artifact hash is calculated so that just the content matters
  • Do S3.headObject() check before the artifact file upload on the deploy. If file already exists, the upload is omitted.
  • Change the Cloudformation template file compilation, so that Lambda version resources change also only if implementation or configuration change.

What else is important?

  • ZIP artifact hash is calculated based just on its content entries (files) using their: crc32, fileName and size.
    • This way it omits file system metadata (file timestamps) that is also part of ZIP and even though ZIP contents will be the same, regular file hash would always differ.
    • Make the result order-invariant (sort ZIP entries) as compiled ZIP may differ in that matter, without any impact on the deliverable.
    • Using crc32 instead of actual contents is just for optimization. It's part of ZIP format standard.
  • This change requires also that Serverless stops using CodeSha256 check feature of Cloudformation deploys for AWS::Lambda::Version. It doesn’t look to be necessary in the deployment model that Serverless uses (AWS calculates CodeSha256 per ZIP including irrelevant metadata) as the version is always deployed with AWS::Lambda::Function anyway.
  • This is just PoC, not to be merged yet.

@remi00

remi00 commented Aug 25, 2021

Copy link
Copy Markdown
Owner Author

Legacy.

@remi00 remi00 closed this Aug 25, 2021
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.

1 participant