Search in sources :

Example 1 with Run

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;
}
Also used : Run(hudson.model.Run) Callable(hudson.remoting.Callable)

Example 2 with Run

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;
}
Also used : Run(hudson.model.Run)

Example 3 with Run

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");
}
Also used : Shell(hudson.tasks.Shell) ArtifactArchiver(hudson.tasks.ArtifactArchiver) Run(hudson.model.Run) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) FreeStyleProject(hudson.model.FreeStyleProject) Map(java.util.Map) Test(org.junit.Test)

Example 4 with Run

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"));
    }
}
Also used : Run(hudson.model.Run) WorkflowRun(org.jenkinsci.plugins.workflow.job.WorkflowRun) MultiBranchProject(jenkins.branch.MultiBranchProject) WorkflowMultiBranchProject(org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject) WorkflowJob(org.jenkinsci.plugins.workflow.job.WorkflowJob)

Example 5 with Run

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());
}
Also used : Shell(hudson.tasks.Shell) ArtifactArchiver(hudson.tasks.ArtifactArchiver) Run(hudson.model.Run) FreeStyleProject(hudson.model.FreeStyleProject) Map(java.util.Map)

Aggregations

Run (hudson.model.Run)26 FreeStyleProject (hudson.model.FreeStyleProject)5 Job (hudson.model.Job)5 Test (org.junit.Test)5 Item (hudson.model.Item)4 Shell (hudson.tasks.Shell)4 BlueRun (io.jenkins.blueocean.rest.model.BlueRun)4 Map (java.util.Map)4 WorkflowRun (org.jenkinsci.plugins.workflow.job.WorkflowRun)4 ArtifactArchiver (hudson.tasks.ArtifactArchiver)3 ArrayList (java.util.ArrayList)3 AbstractProject (hudson.model.AbstractProject)2 ViolationsReport (hudson.plugins.violations.ViolationsReport)2 DataSetBuilder (hudson.util.DataSetBuilder)2 IOException (java.io.IOException)2 Nonnull (javax.annotation.Nonnull)2 MultiBranchProject (jenkins.branch.MultiBranchProject)2 Jenkins (jenkins.model.Jenkins)2 WorkflowJob (org.jenkinsci.plugins.workflow.job.WorkflowJob)2 Ancestor (org.kohsuke.stapler.Ancestor)2