Package org.jenkinsci.plugins.workflow.job

Examples of org.jenkinsci.plugins.workflow.job.WorkflowJob.scheduleBuild2()


                        ");",
                        "echo 'NotHere'",
                    "}",
                    "echo 'NotHere'",
                "}")));
        WorkflowRun b = r.assertBuildStatus(Result.FAILURE, p.scheduleBuild2(0).get());

        // make sure things that are supposed to run do, and things that are NOT supposed to run do not.
        r.assertLogNotContains("NotHere", b);
        r.assertLogContains("ShouldBeHere1",b);
        r.assertLogContains("ShouldBeHere2", b);
View Full Code Here


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


                              QueueTaskFuture<WorkflowRun> q = foo.scheduleBuild2(0);
                              WorkflowRun b = q.getStartCondition().get();
                              CpsFlowExecution e = (CpsFlowExecution) b.getExecutionPromise().get();
                              e.waitForSuspension();
                              assertEquals(1, story.j.jenkins.getQueue().getItems().length);
                          }
View Full Code Here

            "    ws {\n" +
            "        git(url: '" + sampleRepo + "', poll: false, changelog: false)\n" +
            "        sh 'for f in *; do echo PRESENT: $f; done'\n" +
            "    }\n" +
            "}"));
        WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
        r.assertLogContains("Cloning the remote Git repository", b); // GitSCM.retrieveChanges
        r.assertLogContains("PRESENT: file", b);
        FileUtils.touch(new File(sampleRepo, "nextfile"));
        git(sampleRepo, "add", "nextfile");
        git(sampleRepo, "commit", "--message=next");
View Full Code Here

        r.assertLogContains("Cloning the remote Git repository", b); // GitSCM.retrieveChanges
        r.assertLogContains("PRESENT: file", b);
        FileUtils.touch(new File(sampleRepo, "nextfile"));
        git(sampleRepo, "add", "nextfile");
        git(sampleRepo, "commit", "--message=next");
        b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
        r.assertLogContains("Fetching changes from the remote Git repository", b); // GitSCM.retrieveChanges
        r.assertLogContains("PRESENT: nextfile", b);
    }

    @Test public void changelogAndPolling() throws Exception {
View Full Code Here

    @Test public void build() throws Exception {
        Maven.MavenInstallation tool = r.configureMaven3();
        String name = tool.getName();
        WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
        p.setDefinition(new CpsFlowDefinition("node {def home = tool '" + name + "'; sh \"${home}/bin/mvn -version\"}"));
        r.assertLogContains("Apache Maven 3", r.assertBuildStatusSuccess(p.scheduleBuild2(0)));
    }

}
View Full Code Here

            "node('remote') {\n" +
            "    ws {\n" +
            "        git(url: '" + sampleRepo + "')\n" +
            "    }\n" +
            "}"));
        WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
        r.assertLogContains("Cloning the remote Git repository", b);
        FileUtils.touch(new File(sampleRepo, "nextfile"));
        git(sampleRepo, "add", "nextfile");
        git(sampleRepo, "commit", "--message=next");
        System.out.println(r.createWebClient().goTo("git/notifyCommit?url=" + URLEncoder.encode(sampleRepo.getAbsolutePath(), "UTF-8"), "text/plain").getWebResponse().getContentAsString());
View Full Code Here

            "            git(url: '" + otherRepo + "')\n" +
            "        }\n" +
            "        sh 'for f in */*; do echo PRESENT: $f; done'\n" +
            "    }\n" +
            "}"));
        WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
        r.assertLogContains("PRESENT: main/file", b);
        r.assertLogContains("PRESENT: other/otherfile", b);
        FileUtils.touch(new File(sampleRepo, "file2"));
        git(sampleRepo, "add", "file2");
        git(sampleRepo, "commit", "--message=file2");
View Full Code Here

            "            svn(url: '" + otherRepoU + "')\n" +
            "        }\n" +
            "        sh 'for f in */*; do echo PRESENT: $f; done'\n" +
            "    }\n" +
            "}"));
        WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
        r.assertLogContains("PRESENT: main/file", b);
        r.assertLogContains("PRESENT: other/otherfile", b);
        FileUtils.touch(new File(sampleWc, "file2"));
        run(sampleWc, "svn", "add", "file2");
        run(sampleWc, "svn", "commit", "--message=+file2");
View Full Code Here

                "}"
        ), "\n")));


        // get the build going, and wait until workflow pauses
        WorkflowRun b = j.assertBuildStatus(Result.FAILURE, foo.scheduleBuild2(0).get());

        boolean found = false;
        FlowGraphTable t = new FlowGraphTable(b.getExecution());
        t.build();
        for (Row r : t.getRows()) {
View Full Code Here

                "  sh 'while true; do touch "+tmp+"; sleep 1; done'",
                "}"
        ), "\n")));

        // get the build going, and wait until workflow pauses
        WorkflowRun b = foo.scheduleBuild2(0).getStartCondition().get();
        CpsFlowExecution e = (CpsFlowExecution) b.getExecutionPromise().get();
        e.waitForSuspension();

        // at this point the file should be being touched
        waitForCond(5000, tmp, new Predicate<File>() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.