-
-
Notifications
You must be signed in to change notification settings - Fork 986
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
Using terragrunt scaffold with GitLab URLs #3031
Comments
Hi, |
I suspect wasn't used
|
Using |
Hi @denis256, thanks for looking into this. If you look at my original quote, I did try without the The error suggests to me that there is an assumption about directory level. Your example apparently uses a personal GitLab project which is always two levels deep:
The project path is (and I see that I used the |
@lorengordon I am not sure about GitHub, but with GitLab if you go into the web UI both SSH and HTTPS URLs end in .git. But they do work without it too. |
Apparently not. Or I'm not using the call signature correctly...
|
Hi,
Will raise an issue in the library GH project |
Thanks for the update @denis256. |
@denis256 could you remove the "awaiting response" label? Is there something else I can provide? |
@denis256 my colleague @tvizor is looking into addressing the issue with Considering this example from https://blog.gruntwork.io/introducing-terragrunt-catalog-and-scaffold-aead126dcf10:
The repo URL in this case is That may be clear in the context of Terragrunt, where For a GitLab URL which can nest groups up to 20 levels deep, this presents a problem. Does Terragrunt equate |
Hi, FYI: @brikis98 |
Hi @josh-padnick. My colleague, @tvizor, has submitted a PR for addressing hashicorp/go-getter#479, opened by @denis256. Could we work together on resolving this? Scaffold is a game-changer, in my view. I'd love to see it work (more robustly) with GitLab. |
Hello! Sorry this hasn't been moving along at the rate you would prefer, @gmaghera . Is my understanding right that the only issue here is with the underlying I believe we would need your pull request to be merged by the maintainers of |
Hi @yhakbar -- yes, if that PR gets merged, and we get a new version of Terragrunt which includes that code, that should solve the issue. It's not just our repositories, in its current shape go-getter and scaffold only support a fraction of GitLab. There may be a gap with testing non-free GitLab repos which can contain nested groups in their URL. And there is a request to add the same feature to GitHub... See https://github.com/orgs/community/discussions/4837 |
Go-getter seems abandoned, perhaps there is some lull due to the IBM/Hashicorp thing... @yhakbar could we explore some alternate solutions? We could spin a release from the fork, or perhaps some other way to get this working. Anything we can do to get scaffold functional with GitLab Enterprise... |
Does it work in terraform natively? If not, and you can easily reproduce the issue, might be worth opening an issue there. At this point, the go-getter project is primary only updated to support use cases from terraform... |
Yes, the issue is not specific to Terragrunt at all. @denis256 has already opened an issue for it, which is linked to the PR which would fix it. See #3031 (comment) |
That issue is on go-getter, not on terraform. Like I said, if the issue is not opened against terraform and confirmed there to impact terraform, no maintainer on go-getter is going to address it. |
True but by that token, maybe Terragrunt should be looking for a replacement. |
I've tried to find an example in Terraform core where the go-getter issue could be reproduced, per @lorengordon's suggestion. Here's the rough example, a
That works just fine, even though we know go-getter cannot handle such paths. The Terraform code base must be using something else to pull down modules hosted on gitlab.com. denis256 would it be possible to use the same path with Terragrunt? Is there perhaps a better example I can try to reproduce? I cannot think off the bet of something analogous to |
@lorengordon apparently, someone did find a manifestation of the issue in Terraform! I'm hoping this results in traction. |
Hello again. Gruntwork, I would like to kindly ask that you consider pursuing a direct solution to this. Relying on getting a fix via Hashicorp's go-getter does not seem like a viable option. We have created an issue there, detailed the line of code where the issue stems from, placed a PR with the fix, yet there is no traction after months of waiting. Scaffold is such a powerful feature! It bridges a gap in making Terragrunt accessible to engineers who may not have much experience with it, and it is also great for encouraging best practices. In its current form, however, the feature is broken for all GitLab enterprise customers. |
@yhakbar @denis256 @levkohimins This alone makes it worth considering a hacky workaround until hashicorp/go-getter#479 is merged (which could well be never). But in addition, @gmaghera has really gone above and beyond to track down (and even attempt to resolve) this problem here. Can we address his underlying issue so he can begin using |
I can take a look to add handling of Gitlab cases |
Before you dig into this, @denis256 , could I get confirmation on a couple things to verify that we do, indeed need to workaround go-getter, @gmaghera ? I know we already asked about this, and you already provided a response, so I'm sorry that I didn't ask clarifying questions about this early on. I didn't have a GitLab account, so I didn't check, but I just made one to confirm that SSH URLs don't work for nested paths: $ go-getter '[email protected]:gitlab-org/ai-powered/eli5.git//eli5' eli5
2024/09/03 13:33:21 success! It seems based on that example that go-getter v2 does in fact work, and we might just need to update the version used in the Do you mind running the following: go install github.com/hashicorp/go-getter/cmd/go-getter@latest Then trying out the standalone If all we need to do is upgrade the version of |
@yhakbar I will check if it works today. But, looking at your test, that does not appear to be a nested repo, or not nested enough. You need at least three "layers" before the //. For example gitlab.com/group1/group2/group3/repo.git//foobar. Go-getter wrongly assesses that group2 is the repository, or at least it used to. I'll reply with my test results next. |
@yhakbar can you please share how you've installed v2 of go-getter? Running |
Sorry, I may have been mistaken that I was using To be extra super confident that we're trying out $ git clone [email protected]:hashicorp/go-getter.git
$ cd go-getter
$ git checkout v2
$ cd cmd/go-getter
$ go install . In my testing on an open source repo I was able to find that was more deeply nested, it continued to work: $ go-getter [email protected]:gitlab-org/ai-powered/custom-models/pocs/gitlab-docs-indexer-poc.git poc
2024/09/04 14:02:06 -> poc It's been a while since I used GitLab, so please let me know if I'm still missing a nuance here on the level of nesting for repos. |
Using go-getter v2 does work via the SSH protocol (but not via HTTPS). Thank you for the suggestion, @yhakbar. As long as it works with one protocol, that would be good enough for my needs. |
Hello @josh-padnick @denis256 @yhakbar. Just wanted to check in, and make sure you're not waiting on me. Do we have a path forward on this? I've run the tests recommended by Yousif, go-getter v2 does fix the issue (for SSH protocol only, but that's sufficient for me). Do you mean to address this with #3381? Thank you! |
Hey @gmaghera , I think it might be incidentally addressed via #3381, but I don't know if it will. To be transparent, the team doesn't have a ton of bandwidth right now, and maximizing GitLab compatibility for scaffold isn't a priority right now. The fact that there's some viable approach for GitLab developers to use Scaffold makes me feel like this can be addressed by a member of the community if they would like the improved ergonomics of not specifying the schema for the git URL in GitLab. I'd like to leave this issue open, though, to make it clear that this is something that can be addressed. |
I am a bit confused. Scaffold is broken for all GitLab Enterprise users. I appreciate the bandwidth restrictions, we all have to deal with it. If there is a viable approach, I'd be more than happy to use it. However asking that we restructure where we keep Terraform modules in GitLab is not viable. It is also a typical setup within GitLab Enterprise. There has been so much back and forth about this. @josh-padnick asked @denis256 to look into a fix via #3031 (comment), but then @yhakbar you asked me to look into whether that could be addressed via v2 of go-getter. I did all that, and it looked promising, and now I am being told that may not be a good path forward. I realize what I am asking for, and this being an OSS project, and you having priorities (we used to be a paying customer of Gruntwork), but the communication around this has been contradictory. |
Ah, sorry @gmaghera , my mistake. My impression was that you tried using scaffold using a GitLab SSH URL and found that it worked. I didn't realize that you were saying that it was specifically using the Your comment regarding #3031 fixing things makes more sense to me now, as I thought you were asking if that would fix all GitLab URLs. I agree that it doesn't look like there's a path forward for you to use scaffold without us upgrading I'll sync up with the team and see if we can prioritize a fix for this next week. |
Hey @gmaghera , Would you mind testing out v0.68.0-beta2024100701 to see if upgrading I don't have a convenient way to test this on my own, as I don't control a valid publicly available TF module in GitLab to scaffold. |
Oh, I really, really appreciate this! I will test and get back to you. |
@yhakbar it does work, but with a slight qualifier. I was about to report it not working after a number of tries, but then I stumbled upon a module URL usage that is a bit peculiar. This behavior is consistent between GitLab and GitHub. There seems to be an issue with scaffolding Terraform module repositories which host the HCL files at the root (the style the TF registry uses). What works with GitLab: ℹ️ Note the extra '.' after the double slash. Without that piece, I get an error. But that is not specific to GitLab. It can be reproduced with GitHub:
When I look at the docs, the examples show modules that are subdirectories of Git repos, such as Is there a recommended way to address repositories that don't use subdirectories for module code? |
After doing that I had a sinking feeling that I had to verify... and there was a surprise find! 🤦 As long as I add that extra period after the double slash, scaffold works with v0.67.10 of |
Thanks for testing this out, @gmaghera ! It looks like it's related to this change, as we noticed some abnormalities with go-getter usage at that point. Will file a bug report for us to address this in the future. For now, it seems like you're unblocked on using scaffold in GitLab, and we can comfortably de-prioritize this issue. Please feel free to point out if I'm making an invalid assumption here. I'll mark the Scaffold v2 upgrade as ready for review, as it seems to work just the same as it does in the latest release for GitLab. I'll close this issue out, as GitLab users aren't any more blocked on scaffold usage. It's a go-getter double-slash issue that's causing problems. |
I'm unblocked indeed, will keep an eye out for future developments. Thank you @yhakbar, @josh-padnick, @denis256 for all the collaboration on this! |
Describe the bug
Scaffold does not seem to work with GitLab URLs
To Reproduce
or
Expected behavior
Please provide an example for how to do this against a GitLab repository.
Nice to have
Versions
Additional context
Add any other context about the problem here.
The text was updated successfully, but these errors were encountered: