Skip to content

Commit

Permalink
fix(sdk): fix website source_hash (#3807)
Browse files Browse the repository at this point in the history
Fixing the source_hash in the sdk snapshots to be a string and not a path

## Checklist

- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [x] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing

*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
  • Loading branch information
tsuf239 authored Aug 14, 2023
1 parent cb01b06 commit 1c9954e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ exports[`default website behavior 1`] = `
],
\\"key\\": \\"/b.html\\",
\\"source\\": \\"<source>\\",
\\"source_hash\\": \\"\${filemd5(\\\\\\"/home/runner/work/wing/wing/libs/wingsdk/test/target-tf-aws/website/b.html\\\\\\")}\\"
\\"source_hash\\": \\"\${filemd5(<source>)}\\"
},
\\"Website_File--inner-folder--ahtml_7D20A7EF\\": {
\\"bucket\\": \\"\${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}\\",
Expand All @@ -154,7 +154,7 @@ exports[`default website behavior 1`] = `
],
\\"key\\": \\"/inner-folder/a.html\\",
\\"source\\": \\"<source>\\",
\\"source_hash\\": \\"\${filemd5(\\\\\\"/home/runner/work/wing/wing/libs/wingsdk/test/target-tf-aws/website/inner-folder/a.html\\\\\\")}\\"
\\"source_hash\\": \\"\${filemd5(<source>)}\\"
}
}
}
Expand Down Expand Up @@ -480,7 +480,7 @@ exports[`website with add_json 1`] = `
],
\\"key\\": \\"/b.html\\",
\\"source\\": \\"<source>\\",
\\"source_hash\\": \\"\${filemd5(\\\\\\"/home/runner/work/wing/wing/libs/wingsdk/test/target-tf-aws/website/b.html\\\\\\")}\\"
\\"source_hash\\": \\"\${filemd5(<source>)}\\"
},
\\"Website_File--inner-folder--ahtml_7D20A7EF\\": {
\\"bucket\\": \\"\${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}\\",
Expand All @@ -490,7 +490,7 @@ exports[`website with add_json 1`] = `
],
\\"key\\": \\"/inner-folder/a.html\\",
\\"source\\": \\"<source>\\",
\\"source_hash\\": \\"\${filemd5(\\\\\\"/home/runner/work/wing/wing/libs/wingsdk/test/target-tf-aws/website/inner-folder/a.html\\\\\\")}\\"
\\"source_hash\\": \\"\${filemd5(<source>)}\\"
},
\\"Website_File-configjson_1F1498B9\\": {
\\"bucket\\": \\"\${aws_s3_bucket.Website_WebsiteBucket_3C0321F0.bucket}\\",
Expand Down
7 changes: 7 additions & 0 deletions libs/wingsdk/test/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,13 @@ export function tfSanitize(templateStr: string): string {
) {
return "<source>";
}
if (
key === "source_hash" &&
typeof value === "string" &&
value.startsWith("${filemd5")
) {
return "${filemd5(<source>)}";
}
return value;
},
2
Expand Down

0 comments on commit 1c9954e

Please sign in to comment.