sbadia/puppet-gitlab

$git_proxy in .gitconfig is ignored by vcsrepo git provider

Opened this issue · 0 comments

Setting $git_proxy in the users git config file does not work for people who are required to use vcsrepo via proxyserver. The problem relates due to how Puppet/vcsrepo resets environment when calling Puppet::Util::Execution.execute(). I added some debug options to vcsrepos type class git.rb to see what is printed for git config -l. It misses the proxies unless they are directly specified in the repositories .git/config.

Tested with sbadia-gitlab v0.1.5 but I see that there were no changes in upstream regarding proxy setup.

Example failed run with debugging enabled, where $git_proxy was set correctly for .gitconfig:

Fri Dec 11 17:57:08 +0100 2015 Puppet (debug): Executing 'git config -l'
Fri Dec 11 17:57:08 +0100 2015 Vcsrepo[/srv/rubyapps/gitlab/gitlab-shell](provider=git) (debug): core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=https://github.com/gitlabhq/gitlab-shell.git
branch.master.remote=origin
branch.master.merge=refs/heads/master
...
Fri Dec 11 18:10:07 +0100 2015 Puppet (debug): Executing 'git fetch origin'
Fri Dec 11 18:11:10 +0100 2015 /Stage[main]/Gitlab::Ci::Package/Vcsrepo[/srv/rubyapps/gitlab/gitlab-shell] (err): Could not evaluate: Execution of 'git fetch origin' returned 128
...

WA was, to either use custom_environment execute() option in vcsrepos git.rb (bad) or specify proxies directly in .git/config gitlab-/ci & -shell.