aws-extensions-for-dotnet-cli icon indicating copy to clipboard operation
aws-extensions-for-dotnet-cli copied to clipboard

dotnet lambda package-ci CodeUri unchanged if hash of project is the same

Open lmunro opened this issue 5 years ago • 3 comments

The SAM Serverless::Function property AutoPublishAlias will attempt to re-deploy a lambda if the CodeUri changes.

The CodeUri produced from

dotnet lambda package-ci

is always different, even if the lambda code doesn't change.

This causes issues deploying changes to the other resources in the SAM template, because if you don't also change the lambda code you get a "A version for this Lambda function exists" error and the stack update rolls back.

Is there a way to set the zip file name in the codeuri to a hash of some sort?

lmunro avatar Jul 05 '19 04:07 lmunro

it looks like it's currently re-uploading the artifact entirely, even if it's unchanged. Avoiding this could get a lot of gains:

  • fewer uploads - saving time, traffic, and S3 space
  • fewer spurious artifacts, which get in the way when digging through version history
  • fewer spurious function updates, or CloudFormation updates when nothing else has changed. Unnecessary moving pieces during a deployment cause more risk, and add noise to the event log. Some source changes like testing & documentation won't cause changes to the built artifact.

I'm currently using <Deterministic>True</Deterministic> in my .csproj files and have verified that the zipfiles match between packaging. It looks like verifying the MD5 sum against the ETag can be used as a heuristic to reduce spurious uploads, although it won't always prevent them.

hauntingEcho avatar Oct 01 '20 16:10 hauntingEcho

We have noticed this issue has not received attention in 1 year. We will close this issue for now. If you think this is in error, please feel free to comment and reopen the issue.

github-actions[bot] avatar Aug 11 '22 00:08 github-actions[bot]

This is still needed

hauntingEcho avatar Aug 11 '22 16:08 hauntingEcho