Search in sources :

Example 66 with EnvVars

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;
}
Also used : EnvVars(hudson.EnvVars) AbstractBuild(hudson.model.AbstractBuild) PromotionBadge(hudson.plugins.promoted_builds.PromotionBadge) AbstractProject(hudson.model.AbstractProject) Result(hudson.model.Result)

Example 67 with EnvVars

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());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 68 with EnvVars

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());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 69 with EnvVars

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());
}
Also used : EnvVars(hudson.EnvVars) ClientConfiguration(com.amazonaws.ClientConfiguration) Test(org.junit.Test)

Example 70 with EnvVars

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;
}
Also used : PrintStream(java.io.PrintStream) StepContext(org.jenkinsci.plugins.workflow.steps.StepContext) EnvVars(hudson.EnvVars) TaskListener(hudson.model.TaskListener)

Aggregations

EnvVars (hudson.EnvVars)72 Test (org.junit.Test)25 IOException (java.io.IOException)17 FilePath (hudson.FilePath)11 TaskListener (hudson.model.TaskListener)9 AbortException (hudson.AbortException)8 ClientConfiguration (com.amazonaws.ClientConfiguration)7 ArrayList (java.util.ArrayList)6 HashMap (java.util.HashMap)6 Computer (hudson.model.Computer)5 FreeStyleProject (hudson.model.FreeStyleProject)5 ArgumentListBuilder (hudson.util.ArgumentListBuilder)5 ParameterValue (hudson.model.ParameterValue)4 HashSet (java.util.HashSet)4 Map (java.util.Map)4 Step (org.jenkinsci.plugins.workflow.steps.Step)4 ConduitAPIClient (com.uber.jenkins.phabricator.conduit.ConduitAPIClient)3 ConduitAPIException (com.uber.jenkins.phabricator.conduit.ConduitAPIException)3 Differential (com.uber.jenkins.phabricator.conduit.Differential)3 DifferentialClient (com.uber.jenkins.phabricator.conduit.DifferentialClient)3