use of hudson.model.Run in project hudson-2.x by hudson.
the class SetBuildDescriptionCommand method run.
protected int run() throws Exception {
Run run = job.getBuildByNumber(number);
run.checkPermission(Run.UPDATE);
if ("=".equals(description)) {
description = channel.call(new Callable<String, IOException>() {
public String call() throws IOException {
return IOUtils.toString(System.in);
}
});
}
run.setDescription(description);
return 0;
}
use of hudson.model.Run in project hudson-2.x by hudson.
the class SetBuildResultCommand method run.
@Override
protected int run() throws Exception {
Run r = getCurrentlyBuilding();
r.getParent().checkPermission(Item.BUILD);
r.setResult(result);
return 0;
}
use of hudson.model.Run in project blueocean-plugin by jenkinsci.
the class AbstractRunImplTest method testArtifactZipFileLink.
@Test
public void testArtifactZipFileLink() throws Exception {
String JOB_NAME = "artifactTest";
FreeStyleProject p = j.createFreeStyleProject(JOB_NAME);
p.getBuildersList().add(new Shell("touch {{a..z},{A..Z},{0..99}}.txt"));
p.getPublishersList().add(new ArtifactArchiver("*"));
Run r = p.scheduleBuild2(0).waitForStart();
r = j.waitForCompletion(r);
Map m = request().get("/organizations/jenkins/pipelines/" + JOB_NAME + "/runs/" + r.getId() + "/").build(Map.class);
Assert.assertEquals(m.get("artifactsZipFile"), "/job/artifactTest/1/artifact/*zip*/archive.zip");
}
use of hudson.model.Run in project blueocean-plugin by jenkinsci.
the class PipelineBaseTest method validatePipeline.
protected void validatePipeline(Job p, Map resp) {
Assert.assertEquals("jenkins", resp.get("organization"));
Assert.assertEquals(p.getName(), resp.get("name"));
Assert.assertEquals(p.getDisplayName(), resp.get("displayName"));
Assert.assertEquals(p.getFullName(), resp.get("fullName"));
Assert.assertEquals(p.getBuildHealth().getScore(), resp.get("weatherScore"));
if (p.getLastSuccessfulBuild() != null) {
Run b = p.getLastSuccessfulBuild();
String s = baseUrl + "/organizations/jenkins/pipelines/" + p.getName() + "/runs/" + b.getId() + "/";
if (p instanceof WorkflowJob && p.getParent() instanceof MultiBranchProject) {
s = baseUrl + "/organizations/jenkins/pipelines/" + ((MultiBranchProject) p.getParent()).getName() + "/branches/" + Util.rawEncode(p.getName()) + "/runs/" + b.getId() + "/";
}
Assert.assertEquals(s, resp.get("lastSuccessfulRun"));
} else {
Assert.assertNull(resp.get("lastSuccessfulRun"));
}
if (p.getLastBuild() != null) {
Run r = p.getLastBuild();
validateRun(r, (Map) resp.get("latestRun"), "FINISHED");
} else {
Assert.assertNull(resp.get("latestRun"));
}
}
use of hudson.model.Run in project blueocean-plugin by jenkinsci.
the class ArtifactContainerImplTest method testArtifact.
//@Test TODO needs viveks input
public void testArtifact() throws Exception {
FreeStyleProject p = j.createFreeStyleProject(JOB_NAME);
p.getBuildersList().add(new Shell("mkdir -p test/me/out; touch test/me/out/{{a..z},{A..Z},{0..99}}.txt"));
p.getPublishersList().add(new ArtifactArchiver("**/*"));
Run r = p.scheduleBuild2(0).waitForStart();
r = j.waitForCompletion(r);
Map artifact = request().get("/organizations/jenkins/pipelines/" + JOB_NAME + "/runs/" + r.getId() + "/artifacts/test%252Fme%252Fout%252F0.txt").build(Map.class);
Assert.assertEquals(100, artifact.size());
}
Aggregations