For one command on a Unix Jenkins agent, put the proxy assignment on that command:

node('linux') {
    sh 'http_proxy=http://build-proxy.example:8080 https_proxy=http://build-proxy.example:8080 ./build.sh'
}

The example assumes the repository has a build script and the agent’s tools read these environment names. The assignments replace inherited values for that command and its children. They do not rewrite the machine’s persistent environment. For a build step fetching public artifacts over an allowed route without proxy authentication, the HTTP proxy list can supply candidate HTTP endpoints for those values.

If several Pipeline steps should share the override, use a withEnv block around those steps. Jenkins documents that its variable handling is case insensitive but case preserving; check the resulting spelling when a Unix tool requires a particular lowercase name.

A plain export in one sh step belongs to that shell. A later independent shell step is a new process and does not inherit changes made by its sibling.

Apply the setting where the command runs. Jenkins controller downloads and a tool launched on a remote agent are separate network consumers. A successful update check on the controller does not establish the agent command’s route.

Tënë sô zo