UiPatch Azure DevOps Server Tasks cannot download uipcli.zip on self-hosted agent behind proxy

We are using Azure DevOps Server (on premise) and use self hosted agents. These agents have a proxy configured with a “.proxy” and “.proxybypass” configuration file in the root of the azure agent folder.

An extension with Azure DevOps tasks should use this when trying to connect to the internet.

If we add the following task:

- task: UiPathPack@3
  inputs:
    versionType: 'AutoVersion'
    projectJsonPath: '$(Build.SourcesDirectory)'
    outputType: 'Process'
    orchestratorConnection: 'UiPath-Orchestrator-Acceptance'
    outputPath: '$(Build.ArtifactStagingDirectory)\Output'
    traceLevel: 'Information'

It cannot find the UiPath executable and tries to download it. This fails because it times out because it doesn’t use the proxy settings:

Starting: UiPathPack
==============================================================================
Task         : UiPath Pack
Description  : Packages an existing UiPath project into a NuGet package.
Version      : 3.0.3517186
Author       : UiPath
Help         : 
==============================================================================
cli selected WIN_21.10.8319.10920
##[error]Unhandled: connect ETIMEDOUT 13.107.42.18:443
Finishing: UiPathPack

In the code i’ve traced this back to the following

function c(e, t, r) {
    return new Promise(((n, o) => {
        let a = new URL(e),
            l = {
                hostname: a.host,
                port: 443,
                path: a.pathname + a.search,
                method: "GET",
                secureProtocol: "TLSv1_2_method"
            }
        s.get(l, (e => {
            if ([301, 302, 303].indexOf(e.statusCode) > -1) n(c(e.headers.location, t, r))
            else if (200 === e.statusCode) {
                let o = i.createWriteStream(path.join(t, "uipcli.zip"))
                e.pipe(o), o.on("close", (() => {
                    console.log("CLI downloaded successfully, extracting..."), n(u(o.path, t, r))
                }))
            } else o(`CLI download failed with status code ${e.statusCode}.`)
        }))
    }))
}

It uses the following information to download the nupkg.

t.defaultCliPackageVersion = "21.10.8319.10920", t.cliConfigurationMap = {
    "WIN_21.10.8319.10920": {
        displayName: "UiPath Windows CLI",
        name: "UiPath.CLI.Windows",
        default: !0,
        version: {
            major: "21",
            minor: "10",
            patch: "10920",
            complete: "21.10.8319.10920"
        },
        supports: {
            windows: !0,
            linux: !1
        },
        description: "This is the default CLI , pre-packaged version.",
        feedUrl: "https://uipath.pkgs.visualstudio.com/Public.Feeds/_packaging/UiPath-Official/nuget/v3/flat2/UiPath.CLI/21.10.8319.10920/UiPath.CLI.21.10.8319.10920.nupkg"
    }

This should also support proxy settings if they are detected in the Azure Agent.

Additional information:
If a ‘hack’ the feedUrl in the js to a locally hosted url it works and the task installs uipcli without issues. This confims the proxy issue. Also downloading the feedUrl from the machine works fine using proxy so no firewall issues on the self-hosted agent machine.

Additional information:
If a ‘hack’ the feedUrl in the js to a locally hosted url it works and the task installs uipcli without issues. This confims the proxy issue. Also downloading the feedUrl from the machine works fine using proxy so no firewall issues on the self-hosted agent machine.