Created
May 19, 2020 15:15
-
-
Save darinpope/75ce10313f7a2c915aa65925e4bd089f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.ning.http.client.*; | |
import jenkins.plugins.asynchttpclient.*; | |
import com.cloudbees.jenkins.plugins.assurance.model.*; | |
import org.apache.commons.lang.*; | |
ProxyServer proxy = AHCUtils.getProxyServer() | |
if (proxy != null) { | |
println proxy.getHost() | |
println proxy.getPort() | |
println proxy.getPrincipal() | |
println proxy.getPassword() | |
} | |
println "-------------" | |
ProxyConfiguration proxyConf = Jenkins.getInstance().proxy | |
if (proxyConf != null) { | |
println proxyConf.name | |
println proxyConf.port | |
println proxyConf.getUserName() | |
println proxyConf.getPassword() | |
} | |
println "-------------" | |
if (proxyConf != null) { | |
if (proxyConf.noProxyHost != null) { | |
for (String s : proxyConf.noProxyHost.split("[ \t\n,|]+")) { | |
if (s.length() > 0) { | |
println s | |
} | |
} | |
} | |
} | |
println "-------------" | |
AsyncHttpClient ahc = AHC.instance(); | |
AsyncHttpClient.BoundRequestBuilder builder = ahc.prepareGet("https://beekeeper-server.cloudbees.com/api/security-warnings"); | |
if (!Beekeeper.isTest() && StringUtils.isNotBlank(null)) { | |
// If test, we force allways the new request | |
builder.setHeader("if-none-match", etag); | |
} | |
println builder.execute().get().getResponseBody(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment