当前位置: 首页>>代码示例>>Java>>正文


Java WorkflowJob.scheduleBuild2方法代码示例

本文整理汇总了Java中org.jenkinsci.plugins.workflow.job.WorkflowJob.scheduleBuild2方法的典型用法代码示例。如果您正苦于以下问题:Java WorkflowJob.scheduleBuild2方法的具体用法?Java WorkflowJob.scheduleBuild2怎么用?Java WorkflowJob.scheduleBuild2使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.jenkinsci.plugins.workflow.job.WorkflowJob的用法示例。


在下文中一共展示了WorkflowJob.scheduleBuild2方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: subscribeProject

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
protected void subscribeProject(ProjectFixture fixture) throws Exception {
    String name = UUID.randomUUID().toString();
    WorkflowJob job = jenkinsRule.getInstance().createProject(WorkflowJob.class, name);

    String script = fixture.getPipelineScript().replace("${EmitEvent}", AbstractPipelineIT.class.getName() + ".emitBuildEvent()");
    CpsFlowDefinition flowDefinition = new CpsFlowDefinition(script, true);
    job.setDefinition(flowDefinition);

    QueueTaskFuture<WorkflowRun> run = job.scheduleBuild2(0);
    jenkinsRule.assertBuildStatusSuccess(run.get());

    resetPipelineBuildEvent(fixture);

    if (!fixture.isHasTrigger()) {
        return;
    }

    final String uuid = this.sqsQueue.getUuid();
    SQSTrigger trigger = new SQSTrigger(uuid, fixture.isSubscribeInternalScm(), fixture.getScmConfigs());
    job.addTrigger(trigger);
    trigger.start(job, false);
}
 
开发者ID:riboseinc,项目名称:aws-codecommit-trigger-plugin,代码行数:23,代码来源:AbstractPipelineIT.java

示例2: createWorkflowJobAndRun

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
private static WorkflowRun createWorkflowJobAndRun(String jobName) throws Exception {
    WorkflowJob job = j.jenkins.createProject(WorkflowJob.class, jobName);
    job.setDefinition(new CpsFlowDefinition(format("exwsAllocate diskPoolId: '%s'", DISK_POOL_ID)));
    Future<WorkflowRun> runFuture = job.scheduleBuild2(0, new CauseAction(new Cause.UserIdCause()));
    assertThat(runFuture, notNullValue());

    return runFuture.get();
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:9,代码来源:DiskPoolRestrictionTest.java

示例3: runWorkflowJob

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
private WorkflowRun runWorkflowJob(WorkflowJob job) throws ExecutionException, InterruptedException {
    QueueTaskFuture<WorkflowRun> runFuture = job.scheduleBuild2(0);
    assertThat(runFuture, notNullValue());
    run = runFuture.get();

    return run;
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:8,代码来源:ExwsStepTest.java

示例4: createWorkflowJobAndRun

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
public static WorkflowRun createWorkflowJobAndRun(Jenkins jenkins, String script) throws Exception {
    WorkflowJob job = jenkins.createProject(WorkflowJob.class, RandomStringUtils.randomAlphanumeric(7));
    job.setDefinition(new CpsFlowDefinition(script));
    QueueTaskFuture<WorkflowRun> runFuture = job.scheduleBuild2(0);
    assertThat(runFuture, notNullValue());

    return runFuture.get();
}
 
开发者ID:jenkinsci,项目名称:external-workspace-manager-plugin,代码行数:9,代码来源:TestUtil.java

示例5: createWorkflowJobAndRun

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
private static WorkflowRun createWorkflowJobAndRun(String script) throws Exception {
    WorkflowJob job = j.jenkins.createProject(WorkflowJob.class, RandomStringUtils.randomAlphanumeric(7));
    job.setDefinition(new CpsFlowDefinition(script));
    QueueTaskFuture<WorkflowRun> runFuture = job.scheduleBuild2(0);
    assertThat(runFuture, notNullValue());

    return runFuture.get();
}
 
开发者ID:jenkinsci,项目名称:run-selector-plugin,代码行数:9,代码来源:SelectRunStepTest.java

示例6: verify_downstream_multi_branch_pipeline_trigger

import org.jenkinsci.plugins.workflow.job.WorkflowJob; //导入方法依赖的package包/类
/**
 * The maven-war-app has a dependency on the maven-jar-app
 */
@Test
public void verify_downstream_multi_branch_pipeline_trigger() throws Exception {
    System.out.println("gitRepoRule: " + gitRepoRule);
    loadMavenJarProjectInGitRepo(this.gitRepoRule);
    System.out.println("downstreamArtifactRepoRule: " + downstreamArtifactRepoRule);
    loadMavenWarProjectInGitRepo(this.downstreamArtifactRepoRule);

    String script = "node('master') {\n" +
            "    checkout scm\n" +
            "    withMaven() {\n" +
            "        sh 'mvn install'\n" +
            "    }\n" +
            "}";
    gitRepoRule.write("Jenkinsfile", script);
    gitRepoRule.git("add", "Jenkinsfile");
    gitRepoRule.git("commit", "--message=jenkinsfile");


    downstreamArtifactRepoRule.write("Jenkinsfile", script);
    downstreamArtifactRepoRule.git("add", "Jenkinsfile");
    downstreamArtifactRepoRule.git("commit", "--message=jenkinsfile");

    // TRIGGER maven-jar#1 to record that "build-maven-jar" generates this jar and install this maven jar in the local maven repo
    WorkflowMultiBranchProject mavenJarPipeline = jenkinsRule.createProject(WorkflowMultiBranchProject.class, "build-maven-jar");
    mavenJarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    mavenJarPipeline.getSourcesList().add(new BranchSource(new GitSCMSource(null, gitRepoRule.toString(), "", "*", "", false)));
    System.out.println("trigger maven-jar#1...");
    WorkflowJob mavenJarPipelineMasterPipeline = WorkflowMultibranchProjectTestsUtils.scheduleAndFindBranchProject(mavenJarPipeline, "master");
    assertEquals(1, mavenJarPipeline.getItems().size());
    System.out.println("wait for maven-jar#1...");
    jenkinsRule.waitUntilNoActivity();

    assertThat(mavenJarPipelineMasterPipeline.getLastBuild().getNumber(), is(1));
    // TODO check in DB that the generated artifact is recorded

    // TRIGGER maven-war#1 to record that "build-maven-war" has a dependency on "build-maven-jar"
    WorkflowMultiBranchProject mavenWarPipeline = jenkinsRule.createProject(WorkflowMultiBranchProject.class, "build-maven-war");
    mavenWarPipeline.addTrigger(new WorkflowJobDependencyTrigger());
    mavenWarPipeline.getSourcesList().add(new BranchSource(new GitSCMSource(null, downstreamArtifactRepoRule.toString(), "", "*", "", false)));
    System.out.println("trigger maven-war#1...");
    WorkflowJob mavenWarPipelineMasterPipeline = WorkflowMultibranchProjectTestsUtils.scheduleAndFindBranchProject(mavenWarPipeline, "master");
    assertEquals(1, mavenWarPipeline.getItems().size());
    System.out.println("wait for maven-war#1...");
    jenkinsRule.waitUntilNoActivity();
    WorkflowRun mavenWarPipelineFirstRun = mavenWarPipelineMasterPipeline.getLastBuild();

    // TODO check in DB that the dependency on the war project is recorded


    // TRIGGER maven-jar#2 so that it triggers "maven-war" and creates maven-war#2
    System.out.println("trigger maven-jar#2...");
    Future<WorkflowRun> mavenJarPipelineMasterPipelineSecondRunFuture = mavenJarPipelineMasterPipeline.scheduleBuild2(0, new CauseAction(new Cause.RemoteCause("127.0.0.1", "junit test")));
    System.out.println("wait for maven-jar#2...");
    mavenJarPipelineMasterPipelineSecondRunFuture.get();
    jenkinsRule.waitUntilNoActivity();


    WorkflowRun mavenWarPipelineLastRun = mavenWarPipelineMasterPipeline.getLastBuild();

    System.out.println("mavenWarPipelineLastBuild: " + mavenWarPipelineLastRun + " caused by " + mavenWarPipelineLastRun.getCauses());

    assertThat(mavenWarPipelineLastRun.getNumber(), is(mavenWarPipelineFirstRun.getNumber() + 1));
    Cause.UpstreamCause upstreamCause = mavenWarPipelineLastRun.getCause(Cause.UpstreamCause.class);
    assertThat(upstreamCause, notNullValue());

}
 
开发者ID:jenkinsci,项目名称:pipeline-maven-plugin,代码行数:70,代码来源:DependencyGraphTest.java


注:本文中的org.jenkinsci.plugins.workflow.job.WorkflowJob.scheduleBuild2方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。