Package hudson.tasks

Examples of hudson.tasks.Shell


    public JenkinsRule j = new JenkinsRule();

    @Test
    public void buildTopLevelProject() throws Exception {
        FreeStyleProject p = j.createFreeStyleProject("test1");
        p.getBuildersList().add(new Shell("echo 'Hello World'"));


        WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo");
        foo.setDefinition(new CpsFlowDefinition(StringUtils.join(Arrays.asList("build('test1');"), "\n")));
View Full Code Here


    @SuppressWarnings("deprecation")
    @Test
    public void buildFolderProject() throws Exception {
        MockFolder dir1 = j.createFolder("dir1");
        FreeStyleProject downstream = dir1.createProject(FreeStyleProject.class, "downstream");
        downstream.getBuildersList().add(new Shell("echo 'Hello World'"));

        MockFolder dir2 = j.createFolder("dir2");
        WorkflowJob upstream = dir2.createProject(WorkflowJob.class, "upstream");
        upstream.setDefinition(new CpsFlowDefinition("build '../dir1/downstream'"));
View Full Code Here


    @Test
    public void buildParallelTests() throws Exception {
        FreeStyleProject p1 = j.createFreeStyleProject("test1");
        p1.getBuildersList().add(new Shell("echo 'Hello World'"));

        FreeStyleProject p2 = j.createFreeStyleProject("test2");
        p2.getBuildersList().add(new Shell("echo 'Hello World'"));




        WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo");
View Full Code Here


    @Test
    public void abortBuild() throws Exception {
        FreeStyleProject p = j.createFreeStyleProject("test1");
        p.getBuildersList().add(new Shell("sleep 6000"));

        WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo");
        foo.setDefinition(new CpsFlowDefinition(StringUtils.join(Arrays.asList("build('test1');"), "\n")));

        QueueTaskFuture<WorkflowRun> q = foo.scheduleBuild2(0);
View Full Code Here

    }

    @Test
    public void cancelBuildQueue() throws Exception {
        FreeStyleProject p = j.createFreeStyleProject("test1");
        p.getBuildersList().add(new Shell("sleep 6000"));

        WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo");
        foo.setDefinition(new CpsFlowDefinition(StringUtils.join(Arrays.asList("build('test1');"), "\n")));

        j.jenkins.setNumExecutors(0); //should force freestyle build to remain in the queue?
View Full Code Here

    @Test public void parameters() throws Exception {
        WorkflowJob us = j.jenkins.createProject(WorkflowJob.class, "us");
        FreeStyleProject ds = j.jenkins.createProject(FreeStyleProject.class, "ds");
        ds.addProperty(new ParametersDefinitionProperty(new StringParameterDefinition("branch", "master"), new BooleanParameterDefinition("extra", false, null)));
        ds.getBuildersList().add(new Shell("echo branch=$branch extra=$extra"));
        us.setDefinition(new CpsFlowDefinition("build 'ds'"));
        WorkflowRun us1 = j.assertBuildStatusSuccess(us.scheduleBuild2(0));
        FreeStyleBuild ds1 = ds.getBuildByNumber(1);
        j.assertLogContains("branch=master extra=false", ds1);
        Cause.UpstreamCause cause = ds1.getCause(Cause.UpstreamCause.class);
View Full Code Here

  public void testFailingWfRun() throws Exception{
    FreeStyleProject launcher = createFreeStyleProject("launcher");
        DescribableList<Builder,Descriptor<Builder>> bl = launcher.getBuildersList();
    // TODO 4: if we have a way a script task can print into the job console, we no longer need the Shell build step
        bl.add(new JenkowBuilder(getWfName("workflow")));
    bl.add(new Shell("echo wf.done"));
       
        FreeStyleBuild build = launcher.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName()+" completed");
       
        System.out.println("build.getResult() -> "+build.getResult());
View Full Code Here

public class ActualTest extends JenkowTestCase{

  public void testExecLogger() throws Exception{
    FreeStyleProject launchy = createFreeStyleProject("launchy");
        launchy.getBuildersList().add(new Shell("echo \"launchy running\"; sleep 1; exit 0"));
       
    FreeStyleProject launcher = createFreeStyleProject("launcher");
        DescribableList<Builder,Descriptor<Builder>> bl = launcher.getBuildersList();
    // TODO 4: if we have a way a script task can print into the job console, we no longer need the Shell build step
        bl.add(new JenkowBuilder(getWfName("workflow")));
View Full Code Here

public class ActualTest extends JenkowTestCase{

  public void testSimpleWfCallsJob() throws Exception{
    FreeStyleProject launchy = createFreeStyleProject("launchy");
        launchy.getBuildersList().add(new Shell("echo \"launchy running\"; exit 0"));
       
    FreeStyleProject launcher = createFreeStyleProject("launcher");
        DescribableList<Builder,Descriptor<Builder>> bl = launcher.getBuildersList();
    // TODO 4: if we have a way a script task can print into the job console, we no longer need the Shell build step
        bl.add(new JenkowBuilder(getWfName("workflow")));
    bl.add(new Shell("echo wf.done"));
       
        FreeStyleBuild build = launcher.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName()+" completed");

        String s = FileUtils.readFileToString(build.getLogFile());
View Full Code Here

public class ActualTest extends JenkowTestCase{

  public void testJobResultConsumption() throws Exception{
    FreeStyleProject launchy = createFreeStyleProject("launchy");
        launchy.getBuildersList().add(new Shell("echo \"launchy running\"; sleep 5; exit $((BUILD_NUMBER%2!=0))"));
       
    FreeStyleProject launcher = createFreeStyleProject("launcher");
        DescribableList<Builder,Descriptor<Builder>> bl = launcher.getBuildersList();
    // TODO 4: if we have a way a script task can print into the job console, we no longer need the Shell build step
        bl.add(new JenkowBuilder(getWfName("workflow")));
    bl.add(new Shell("echo wf.done"));
       
        FreeStyleBuild build = launcher.scheduleBuild2(0).get();
        System.out.println(build.getDisplayName()+" completed");
       
        assertTrue("launchy's last build # is not 2",launchy.getLastBuild().getNumber() == 2);
View Full Code Here

TOP

Related Classes of hudson.tasks.Shell

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.