-
Notifications
You must be signed in to change notification settings - Fork 74
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
Add support for Git/Svn proxy through system config. #40
Conversation
The main reason for this instead of simply using the existing environment variables is that I often run into cases where I may need to use a separate proxy to get at some git repositories that are inside a different network. |
Hi John, thanks for the issue and work! In general sounds like a valid use case for me. Some first thoughts and comments:
OK, I'll find some popcorn and keep watching where this is going. 😎 |
@tmatilai Cool, that makes sense. I'll take a look into using that. What's the best pattern here since the current builder calls all of the proxies. Should I make another Action to just handle post provisioning configurations? |
I think I would add another middleware stack builder method into And obviously the capability should verify that git is found in PATH, maybe with something like |
@tmatilai What do you think about this approach? Will add appropriate tests. |
private | ||
|
||
def configure_machine(machine, config) | ||
write_config(machine, sudo_config(config), path: '/etc/gitconfig', mode: '0444', append: true) |
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.
- No need to set the mode here. The default
0644
is fine. - The path could come from capability as for other components.
s/sudo/git/
;)
Have you tested that appending always works? Now every vagrant provision
adds a new [http]
section and proxy
key. I assume git is fine with that? And if the value is empty, does it reset the setting for git? Sorry, I'm lazy to check myself before asking. :)
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.
I have tested it locally and it works but I'm not thrilled with it. Really the only way I think to reliably get around this is to use the git configuration command itself.
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.
Maybe we can start with this, but disable it by default and label it a bit experimental. I.e. add config.git_proxy.enabled
which is false
by default. What do you think?
Then later we can change this to use git config
when the infra is ready for hooking to provision actions. I'll need that for e.g. maven support anyway. And we can anyway enable this by default later. Other way around it might be a breaking change for somebody.
@johnbellone looks promising! Probably a good idea to just write the config without waiting for git being installed. Still thinking if this should be enabled by default or by opt-in... |
That's up to you. :)— On Thu, Jan 9, 2014 at 9:22 PM, Teemu Matilainen [email protected]
|
@tmatilai What do you think? |
Looking mostly really good! I'll get back to it when I have resolved the provisioner hooking in #34 and merged it. |
@tmatilai Sounds good! Let me know if I can help at all. |
👍 |
@tmatilai Rebased against master. 🚢 ? |
John, sorry I forgot to mention that I´ll be on vacation this week. I |
comm.sudo("mv #{tmp} #{path}") | ||
|
||
if opts[:append] | ||
comm.sudo("cat #{tmp} | tee -a #{path}") |
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.
First, "cat #{tmp} >> #{path}"
would be simpler. But this ignores :mode
and :owner
options as those are set only for the tmp
file.
Sorry for this taking so long from my part. I rebased and will test and make some changes locally. |
This adds support for overriding the HTTP proxy for Git by setting the system configuration. It uses the git command itself to write to the config file.
I ran into this while attempting to build MRI 1.8.7 which seems to checkout from the old Subversion repository. At any rate unfortunately ti seems that Subversion itself doesn't have a `config` command so we're left with simply writing it directly to /etc/subversion/servers.
@tmatilai Rebased again. Let me know if there's anything else :). |
@johnbellone thanks again! As I said I already have a rebased and modified branch in (slow) progress. But too little hacking time lately. :/ I'm also still not sure about all the functionality here. It would help if you could share some kind of example Vagrantfile how you use this. And bonus bullets:
|
@tmatilai No worries! I can cook up a quick Vagrantfile, but really we're using it in combination with I'd prefer just using I'm not sure about Subversion either. There are only a few groups using it here and it seems to work alright for them. I ran across it because we had an immediate need and it seemed like a quick win :). I think its safe to assume Git/Svn can be configured in subsequent provisions. |
@johnbellone thanks for the explanation, helps a lot! Finally I ended up running behind some yaks yesterday, but promise to prioritize this high. I think we could start with a bit conservative setup, and see if it's enough. I'll try to get something out soon for you to review. |
Merged as part of #49. |
This adds support for overriding the HTTP proxy for Git/Svn by setting the
system configuration. It uses the git command itself to write to the
config file.