From 54185b5fecef5ea56c315df4dd62409fbbd69182 Mon Sep 17 00:00:00 2001 From: yahavi Date: Thu, 31 Aug 2023 17:14:25 +0300 Subject: [PATCH] CR --- README.md | 3 +-- .../plugins/jfrog/callables/JFrogCliDownloader.java | 2 +- .../configuration/JenkinsProxyConfiguration.java | 11 ++++++++++- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 54dbf012..c1c3ef62 100644 --- a/README.md +++ b/README.md @@ -187,8 +187,7 @@ under `Manage Jenkins` > `Manage Plugins` > `Advanced`. To exclude the JFrog platform from going through a configured proxy, provide your JFrog platform's host details in the `No Proxy Host` section. This should be a list of comma-separated hosts. -Keep in mind that the JFrog CLI is typically downloaded from releases.jfrog.io. You might want to think about adding -that to your list as well. +Notice that the JFrog CLI is typically downloaded from releases.jfrog.io. You may need to add that to your list as well. ## Jenkins Configuration as Code diff --git a/src/main/java/io/jenkins/plugins/jfrog/callables/JFrogCliDownloader.java b/src/main/java/io/jenkins/plugins/jfrog/callables/JFrogCliDownloader.java index 4bc73e29..6c9b2dc0 100644 --- a/src/main/java/io/jenkins/plugins/jfrog/callables/JFrogCliDownloader.java +++ b/src/main/java/io/jenkins/plugins/jfrog/callables/JFrogCliDownloader.java @@ -58,7 +58,7 @@ public Void invoke(File toolLocation, VirtualChannel channel) throws IOException String artifactoryUrl = instance.inferArtifactoryUrl(); try (ArtifactoryManager manager = new ArtifactoryManager(artifactoryUrl, Secret.toString(instance.getCredentialsConfig().getUsername()), Secret.toString(instance.getCredentialsConfig().getPassword()), Secret.toString(instance.getCredentialsConfig().getAccessToken()), buildInfoLog)) { - if (proxyConfiguration.isProxyConfigured() && !proxyConfiguration.shouldBypassProxy(artifactoryUrl)) { + if (proxyConfiguration.isProxyConfigured(artifactoryUrl)) { manager.setProxyConfiguration(proxyConfiguration); } // Getting updated cli binary's sha256 form Artifactory. diff --git a/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java b/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java index e8371c75..ebfea0f1 100644 --- a/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java +++ b/src/main/java/io/jenkins/plugins/jfrog/configuration/JenkinsProxyConfiguration.java @@ -42,7 +42,16 @@ public boolean isProxyConfigured() { } /** - * Return true if the host is matched to one of the 'No Proxy Host' patterns. + * Return true if the proxy is configured and not bypassed. + * + * @return true if the proxy is configured. + */ + public boolean isProxyConfigured(String url) { + return isProxyConfigured() && !shouldBypassProxy(url); + } + + /** + * Return true if the host matches one of the 'No Proxy Host' patterns. * * @param url - Server URL to check * @return true if should bypass proxy.