How Azure pipelines can get source from Internal TFS and External Git? How can I update the proxy?

748 views Asked by At

I am setting up Azure Pipelines, I have few that get sources from GitHub and trying to setup pipelines to reach TFS on Intranet, I created a Service Connection of type: “Azure Repos/Team Foundation Server” using this Other Git URL: https://tfs.myCie.com/defaultcollection/MyProject/_versionControl

When I run the pipeline, it takes some time then it displays a 504 Timeout error but the pipeline is still pending. After a while, it goes into error with this message in the step “Checkout repository@master to s”:

git -c http.proxy="http://myProxy.myCie.com:80" fetch --force --tags --prune --progress --no-recurse-submodules origin
fatal: unable to access 'https://tfs. myCie.com/defaultcollection/myProject/_versionControl/': OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to tfs.oecd.org:443 
##[warning] Git fetch failed with exit code 128, back off 3.667 seconds before retry.

Security team says that I should use a PAC file to setup the proxy and that should enable intranet and Internet calls but I don’t see how to update the proxy settings of my Self-Hosted Windows Agent.

Can I specify a file? Can there be a configuration for Internet and another one for intranet?

1

There are 1 answers

2
Hugh Lin On BEST ANSWER

I don’t see how to update the proxy settings of my Self-Hosted Windows Agent. Can I specify a file?

For the agent you need to create a .proxy file with the proxy URL in the root directory of your agent.

  1. Locate the root directory of your build agent (this is the folder that contains the run.exe and the _work folder).

  2. Open a Command Prompt at this location.

  3. Type this command, but replace PROXYIP & PORT with your values:

    echo http://PROXYIP:PORT > .proxy
    
  4. Check that your .proxy file is created at the right place:

    enter image description here

  5. Optional: If your proxy needs authentication, you must set these environment variables:

    set VSTS_HTTP_PROXY_USERNAME=user
    set VSTS_HTTP_PROXY_PASSWORD=password
    
  6. Restart the service for your build agent.

When you know that you need a proxy at the time of the installation, you can configure the proxy settings right when you call config.cmd:

./config.cmd --proxyurl http://127.0.0.1:8888 --proxyusername "user" --proxypassword "password"

For details, please refer to this blog.

Here is the official document you can refer to.