-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
#2517 fix parsing cache key construction #2518
#2517 fix parsing cache key construction #2518
Conversation
I don't want to vote against this MR in general, but adding the filename will have an major effect on the caching implementation. The logic was to cache duplicate blocks of code and not cache individual files. Adding the filename will break the initial idea of that because you will only cache files. While this will still boost reoccurring dependency parsing, it does not have the benefit of different files containing the same code logic. In addition, i want to point out that there was no consideration in changing the test suite for the implementation to confirm that the changes have an impact or not. Also missing some reproduction guide for the bug. I'd recommend in understanding this MR as feature request and not a (bug) fix. |
Hi, |
This is also a nice case for the benchmarks that we included in the initial MR ;) |
Hi Kevin (@maunzCache), hi Denis (@denis256), in general I agree with Kevin. Adding the But in our case the following issue occurs. I need to explain a bit about the environment. One remark: performance is not an issue. The performance decreased only slightly (tested by Merlin) Explaining our environment and dependenciesIn the following picture you can see a snippet which shows a simple representation of our terragrunt environment: The important part is the multi-region config in this example account: In there we have a dependency block to a kms key. The If not, then we are in dependency "baseline_common_kms_key" {
config_path = local.region == "eu-central-1" ? "../../global/baseline-common-global" : "../../eu-central-1/baseline-common"
mock_outputs = {
default_cmk_arn = "arn:aws:kms:eu-central-1:..."
cloudtrail_cmk_arn = "arn:aws:kms:eu-central-1:..."
}
} Reproducing the issue without and with the
|
Hello, I tried to reproduce a similar setup in https://github.com/denis256/terragrunt-tests/tree/master/issue-2518 but still can't get |
Hi @denis256, thanks a lot for your effort. We will try to provide a repo with an environment to reproduce. Thanks a lot! |
Hi @denis256, we spent some time on stripping down one of our environments to make it as small as possible with a good use case to show the error. Since this was still too much. One of our developers (@jkarkoszka) tried the other way round and created a very small example repository to show exactly our error. Here you can find this sandbox repo: https://github.com/jkarkoszka/terragrunt-environment-for-pr-2518 The repository also includes two terragrunt binaries. The original v0.44.5 and the forked one from us, which includes the change from this PR. So it should be very easy without configuration to clone the repo and follow the instructions to reproduce the error. Our current approach to get the region is to retrieve it from the directory path. We thought that this is maybe not the way gruntwork would propose it to do. @sdahlen-reply tried the approach to retrieve the region from a Thanks a lot! Thanks to Jakub (@jkarkoszka) and Sebastian (@sdahlen-reply) |
The original issue is that the cached value of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised separated issue #2643 to implement tracking of HCL cache performance
Description
Preface
With v0.38.9 our HCL parsing cache contribution from issue #2203 (PR #2204) was added to terragrunt which improved the parsing speed of HCL files by introducing an in-memory cache:
https://github.com/gruntwork-io/terragrunt/releases/tag/v0.38.9
For detailed information, please refer to #2203 and #2204
Motivation for this issue
During our daily work, we encountered that the new parsing cache key has a bug which occurs only in certain, rare conditions.
Specifically, it only occurs if a Terragrunt module .hcl file depends on itself in a different folder, which was previously not the case and therefor couldn't been tested in our environments.
Solution
Adding a missing parameter (
filename
) in the cache key construction ofTerragruntConfigFromPartialConfigString
Documentation
n/a
TODOs
Please ensure all of these TODOs are completed before asking for a review.
Related Issues
Fixes #2517
Related to #2203 and #2204