We figured it out and I wanted to add some info and our solution here for
any future occurrences for someone else.

*More Info: *We did try adding this just before the 'checkout scm' and
verified that the machine actually can connect to github.com on port 443

    sh 'wget https://github.com'

And it downloaded a few thousand bytes of text without error. You do have
to check that its not just an error message from the proxy.

*Solution:* Then we found the information here
https://gist.github.com/evantoli/f8c23a37eb3558ab8765

      git config --global https.proxy
http://proxyUsername:proxypassw...@proxy.server.com:port

That was what we needed to get it working. I do not know why Jenkins was
not using the proxy information from the env variables but adding it to the
git configuration made it work

thanks


On Tue, May 25, 2021 at 11:00 AM Lee Meador <l...@leemeador.com> wrote:

> I have scripted pipeline like this:
>
> env.https_proxy = "myproxy.com:9400"
> <similar lines for http proxy and no proxy>
> sh 'env | grep proxy'
> checkout scm
>
> It echos the env variables correctly and then gets this error on the
> checkout:
>
> *16:26:27*  + grep proxy*16:26:27*  + env*16:26:27*  
> http_proxy=http://myproxy.com:9400*16:26:27*  
> https_proxy=http://myproxy.com:9400
>
> *16:26:27*  no_proxy=local.com
>
>
> < ... snip />
>
>
> Fetching changes from the remote Git repository*16:26:28*  ERROR: Error 
> fetching remote repo 'origin'*16:26:28*  hudson.plugins.git.GitException: 
> Failed to fetch from https://github.com/mygithub/app.git*16:26:28*          
> at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:909)<
>
> < ... snip />
>>
> *16:26:28*  Caused by: hudson.plugins.git.GitException: Command "git fetch 
> --tags --progress https://github.com/AAInternal/CTOP.git 
> +refs/heads/*:refs/remotes/origin/*" returned status code 128:*16:26:28*  
> stdout:
>
> *16:26:28* stderr: fatal: unable to access '
> https://github.com/AAInternal/CTOP.git/': Failed connect to github.com:443;
> Connection refused
>
> Its running in the corporate data center and I tested that wget connects
> from linux command line when those same values are in those same env
> variables. But there is no connection without using the proxy.
>
> Should the "checkout scm" use the proxy set a few lines up in the script
> in this manner?
>
> Thanks
>
> -- Lee Meador
> Sent from gmail. My real email address is lee AT leemeador.com
>


-- 
-- Lee Meador
Sent from gmail. My real email address is lee AT leemeador.com

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAA4vtDQTq9%2BnW5AomeFurvns0%3D0h4eTn4WcW2xNbqvFCTWPE4Q%40mail.gmail.com.

Reply via email to