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

Asset uploadIfChanged only runs for files not for directories #1997

Closed

Comments

@brad-jones
Copy link

When using new AssetCode('/some/path'), a zip file is created using prepareZipAsset and then uploaded using prepareFileAsset which executes uploadIfChanged.

The problem is that the zip file obviously has some timestamp data (or similar) in it that changes the hash of the file. So on every single deployment, regardless of if the asset has actually changed or not, a new asset is uploaded.

prepareZipAsset should either produce a idempot zip file or it should run a similar zipIfChanged function.

Anyway my workaround for now has been to use https://github.com/aws/aws-lambda-go/blob/master/cmd/build-lambda-zip/main.go to generate the zip of my lambdas and then get CDK to just upload the zip.

FYI: build-lambda-zip does produce an idempot zip file.

@spg
Copy link
Contributor

spg commented Jun 5, 2019

It seems like it's linked to the order of the files in the zip file (not the timestamps of the files themselves) #2759

jogold added a commit to jogold/aws-cdk that referenced this issue Jun 19, 2019
Zip files were not consistent across deploys resulting in unnecessary S3 uploads and stack updates.

Ensure consistency by appending files in series (guarantees file ordering in the zip) and reseting
dates (guarantess same hash for same content).

Closes aws#1997, Closes aws#2759
jogold added a commit to jogold/aws-cdk that referenced this issue Jun 19, 2019
Zip files were not consistent across deploys resulting in unnecessary S3 uploads and stack updates.

Ensure consistency by appending files in series (guarantees file ordering in the zip) and reseting
dates (guarantees same hash for same content).

Closes aws#1997, Closes aws#2759
rix0rrr pushed a commit that referenced this issue Jun 21, 2019
Zip files were not consistent across deploys resulting in unnecessary S3 uploads and stack updates.

Ensure consistency by appending files in series (guarantees file ordering in the zip) and reseting
dates (guarantees same hash for same content).

Closes #1997, Closes #2759
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment