-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
feat(manager/terragrunt): support lockFileMaintenance #20833
feat(manager/terragrunt): support lockFileMaintenance #20833
Conversation
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.
needs unit test
@viceice What kind of unit test were you thinking? The logic in this function is straightforward enough to me that I didn't think it warrants one, but I'm also new to this codebase. |
When I run
When I run
I'll update my branch to try and at least get the Functions coverage back to 100% UPDATE: as 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.
did you test the latest version against real repos? I'd like to see some working sample PR for different update types.
@viceice Yes, I tested on my public repository here. I've summarized all tests to date in this wiki page |
Idon't see a pr open with a changed lockfile in your test rep 👀 |
That's because I close the PRs as I go, to provide a clean testing workbench (when I run |
I just ran it again, from commit 5fa37874f, and left the resulting PRs open for visibility (required_provider minor and lockfile). |
as you can see, the provider PR is missing a lockfile update. so it needs more things to do here to support that case. maybe we simply need to match the extract properties to terraform. @secustor can you help? |
🤔 for this to work we need to follow the reference to the modules and then do a full extraction with the terraform manager. This will give us the updated dependencies which we than can use to update the lock file. The problem with that, besides that it is costly, is that we have to leave the directory where the package file is located. |
Leave it to where? It's ok to traverse the repo itself
What type of updates? Do you mean run multiple binaries? |
No still inside the repo but I don't think we have function to do find file patterns safely. We have one if we know the file names tough.
The resulting updates from the |
Hi all, It sounds like it would be difficult, or at least lengthy and complex, to implement "lockfile updates as part of module updates". I shouldn't have brought it up in the first place, considering it's not the main focus of #13393 . In order to keep the scope of this PR contained I'd like to focus on the current implementation, which provides a solution to "terragrunt configurations don't get lockfile updates". I believe the code is sound, and my tests show that this branch does exhibit the desired behavior. The last thing remaining for me to do (that I know of) is to set up an end-to-end test in Am I missing anything? How does the current implementation look to you? Thank you all for helping me with this, it will make a big difference to my team's weekly operations. |
You need unit tests which call the At best you implement
|
Hi, I'm a teammate of @spilliams's taking a look at this while he's focused on other work. Am I understanding these requested changes correctly?
|
If a terragrunt file has a lock file, shouldn't the lock file be updated any time the package file is updated? If I understand this PR, it would only update this lock file independently on a lock file maintenance schedule, while all other PRs would have an un-updated and hence out of date lock file? |
This remains unanswered? |
Thanks for pinging that @rarkins. Here are my thoughts, but I believe @secustor has some thoughts as well:
Terragrunt (and Terraform) deployments don't always have package files. There may be updated constraints on dependency versions, but in general for my use cases I keep my coded dependency constraints as low as possible and try to keep my lockfile updated with the latest versions of my dependencies. This usually means running
Perhaps. I'm not really sure since I'm so new to the inner workings of Renovate. I'll say two things here:
|
@secustor can you clarify why you think only lock file maintenance is necessary? |
I think it is necessary, but requires larger changes in the code base to work efficiently outside of I see |
@secustor ok, please merge then if you're happy with it |
🎉 This PR is included in version 35.95.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Thank you maintainers! We just confirmed this works on our huge Terragrunt repo, and it's going to save us so much time. |
terragrunt configurations sometimes have no tf files, but do have terraform lockfiles.
Changes
Adds a function
updateArtifacts
to the Terragrunt manager that wraps the Terraform manager's implementation. As requested in this discussion, it only calls the downstream function if the update type islockFileMaintenance
.Context
The current Renovate behavior is that it normally does not update a Terraform lockfile if it is in a directory with no
.tf
files. This can be the case when the configuration is managed by Terragrunt, where theterragrunt.hcl
includes aterraform
block to call out to an external module.The expected behavior is that when Renovate runs on a minimal Terragrunt configuration, it will update the versions and hashes stored in the
.terraform.lock.hcl
. This is a listing of what a minimal Terragrunt configuration contains:and a minimal
terragrunt.hcl
is:Closes #13393
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
My test repository is here. The "before" PR was this one and the "after" PR was this one.
I've run
yarn test
locally and it shows that coverage is unchanged from the before this branch: