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

fix(lambda-python): asset hash is non-deterministic #12984

Merged
merged 14 commits into from
Feb 24, 2021
Merged
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-lambda-python/lib/bundling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ export function bundle(options: BundlingOptions): lambda.AssetCode {
});

return lambda.Code.fromAsset(entry, {
assetHashType: cdk.AssetHashType.BUNDLE,
// pip adds timestamps and other non-determinstic values in the bundle, so
// we want to calculate hash against the pure source and not against the
// output.
assetHashType: cdk.AssetHashType.SOURCE,
exclude: DEPENDENCY_EXCLUDES,
bundling: {
image,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353S3Bucket414E0E30"
"Ref": "AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dS3BucketA91ECDDD"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -49,7 +49,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353S3VersionKey5ABC9098"
"Ref": "AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dS3VersionKey1C8E9E07"
}
]
}
Expand All @@ -62,7 +62,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353S3VersionKey5ABC9098"
"Ref": "AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dS3VersionKey1C8E9E07"
}
]
}
Expand All @@ -87,17 +87,17 @@
}
},
"Parameters": {
"AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353S3Bucket414E0E30": {
"AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dS3BucketA91ECDDD": {
"Type": "String",
"Description": "S3 bucket for asset \"4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353\""
"Description": "S3 bucket for asset \"ed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83d\""
},
"AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353S3VersionKey5ABC9098": {
"AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dS3VersionKey1C8E9E07": {
"Type": "String",
"Description": "S3 key for asset version \"4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353\""
"Description": "S3 key for asset version \"ed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83d\""
},
"AssetParameters4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353ArtifactHashECA6C88C": {
"AssetParametersed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83dArtifactHashA06A8B3C": {
"Type": "String",
"Description": "Artifact hash for asset \"4ee6ce8b6ee4bd51743dc0c39d6e52baebaeafff9c9dfea0ff84de98d1dbf353\""
"Description": "Artifact hash for asset \"ed5616d1abebc600ce62f84a44dd1516b397ab3a0aca2ecb055f66099c5ab83d\""
}
},
"Outputs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cS3BucketA501FC08"
"Ref": "AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9S3Bucket4DABA1C5"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -49,7 +49,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cS3VersionKey1C3AFB39"
"Ref": "AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9S3VersionKey9F011EB5"
}
]
}
Expand All @@ -62,7 +62,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cS3VersionKey1C3AFB39"
"Ref": "AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9S3VersionKey9F011EB5"
}
]
}
Expand Down Expand Up @@ -121,7 +121,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28S3Bucket7DE4D4D5"
"Ref": "AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bS3Bucket2E59B11C"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -134,7 +134,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28S3VersionKeyAEB67E87"
"Ref": "AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bS3VersionKey9C301B46"
}
]
}
Expand All @@ -147,7 +147,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28S3VersionKeyAEB67E87"
"Ref": "AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bS3VersionKey9C301B46"
}
]
}
Expand Down Expand Up @@ -206,7 +206,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009S3BucketA66E9035"
"Ref": "AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7S3Bucket5F203E07"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -219,7 +219,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009S3VersionKeyAFEB5FDA"
"Ref": "AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7S3VersionKey1E1B70CF"
}
]
}
Expand All @@ -232,7 +232,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009S3VersionKeyAFEB5FDA"
"Ref": "AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7S3VersionKey1E1B70CF"
}
]
}
Expand All @@ -257,41 +257,41 @@
}
},
"Parameters": {
"AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cS3BucketA501FC08": {
"AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9S3Bucket4DABA1C5": {
"Type": "String",
"Description": "S3 bucket for asset \"94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45c\""
"Description": "S3 bucket for asset \"acd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9\""
},
"AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cS3VersionKey1C3AFB39": {
"AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9S3VersionKey9F011EB5": {
"Type": "String",
"Description": "S3 key for asset version \"94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45c\""
"Description": "S3 key for asset version \"acd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9\""
},
"AssetParameters94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45cArtifactHash99DC751A": {
"AssetParametersacd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9ArtifactHashA015B7B1": {
"Type": "String",
"Description": "Artifact hash for asset \"94972df8a01484c56b50bec3793ac6c4302bc044db29d3502007bdc0f83db45c\""
"Description": "Artifact hash for asset \"acd13e247cbbccbc76932c1ca67a79937008de70b9162840d93793dbb7a14fa9\""
},
"AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28S3Bucket7DE4D4D5": {
"AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bS3Bucket2E59B11C": {
"Type": "String",
"Description": "S3 bucket for asset \"3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28\""
"Description": "S3 bucket for asset \"a84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9b\""
},
"AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28S3VersionKeyAEB67E87": {
"AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bS3VersionKey9C301B46": {
"Type": "String",
"Description": "S3 key for asset version \"3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28\""
"Description": "S3 key for asset version \"a84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9b\""
},
"AssetParameters3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28ArtifactHashE51CE860": {
"AssetParametersa84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9bArtifactHash83B1E10E": {
"Type": "String",
"Description": "Artifact hash for asset \"3b0b0f3cd46ea1490006d6cefca359385ec059bb00a0fbee4de2eecf48038e28\""
"Description": "Artifact hash for asset \"a84be40cec7782d58185cb52b8b9c6774bfb62616da2ae910c897b22f835dd9b\""
},
"AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009S3BucketA66E9035": {
"AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7S3Bucket5F203E07": {
"Type": "String",
"Description": "S3 bucket for asset \"876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009\""
"Description": "S3 bucket for asset \"af6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7\""
},
"AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009S3VersionKeyAFEB5FDA": {
"AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7S3VersionKey1E1B70CF": {
"Type": "String",
"Description": "S3 key for asset version \"876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009\""
"Description": "S3 key for asset version \"af6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7\""
},
"AssetParameters876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009ArtifactHashB9A1080D": {
"AssetParametersaf6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7ArtifactHash892B22BE": {
"Type": "String",
"Description": "Artifact hash for asset \"876959f777c5a23bf4408991959c55c91810329d159608feb7ede69418b35009\""
"Description": "Artifact hash for asset \"af6fb15e9f79a336cd75a8fb343021a8d465682a22a2fa7b1032d6aebdc062c7\""
}
},
"Outputs": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efS3BucketD53ED9C5"
"Ref": "AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4S3BucketA3E8EBA1"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -49,7 +49,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efS3VersionKey3C218A3E"
"Ref": "AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4S3VersionKey0907781F"
}
]
}
Expand All @@ -62,7 +62,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efS3VersionKey3C218A3E"
"Ref": "AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4S3VersionKey0907781F"
}
]
}
Expand Down Expand Up @@ -121,7 +121,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dS3BucketFDE171D0"
"Ref": "AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743S3Bucket4EF476C4"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -134,7 +134,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dS3VersionKey6209E240"
"Ref": "AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743S3VersionKey5F43AD39"
}
]
}
Expand All @@ -147,7 +147,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dS3VersionKey6209E240"
"Ref": "AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743S3VersionKey5F43AD39"
}
]
}
Expand Down Expand Up @@ -206,7 +206,7 @@
"Properties": {
"Code": {
"S3Bucket": {
"Ref": "AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68S3BucketA23E6312"
"Ref": "AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75S3Bucket252C89F4"
},
"S3Key": {
"Fn::Join": [
Expand All @@ -219,7 +219,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68S3VersionKey1E21AF83"
"Ref": "AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75S3VersionKeyC82C6D6B"
}
]
}
Expand All @@ -232,7 +232,7 @@
"Fn::Split": [
"||",
{
"Ref": "AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68S3VersionKey1E21AF83"
"Ref": "AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75S3VersionKeyC82C6D6B"
}
]
}
Expand All @@ -257,41 +257,41 @@
}
},
"Parameters": {
"AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efS3BucketD53ED9C5": {
"AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4S3BucketA3E8EBA1": {
"Type": "String",
"Description": "S3 bucket for asset \"61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175ef\""
"Description": "S3 bucket for asset \"7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4\""
},
"AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efS3VersionKey3C218A3E": {
"AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4S3VersionKey0907781F": {
"Type": "String",
"Description": "S3 key for asset version \"61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175ef\""
"Description": "S3 key for asset version \"7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4\""
},
"AssetParameters61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175efArtifactHash6A1881A8": {
"AssetParameters7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4ArtifactHashA74EACA2": {
"Type": "String",
"Description": "Artifact hash for asset \"61d8d26f10d1d73dee2732bec7ed381d2c987fc2912a339f2f119f3b0ea175ef\""
"Description": "Artifact hash for asset \"7ce3c07d0472588786467c436de4fb6be7d5a397831809f676b8ab5e63556fd4\""
},
"AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dS3BucketFDE171D0": {
"AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743S3Bucket4EF476C4": {
"Type": "String",
"Description": "S3 bucket for asset \"1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956d\""
"Description": "S3 bucket for asset \"9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743\""
},
"AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dS3VersionKey6209E240": {
"AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743S3VersionKey5F43AD39": {
"Type": "String",
"Description": "S3 key for asset version \"1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956d\""
"Description": "S3 key for asset version \"9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743\""
},
"AssetParameters1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956dArtifactHash02B929EC": {
"AssetParameters9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743ArtifactHashF216A82F": {
"Type": "String",
"Description": "Artifact hash for asset \"1d66b06c3b3ee86b3126fb58d7a06ff055d366d8aeeb4dfbaf28d40f0930956d\""
"Description": "Artifact hash for asset \"9b23e36650c4fc32f8f632a0c9d952d31e604865d71f026dc40692df112fb743\""
},
"AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68S3BucketA23E6312": {
"AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75S3Bucket252C89F4": {
"Type": "String",
"Description": "S3 bucket for asset \"96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68\""
"Description": "S3 bucket for asset \"3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75\""
},
"AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68S3VersionKey1E21AF83": {
"AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75S3VersionKeyC82C6D6B": {
"Type": "String",
"Description": "S3 key for asset version \"96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68\""
"Description": "S3 key for asset version \"3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75\""
},
"AssetParameters96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68ArtifactHash0043D2A0": {
"AssetParameters3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75ArtifactHashBFCAE690": {
"Type": "String",
"Description": "Artifact hash for asset \"96a447e468bf9d3b52d13213757160cd43f28737a29b8682c281fde388762e68\""
"Description": "Artifact hash for asset \"3c758b02f050a0b95282c1bb4a081efa4ef0ae7054dec28c23ab50b5c6fb0a75\""
}
},
"Outputs": {
Expand Down
Loading