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
ssh notation support #17
Conversation
Released in terraspace-bundler 0.5.0 To update:
|
Hey, I still seem to have issues with this. Can it be that subdomains are not supported for the hosts? I've tried all the methods in your examples from top to bottom. Error messages I got: ssh://git@src.COMPANY.com/PROJECT/REPO.git (and without.git) - ssh://git@src.COMPANY.com:PROJECT/REPO - And the version with 'git::https://....' simply states that the repository couldn't be found (it also adds a trailing slash for some reason, maybe that's the issue there). Tried it with both adding .git at the end and without. |
It looks like you’re on terraspace-bundler-0.4.4. Try updating to 0.5.0.
You should see 0.5.0. Then
|
Hm... I created a fully new docker image of TS 1.0.1 and ran a 'bundle update' as well. But yes, I didn't verify the bundler version. Let me do that real quick. |
Oh interesting. Released terraspace-bundler 0.5.0 just before terraspace 1.0.1, so the build process should had use the latest terraspace-bundler. But since the build process now runs upon rubygems webhooks, it might be too fast and it installed terraspace-bundler 0.4.4 since rubygems bundler CDN can take 20m to update. That’s a guess. Will have to dig into more. |
I ran the new build this morning right after seeing the news (so around 5 hours ago). But yes, it's 0.4.4 unfortunately. I will run another docker build and see if this works. we bake the bundle install/update into the docker image to have fixed dependencies, I guess it still grabbed the old version. I'll get back to you after the next run. |
I think I found the issue: You pinned the version of 'terraspace-bundler' in terraspace via ~> on the patch part of the version. Therefore 0.5.0 couldn't be used:
|
Cool. Glad to hear it’s been resolved. Thanks for the update. 🎊 |
Well it's not really resolved. You would need to update the terraspace gem versioning itself for it to be fixed :) Bundle is refusing to install terraspace-bundle in anything higher than 0.4.4 right now. |
🤦🏻♂️ Literally, realized that it was |
Thank you, that was very quick! :) So will this be available in 1.0.2 then? |
Yup. Already released in 1.0.2 |
Great! I will let you know if I see any more issues. You've been a tremendous help in this, much appreciated! |
Hm... are you sure you are actually doing the clone via ssh? It seems you strip the ssh:// information from the git clone url, which means git will try https instead.
The expected 'git clone' command should have been: Not sure about the colon between host and org/project, but the ssh:// protocol needs to be specified. |
So believe the separator between the host and path makes a difference.
This stack overflow helped figure that out: https://stackoverflow.com/questions/6167905/git-clone-through-ssh/16134428#16134428 Code: terraspace-bundler/lib/terraspace_bundler/mod/props.rb Lines 68 to 111 in 4f9b4b5
It’s one of the many tricky edge cases that ran into with this. Wrote specs to cover it.
So believe that's how it should work. 🧐 The interesting thing is that it looks like the clone is not working with the colon separator for your source or maybe setup.
Wondering if it's a git version thing. FWIW, tested with these versions of git
Unsure why the git source with the colon Also, maybe try cloning with the colon |
Clone isn't working without the ssh:// on our bitbucket server as the https port is restricted to browsers only for security reasons. I will try the absolute path. Do you know if that does that include the .git ending or not? We do a regular git clone from the same repository a line above the "terraspace bundle" as a double check the entire time to be sure. But we have to include the ssh protocol specifier for it to work. I will get back to you again :) thanks for the explanations as well. |
Okay. After figuring out that half my problems were due to the fact that git doesn't like to run in root in a docker image (you probably want to add a user to your docker images as well, otherwise they won't run in a ci/cd pipeline like on Jenkins) I finally got it to work. Your changes work fine :) Thank you! |
One note, was about to add to the terraspace docs about possible issues using the root user, but tested it in a Docker container and was able to git clone with the root user. Example:
Also, the
Just noting for posterity. Glad to hear that it worked out. |
It might run on your local machine, but it will not run in any ci/cd, as those usually enforce using uid 1000 in a docker container for security reasons. Jenkins does it, Bamboo does it and I'm pretty sure you get the same effect in Github Actions (but I'm not able to test this atm). The only thing necessary for us was making sure we created a user on the docker image. The dockerfile didn't have to run it in at all and all installation was done using root in the Dockerfile. |
Adds support for ssh git clone notation.
Tested several examples:
Terrafile
Also, re-tested the other sources examples on https://terraspace.cloud/docs/terrafile/sources/
Related: