use of hudson.tasks.Shell in project hudson-2.x by hudson.
the class CopyOnWriteListEqualsHashCodeTest method setUp.
@Before
public void setUp() {
data1 = new ArrayList<Builder>();
data1.add(new Shell("echo 'test'"));
data1.add(new Shell("echo 'test1'"));
data1.add(new Shell("echo 'test2'"));
data2 = new ArrayList<Builder>();
data2.add(new Shell("echo 'test1'"));
data2.add(new Shell("echo 'test'"));
}
use of hudson.tasks.Shell in project promoted-builds-plugin by jenkinsci.
the class PromotionProcessTest method testPromotionWithoutFingerprint.
/**
* Tests a promotion induced by the pseudo upstream/downstream cause relationship
*/
public void testPromotionWithoutFingerprint() throws Exception {
FreeStyleProject up = createFreeStyleProject("up");
FreeStyleProject down = createFreeStyleProject();
// promote if the downstream passes
JobPropertyImpl promotion = new JobPropertyImpl(up);
up.addProperty(promotion);
PromotionProcess proc = promotion.addProcess("promo");
proc.conditions.add(new DownstreamPassCondition(down.getName()));
// trigger downstream automatically to create relationship
up.getPublishersList().add(new BuildTrigger(down.getName(), Result.SUCCESS));
hudson.rebuildDependencyGraph();
// this is the downstream job
down.getBuildersList().add(new Shell(// expr exits with non-zero status if result is zero
"expr $BUILD_NUMBER % 2 - 1\n"));
// not yet promoted while the downstream is failing
FreeStyleBuild up1 = assertBuildStatusSuccess(up.scheduleBuild2(0).get());
waitForCompletion(down, 1);
assertEquals(0, proc.getBuilds().size());
// do it one more time and this time it should work
FreeStyleBuild up2 = assertBuildStatusSuccess(up.scheduleBuild2(0).get());
waitForCompletion(down, 2);
assertEquals(1, proc.getBuilds().size());
{
// verify that it promoted the right stuff
Promotion pb = proc.getBuilds().get(0);
assertSame(pb.getTarget(), up2);
PromotedBuildAction badge = (PromotedBuildAction) up2.getBadgeActions().get(0);
assertTrue(badge.contains(proc));
}
}
use of hudson.tasks.Shell in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getFreeStyleJobTest.
@Test
public void getFreeStyleJobTest() throws Exception {
Project p1 = j.createFreeStyleProject("pipeline1");
Project p2 = j.createFreeStyleProject("pipeline2");
p1.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
FreeStyleBuild b = (FreeStyleBuild) p1.scheduleBuild2(0).get();
j.assertBuildStatusSuccess(b);
List<Map> resp = get("/organizations/jenkins/pipelines/", List.class);
Project[] projects = { p1, p2 };
assertEquals(projects.length, resp.size());
for (int i = 0; i < projects.length; i++) {
Map p = resp.get(i);
validatePipeline(projects[i], p);
}
}
use of hudson.tasks.Shell in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method findPipelineRunsForAPipelineTest.
@Test
public void findPipelineRunsForAPipelineTest() throws Exception {
FreeStyleProject p1 = j.createFreeStyleProject("pipeline1");
FreeStyleProject p2 = j.createFreeStyleProject("pipeline2");
p1.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
p2.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
Stack<FreeStyleBuild> builds = new Stack<FreeStyleBuild>();
FreeStyleBuild b11 = p1.scheduleBuild2(0).get();
FreeStyleBuild b12 = p1.scheduleBuild2(0).get();
builds.push(b11);
builds.push(b12);
j.assertBuildStatusSuccess(b11);
j.assertBuildStatusSuccess(b12);
List<Map> resp = get("/search?q=type:run;organization:jenkins;pipeline:pipeline1", List.class);
assertEquals(builds.size(), resp.size());
for (int i = 0; i < builds.size(); i++) {
Map p = resp.get(i);
FreeStyleBuild b = builds.pop();
validateRun(b, p);
}
}
use of hudson.tasks.Shell in project blueocean-plugin by jenkinsci.
the class PipelineApiTest method getPipelineRunLatestTest.
@Test
public void getPipelineRunLatestTest() throws Exception {
FreeStyleProject p = j.createFreeStyleProject("pipeline5");
p.getBuildersList().add(new Shell("echo hello!\nsleep 1"));
FreeStyleBuild b = p.scheduleBuild2(0).get();
j.assertBuildStatusSuccess(b);
List<Map> resp = get("/search?q=type:run;organization:jenkins;pipeline:pipeline5;latestOnly:true", List.class);
Run[] run = { b };
assertEquals(run.length, resp.size());
for (int i = 0; i < run.length; i++) {
Map lr = resp.get(i);
validateRun(run[i], lr);
}
}
Aggregations