jenkinsci / jenkinsci/jfrog-plugin

NoProxy configuration doesn't work with wildcards

Open
#40 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
Java
Stars
16
Forks
85
PR merge metrics
No merged PRs in 30d

Description

### Describe the bug

My jenkins is behind a proxy but my JFrog artifactory is on the local network.

When configuring NoProxy with a wildcard`*.mynetwork`, jfrog plugin still apply the proxy and the step fails.
When I remove the proxy configuration completely, the step succeeds anew.

Digging into #19 , I notice the implementation is using a `java.util.regex.Pattern` but noproxy expects a wildcard pattern.

As an additonnal note, in the doc, you expect comma separated values but Jenkins expect one host per line. (implementation is correct)

> Specify host name patterns that shouldn't go through the proxy, one host per line. "*" is the wild card host name (such as "*.jenkins.io" or "www*.jenkins-ci.org")

### Current behavior

```
Also: hudson.remoting.Channel$CallSiteStackTrace: Remote call to tra-rtg-paris-linasx
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1787)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1003)
at hudson.FilePath.act(FilePath.java:1229)
at hudson.FilePath.act(FilePath.java:1218)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.BinaryInstaller.performJfrogCliInstallation(BinaryInstaller.java:53)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.ArtifactoryInstaller.performInstallation(ArtifactoryInstaller.java:67)
at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:70)
at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:109)
at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:221)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.JfrogInstallation.forNode(JfrogInstallation.java:50)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.JfrogInstallation.forNode(JfrogInstallation.java:32)
at PluginClassLoader for workflow-basic-steps//org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:157)
at PluginClassLoader for workflow-basic-steps//org.jenkinsci.plugins.workflow.steps.ToolStep$Execution.run(ToolStep.java:138)
at PluginClassLoader for workflow-step-api//org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Also: org.jenkinsci.plugins.workflow.actions.ErrorAction$ErrorId: 39dc0f00-bdfe-4d6a-9bdf-dfab18f92c7e
java.io.IOException: JFrog service failed. ...
at PluginClassLoader for jfrog//org.jfrog.build.extractor.clientConfiguration.client.JFrogService.throwException(JFrogService.java:49)
at PluginClassLoader for jfrog//org.jfrog.build.extractor.clientConfiguration.client.artifactory.services.DownloadBase.handleUnsuccessfulResponse(DownloadBase.java:49)
at PluginClassLoader for jfrog//org.jfrog.build.extractor.clientConfiguration.client.JFrogService.execute(JFrogService.java:121)
at PluginClassLoader for jfrog//org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.downloadHeaders(ArtifactoryManager.java:102)
at PluginClassLoader for jfrog//org.jfrog.build.extractor.clientConfiguration.client.artifactory.ArtifactoryManager.downloadHeaders(ArtifactoryManager.java:97)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.callables.JFrogCliDownloader.getArtifactSha256(JFrogCliDownloader.java:118)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.callables.JFrogCliDownloader.invoke(JFrogCliDownloader.java:65)
at PluginClassLoader for jfrog//io.jenkins.plugins.jfrog.callables.JFrogCliDownloader.invoke(JFrogCliDownloader.java:28)
at Jenkins v2.460//hudson.FilePath$FileCallableWrapper.call(FilePath.java:3615)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:377)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
```

### Reproduction steps

- define http proxy with wirldcard config
- try to use jfrog step without using proxy

### Expected behavior

Proxy not used because url matches the noproxy config.

### JFrog plugin version

1.5.0

### JFrog CLI version

latest

### Operating system type and version

Linux

### JFrog Artifactory version

Enterprise Plus 7.77.11

### JFrog Xray version

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the NoProxy implementation discussed in issue #19 and trace its use through BinaryInstaller.java, ArtifactoryInstaller.java, and JFrogCliDownloader.java. Compare the current regex-based matching with Jenkins' documented one-host-per-line wildcard behavior, then add coverage showing that a matching wildcard bypasses the proxy and run the relevant plugin tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devops, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.