use of hudson.EnvVars in project promoted-builds-plugin by jenkinsci.
the class DownstreamPassCondition method isMet.
@Override
public PromotionBadge isMet(PromotionProcess promotionProcess, AbstractBuild<?, ?> build) {
Badge badge = new Badge();
PseudoDownstreamBuilds pdb = build.getAction(PseudoDownstreamBuilds.class);
EnvVars buildEnvironment = new EnvVars(build.getBuildVariables());
OUTER: for (AbstractProject<?, ?> j : getJobList(build.getProject().getParent(), buildEnvironment)) {
for (AbstractBuild<?, ?> b : build.getDownstreamBuilds(j)) {
if (!b.isBuilding()) {
Result r = b.getResult();
if ((r == Result.SUCCESS) || (evenIfUnstable && r == Result.UNSTABLE)) {
badge.add(b);
continue OUTER;
}
}
}
if (pdb != null) {
// if fingerprint doesn't have any, try the pseudo-downstream
for (AbstractBuild<?, ?> b : pdb.listBuilds(j)) {
if (!b.isBuilding()) {
Result r = b.getResult();
if ((r == Result.SUCCESS) || (evenIfUnstable && r == Result.UNSTABLE)) {
badge.add(b);
continue OUTER;
}
}
}
}
// none of the builds of this job passed.
return null;
}
return badge;
}
use of hudson.EnvVars in project pipeline-aws-plugin by jenkinsci.
the class ProxyTest method shouldParseProxyWithAuth.
@Test
public void shouldParseProxyWithAuth() throws Exception {
EnvVars vars = new EnvVars();
vars.put(ProxyConfiguration.HTTPS_PROXY, "http://foo:bar@127.0.0.1:8888/");
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(Protocol.HTTPS);
ProxyConfiguration.configure(vars, config);
Assert.assertEquals("foo", config.getProxyUsername());
Assert.assertEquals("bar", config.getProxyPassword());
Assert.assertEquals("127.0.0.1", config.getProxyHost());
Assert.assertEquals(8888, config.getProxyPort());
}
use of hudson.EnvVars in project pipeline-aws-plugin by jenkinsci.
the class ProxyTest method shouldParseProxy.
@Test
public void shouldParseProxy() throws Exception {
EnvVars vars = new EnvVars();
vars.put(ProxyConfiguration.HTTPS_PROXY, "http://127.0.0.1:8888/");
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(Protocol.HTTPS);
ProxyConfiguration.configure(vars, config);
Assert.assertNull(config.getProxyUsername());
Assert.assertNull(config.getProxyPassword());
Assert.assertEquals("127.0.0.1", config.getProxyHost());
Assert.assertEquals(8888, config.getProxyPort());
}
use of hudson.EnvVars in project pipeline-aws-plugin by jenkinsci.
the class ProxyTest method shouldNotChangeIfNotPresent.
@Test
public void shouldNotChangeIfNotPresent() throws Exception {
ClientConfiguration config = new ClientConfiguration();
config.setProtocol(Protocol.HTTPS);
ProxyConfiguration.configure(new EnvVars(), config);
Assert.assertNull(config.getProxyUsername());
Assert.assertNull(config.getProxyPassword());
Assert.assertNull(config.getProxyHost());
Assert.assertEquals(-1, config.getProxyPort());
}
use of hudson.EnvVars in project pipeline-aws-plugin by jenkinsci.
the class EBTestingUtils method setupStepContext.
static StepContext setupStepContext() throws Exception {
StepContext context = Mockito.mock(StepContext.class);
TaskListener listener = Mockito.mock(TaskListener.class);
Mockito.when(listener.getLogger()).thenReturn(Mockito.mock(PrintStream.class));
Mockito.when(context.get(TaskListener.class)).thenReturn(listener);
Mockito.when(context.get(EnvVars.class)).thenReturn(new EnvVars());
return context;
}
Aggregations