Jenkins agent not running through proxy

Hello,

We have migrated an old jenkins installation running on a linux server to a newer version on a Windows Server 2022 Standard.
The new Jenkins version is 2.401.3 and java 11.08.
Jenkins and jenkins agent runs as services using a AD service account
On the old linux instalation jenkins was running on a local user.

The new Jenkins is up and running and is used.

The proble is four scripts that includes testing another web application. Access to this application has to go through the company proxy server.

The proxy setup in Manage Jenkins/Configure system is only for plugins as I understand. Accessing plugins works so I assume that it is correctly setup.

Proxy is instead configured then running the agent through gradle in an Jenkins file pipeline/agent/stage section with the following syntax:

bat "./gradlew.bat clean test -DincludeTags=\"${env.CLASSFILE}\" -DexcludeTags=\"norun\" -Dprofile=cqa --info -Dserver.environment=${env.SYS_ENV} -Dhttp.proxyHost=proxyhost.yy.xx -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxyhost.yy.xx -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=\"server1.xx.yy|server2.zz.yy|server3.xx.yy\" -Dsecret=$secret"

I have a printout of the variables above so I can see that they have correct values in the console log of the executed job.

This is the same setup we had on the linux server and there it worked.
I have tested manually and learned that if I logon to the server with the service account I get the same fault as I can see in the scripts. The service account has not proxy setup. When I configure proxy for the service account user and run the test manually it works. If I run the script through the jenkins agent it is still not picking up the proxy configuration.

To conclude: For some reason the jenkins job is not picking up the proxy configuration when running on the jenkins agent.

My understanding is that I should not have any proxy configuration on the service account but it should be setup for the excution with the gradle command as in the above example.

Q1: Have I understood how it should be setup correctly?
Q2: I looked at the setup in the old linux installation but of course we are using bat instead of sh when running the command. Is there some syntax that must be changed because of that? I get no errors in the log
Q3: On the linux server jenkins was running on a local user, now we have an AD service account. Do we have to configure something for that user?

Hello @Elfsborg and welcome to this community. :wave:

Regarding the AD service account, as far as I know (which means not much) you generally don’t need to configure a proxy for the service account itself. Instead, as you are currently doing, you should configure the proxy settings within your Jenkins job or pipeline script. :thinking:

However, there are some considerations:

  1. Windows Service Account Permissions: Ensure that the AD service account used for running Jenkins agents has the necessary permissions to execute commands and access network resources, including the proxy server. Make sure it’s not locked down with overly restrictive policies that might affect network access.
  2. Environment Variables: Check if there are any environment variables set for the service account that could be affecting the proxy settings. Sometimes, environment variables can override settings in Jenkins jobs or scripts.
  3. Proxy Authentication: If your proxy server requires authentication, you might need to provide credentials within your Gradle command. This is done by adding -Dhttp.proxyUser=username -Dhttp.proxyPassword=password and similar properties for HTTPS.

My $0.02.