diff --git a/src/main/java/com/amazon/jenkins/ec2fleet/aws/AWSUtils.java b/src/main/java/com/amazon/jenkins/ec2fleet/aws/AWSUtils.java index 27d7065a..e7115a82 100644 --- a/src/main/java/com/amazon/jenkins/ec2fleet/aws/AWSUtils.java +++ b/src/main/java/com/amazon/jenkins/ec2fleet/aws/AWSUtils.java @@ -1,7 +1,9 @@ package com.amazon.jenkins.ec2fleet.aws; +import com.amazon.jenkins.ec2fleet.EC2FleetCloud; import com.amazonaws.ClientConfiguration; import com.amazonaws.retry.PredefinedRetryPolicies; +import com.google.common.base.Joiner; import hudson.ProxyConfiguration; import jenkins.model.Jenkins; @@ -40,6 +42,7 @@ public static ClientConfiguration getClientConfiguration(final String endpoint) proxy = proxyConfig.createProxy(endpoint); } + if (!proxy.equals(Proxy.NO_PROXY) && proxy.address() instanceof InetSocketAddress) { InetSocketAddress address = (InetSocketAddress) proxy.address(); clientConfiguration.setProxyHost(address.getHostName()); @@ -48,6 +51,10 @@ public static ClientConfiguration getClientConfiguration(final String endpoint) clientConfiguration.setProxyUsername(proxyConfig.getUserName()); clientConfiguration.setProxyPassword(proxyConfig.getSecretPassword().getPlainText()); } + if (null != proxyConfig.getNoProxyHost()) { + String[] noProxyParts = proxyConfig.getNoProxyHost().split("[ \t\n,|]+"); + clientConfiguration.setNonProxyHosts(Joiner.on('|').join(noProxyParts)); + } } }