Skip to content

DotNetCoreCLI@2 will fail on restore, when no_proxy is set with wildcards #478

@glatzert

Description

@glatzert

The no_proxy variable is unfortunately notorious in having different interpretations with different runtimes, tools, etc. pp.

Recently a server administrator set a rule, that all servers now will have environment variables for http_proxy, https_proxy and no_proxy.
The no_proxy containing *.example.com as value (the * is not necessary, so the workaround is simple) leads to the DotNetCoreCLI@2 Task to fail with a error message like this:

##[error]SyntaxError: Invalid regular expression: /*.example.com/: Nothing to repeat
##[error]Packages failed to restore

I think I traced the problem down to

export function getProxyBypassForConfig(configFile: string): string {
where a Regex seems to be made from the proxyBypass list entries, without escaping regex characters.

The task I used like this (nothing fancy I think):

task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: <...>
selectOrConfig: config
nugetConfigPath: projects/netcore/NuGet.Config
verbosityRestore: Normal

The problem did show up in Azure Devops Agent 3.328.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions