• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java FlowNode类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.jenkinsci.plugins.workflow.graph.FlowNode的典型用法代码示例。如果您正苦于以下问题:Java FlowNode类的具体用法?Java FlowNode怎么用?Java FlowNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

FlowNode类属于org.jenkinsci.plugins.workflow.graph包,在下文中一共展示了FlowNode类的40个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: junitResultArchiver

点赞 4

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void junitResultArchiver() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
              "node {\n"
            + "    writeFile text: '''<testsuite name='a'><testcase name='a1'/><testcase name='a2'><error>a2 failed</error></testcase></testsuite>''', file: 'a.xml'\n"
            + "    writeFile text: '''<testsuite name='b'><testcase name='b1'/><testcase name='b2'/></testsuite>''', file: 'b.xml'\n"
            + "    junit '*.xml'\n"
            + "}", true));
    WorkflowRun b = r.assertBuildStatus(Result.UNSTABLE, p.scheduleBuild2(0).get());
    TestResultAction a = b.getAction(TestResultAction.class);
    assertNotNull(a);
    assertEquals(4, a.getTotalCount());
    assertEquals(1, a.getFailCount());
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("step"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("*.xml", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:18,
代码来源:CoreStepTest.java

示例2: smokes

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void smokes() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("echo 'hello there'", true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    List<LogAction> logActions = new ArrayList<LogAction>();
    for (FlowNode n : new FlowGraphWalker(b.getExecution())) {
        LogAction la = n.getAction(LogAction.class);
        if (la != null) {
            logActions.add(la);
        }
    }
    assertEquals(1, logActions.size());
    StringWriter w = new StringWriter();
    logActions.get(0).getLogText().writeLogTo(0, w);
    assertEquals("hello there", w.toString().trim());
    Matcher m = Pattern.compile("hello there").matcher(JenkinsRule.getLog(b));
    assertTrue("message printed once", m.find());
    assertFalse("message not printed twice", m.find());
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:20,
代码来源:EchoStepTest.java

示例3: argumentsToString

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Issue("JENKINS-45101")
@Test public void argumentsToString() throws Exception {
    story.addStep(new Statement() {
        @Override public void evaluate() throws Throwable {
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
            p.setDefinition(new CpsFlowDefinition(
                "node {\n" +
                 "    wrap([$class: 'AnsiColorBuildWrapper', colorMapName: 'xterm']) {}\n" +
                 "}", true));
            WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
            List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), Predicates.and(new NodeStepTypePredicate("wrap"), new Predicate<FlowNode>() {
                @Override public boolean apply(FlowNode n) {
                    return n instanceof StepStartNode && !((StepStartNode) n).isBody();
                }
            }));
            assertThat(coreStepNodes, Matchers.hasSize(1));
            assertEquals("xterm", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
        }
    });
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:21,
代码来源:CoreWrapperStepTest.java

示例4: basics

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void basics() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    boolean win = Functions.isWindows();
    p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
            (win ? "  bat 'echo hello > f1'\n" : "  sh 'echo hello > f1'\n") +
            "  def text = readFile 'f1'\n" +
            "  text = text.toUpperCase()\n" +
            "  writeFile file: 'f2', text: text\n" +
            (win ? "  bat 'type f2'\n" : "  sh 'cat f2'\n") +
            "}", true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    r.assertLogContains("HELLO", b);
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("writeFile"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("f2", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:18,
代码来源:ReadWriteFileStepTest.java

示例5: test_send

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test
public void test_send() throws Exception {
    Mailbox.clearAll();

    WorkflowJob job = r.jenkins.createProject(WorkflowJob.class, "workflow");
    job.setDefinition(new CpsFlowDefinition("mail(to: '[email protected]', subject: 'Hello friend', body: 'Missing you!');", true));

    WorkflowRun b = r.assertBuildStatusSuccess(job.scheduleBuild2(0));
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("mail"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("Hello friend", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));

    Mailbox mailbox = Mailbox.get("[email protected]");
    Assert.assertEquals(1, mailbox.getNewMessageCount());
    Message message = mailbox.get(0);
    Assert.assertEquals("Hello friend", message.getSubject());
    Assert.assertEquals("Missing you!", ((MimeMultipart)message.getContent()).getBodyPart(0).getContent().toString());

}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:20,
代码来源:MailStepTest.java

示例6: build

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void build() throws Exception {
    Maven.MavenInstallation tool = ToolInstallations.configureMaven3();
    String name = tool.getName();
    Maven.MavenInstallation.DescriptorImpl desc = Jenkins.getInstance().getDescriptorByType(Maven.MavenInstallation.DescriptorImpl.class);

    // Defensive - Maven doesn't have a symbol before 2.x, and other tools may still not have symbols after that.
    String type = desc.getId();

    Set<String> symbols = SymbolLookup.getSymbolValue(desc);

    if (!symbols.isEmpty()) {
        type = symbols.iterator().next();
    }

    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("node {def home = tool name: '" + name + "', type: '" + type + "'; def settings = readFile($/$home/conf/settings.xml/$).split(); echo settings[-1]}",
            true));

    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    r.assertLogContains("</settings>", b);
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("tool"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals(name, ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:25,
代码来源:ToolStepTest.java

示例7: testAllowEmpty

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Issue("JENKINS-37327")
@Test public void testAllowEmpty() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
            "node {\n" +
                    "  stash name: 'whatever', allowEmpty: true\n" +
                    "  semaphore 'ending'\n" +
                    "}\n"
                    , true));
    WorkflowRun b = p.scheduleBuild2(0).waitForStart();
    SemaphoreStep.waitForStart("ending/1", b);
    assertEquals("{whatever={}}", StashManager.stashesOf(b).toString());
    SemaphoreStep.success("ending/1", null);
    r.assertBuildStatusSuccess(r.waitForCompletion(b));
    r.assertLogContains("Stashed 0 file(s)", b);
    assertEquals("{}", StashManager.stashesOf(b).toString());
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("stash"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("whatever", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:21,
代码来源:StashTest.java

示例8: onNewHead

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Override
public void onNewHead(FlowNode node) {
    if (isNamedStageStartNode(node)) {
        publishBuildStatus(build, metadata, running, getRunningContexts().push(node), "");
    } else if (isStageEndNode(node, getRunningContexts().peekNodeId())) {
        ErrorAction error = node.getError();
        if (error != null) {
            if (error.getError() instanceof FlowInterruptedException) {
                publishBuildStatus(build, metadata, canceled, getRunningContexts().pop(), "");
            } else {
                publishBuildStatus(build, metadata, failed, getRunningContexts().pop(), "");
            }
        } else {
            publishBuildStatus(build, metadata, success, getRunningContexts().pop(), "");
        }
    }
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:18,
代码来源:GitLabSCMPublishAction.java

示例9: createStageDTO

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static StageDTO createStageDTO(FlowNode node) {
    if (node != null) {
        StageAction action = node.getAction(StageAction.class);
        if (action != null) {
            String url = FlowNodes.getNodeUrlOrNull(node);
            long startTime = TimingAction.getStartTime(node);
            ErrorDTO error = ErrorDTO.createErrorDTO(node);
            FlowNode endNode = FlowNodes.getNextStageNode(node);
            long duration = FlowNodes.getDuration(node, endNode);
            if (endNode == null) {
                endNode = node;
            }
            StatusDTO status = StatusDTO.valueOf(endNode);
            return new StageDTO(node.getId(), url, action.getStageName(), startTime, status, error, duration);
        }
    }
    return null;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:19,
代码来源:StageDTO.java

示例10: createNodeDTO

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static NodeDTO createNodeDTO(FlowNode node) {
    if (node != null) {
        String url = FlowNodes.getNodeUrlOrNull(node);
        long startTime = TimingAction.getStartTime(node);
        ErrorDTO error = ErrorDTO.createErrorDTO(node);
        FlowNode endNode = FlowNodes.getNextNode(node);
        long duration = 0;
        if (endNode != null) {
            duration = FlowNodes.getDuration(node, endNode);
        } else {
            endNode = node;
        }
        StatusDTO status = StatusDTO.valueOf(endNode);
        return new NodeDTO(node.getId(), url, startTime, status, error, duration);
    }
    return null;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:18,
代码来源:NodeDTO.java

示例11: getNextStageNode

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static FlowNode getNextStageNode(FlowNode node) {
    List<FlowNode> list = getSortedFlowNodes(node.getExecution());
    if (list.isEmpty()) {
        return null;
    }
    int idx = list.indexOf(node);
    if (idx >= 0) {
        for (int i = idx + 1; i < list.size(); i++) {
            FlowNode flowNode = list.get(i);
            if (isStageNode(flowNode)) {
                return flowNode;
            }
        }
    }
    // lets return the last node
    return list.get(list.size() - 1);
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:18,
代码来源:FlowNodes.java

示例12: getSortedStageNodes

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static List<FlowNode> getSortedStageNodes(final List<FlowNode> flowNodes) {
    final List<FlowNode> answer = new ArrayList<FlowNode>();
    forEach(flowNodes, new Callback<FlowNode>() {
        @Override
        public void invoke(FlowNode node) {
            if (isStageNode(node)) {
                for (FlowNode old : answer) {
                    if (Objects.equal(old.getId(), node.getId())) {
                        // already added
                        return;
                    }
                }
                answer.add(node);
            }
        }
    });
    sortInNodeIdOrder(answer);
    return answer;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:20,
代码来源:FlowNodes.java

示例13: getSortedFlowNodes

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static List<FlowNode> getSortedFlowNodes(final List<FlowNode> flowNodes) {
    final List<FlowNode> answer = new ArrayList<FlowNode>();
    forEach(flowNodes, new Callback<FlowNode>() {
        @Override
        public void invoke(FlowNode node) {
            for (FlowNode old : answer) {
                if (Objects.equal(old.getId(), node.getId())) {
                    // already added
                    return;
                }
            }
            answer.add(node);
        }
    });
    sortInNodeIdOrder(answer);
    return answer;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:18,
代码来源:FlowNodes.java

示例14: doStages

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public Object doStages() {
    Object result = null;
    WorkflowRun run = getTarget();
    if (run != null) {
        final BuildDTO buildDTO = BuildDTO.createBuildDTO(run.getParent(), run);
        Callback<FlowNode> callback = new Callback<FlowNode>() {

            @Override
            public void invoke(FlowNode node) {
                StageDTO stage = StageDTO.createStageDTO(node);
                if (stage != null) {
                    buildDTO.addStage(stage);
                }
            }
        };
        FlowNodes.forEach(run.getExecution(), callback);
        FlowNodes.sortInStageIdOrder(buildDTO.getStages());
        result =  JSONHelper.jsonResponse(buildDTO);
    }
    return result;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:22,
代码来源:WorkflowRunAction.java

示例15: doNodes

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public Object doNodes() {
    WorkflowRun run = getTarget();
    List<NodeDTO> answer = new ArrayList<NodeDTO>();
    if (run != null) {
        FlowExecution flowExecution = run.getExecution();
        if (flowExecution != null) {
            List<FlowNode> nodes = FlowNodes.getSortedFlowNodes(flowExecution);
            for (FlowNode node : nodes) {
                NodeDTO dto = NodeDTO.createNodeDTO(node);
                if (dto != null) {
                    answer.add(dto);
                }
            }
        }
    }
    return JSONHelper.jsonResponse(answer);
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:18,
代码来源:WorkflowRunAction.java

示例16: filterStages

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
protected Object filterStages(Iterable<WorkflowRun> runs) {
    WorkflowJob job = getTarget();
    final JobDTO jobDTO = JobDTO.createJobDTO(job);
    if (job != null && jobDTO != null) {
        for (WorkflowRun build : runs) {
            final BuildDTO buildDTO = BuildDTO.createBuildDTO(job, build);
            jobDTO.addBuild(buildDTO);

            Callback<FlowNode> callback = new Callback<FlowNode>() {

                @Override
                public void invoke(FlowNode node) {
                    StageDTO stage = StageDTO.createStageDTO(node);
                    if (stage != null) {
                        buildDTO.addStage(stage);
                    }
                }
            };
            FlowNodes.forEach(build.getExecution(), callback);
            FlowNodes.sortInStageIdOrder(buildDTO.getStages());
        }
    }
    return JSONHelper.jsonResponse(jobDTO);
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:25,
代码来源:WorkflowJobAction.java

示例17: observeStage

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private void observeStage(Map<String, Summary> histogramMap, Job job, Run build, FlowNode stage) {
    String jobName = job.getName();
    String stageName = stage.getDisplayName();
    String[] labelNameArray = {"job", "stage"};
    String[] labelValueArray = {jobName, stageName};

    String key = jobName + "_" + stageName;
    Summary collector = histogramMap.get(key);
    if (collector == null) {
        collector = Summary.build().name(fullname + "_stage_duration_milliseconds_summary").
                subsystem(subsystem).namespace(namespace).
                        labelNames(labelNameArray).
                help("Summary of Jenkins build times by Job and Stage").
                create();
        histogramMap.put(key, collector);
    }
    long duration = FlowNodes.getStageDuration(stage);
    collector.labels(labelValueArray).observe(duration);
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:20,
代码来源:JobCollector.java

示例18: resolve

点赞 3

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static List<Task> resolve(WorkflowRun build, FlowNode stageStartNode) throws PipelineException {
    List<Task> result = new ArrayList<>();
    List<FlowNode> stageNodes = FlowNodeUtil.getStageNodes(stageStartNode);
    List<FlowNode> taskNodes = Util.getTaskNodes(stageNodes);

    if (isNotEmpty(taskNodes)) {
        for (FlowNode taskNode : taskNodes) {
            result.add(resolveTask(build, stageStartNode, taskNode));
        }
    } else {
        Stage stage = getStage(build, stageStartNode);
        Status stageStatus = resolveStageStatus(build, stage);
        result.add(createStageTask(build, stageStartNode, stageStatus));
    }
    return result;
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:17,
代码来源:Task.java

示例19: javadoc

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void javadoc() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition(
              "node {\n"
            + "    writeFile text: 'hello world', file: 'docs/index.html'\n"
            + "    step([$class: 'JavadocArchiver', javadocDir: 'docs'])\n"
            + "}", true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    assertEquals("hello world", r.createWebClient().getPage(p, "javadoc/").getWebResponse().getContentAsString());
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("step"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals("docs", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:14,
代码来源:CoreStepTest.java

示例20: tmp

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void tmp() throws Exception {
    WorkflowJob p = r.jenkins.createProject(WorkflowJob.class, "p");
    p.setDefinition(new CpsFlowDefinition("node {echo \"tmp='${pwd tmp: true}'\"}", true));
    WorkflowRun b = r.assertBuildStatusSuccess(p.scheduleBuild2(0));
    r.assertLogContains("tmp='" + tempDir(r.jenkins.getWorkspaceFor(p)) + "'", b);
    List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), new NodeStepTypePredicate("pwd"));
    assertThat(coreStepNodes, Matchers.hasSize(1));
    assertEquals(null, ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:10,
代码来源:PwdStepTest.java

示例21: overriding

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Test public void overriding() {
    story.addStep(new Statement() {
        @Override public void evaluate() throws Throwable {
            WorkflowJob p = story.j.jenkins.createProject(WorkflowJob.class, "p");
            p.setDefinition(new CpsFlowDefinition(
                "env.CUSTOM = 'initial'\n" +
                "env.FOOPATH = node {isUnix() ? '/opt/foos' : 'C:\\\\foos'}\n" +
                "env.NULLED = 'outside'\n" +
                "node {\n" +
                "  withEnv(['CUSTOM=override', 'NOVEL=val', 'BUILD_TAG=custom', 'NULLED=', isUnix() ? 'FOOPATH+BALL=/opt/ball' : 'FOOPATH+BALL=C:\\\\ball']) {\n" +
                "    isUnix() ? sh('echo inside CUSTOM=$CUSTOM NOVEL=$NOVEL BUILD_TAG=$BUILD_TAG NULLED=$NULLED FOOPATH=$FOOPATH:') : bat('echo inside CUSTOM=%CUSTOM% NOVEL=%NOVEL% BUILD_TAG=%BUILD_TAG% NULLED=%NULLED% FOOPATH=%FOOPATH%;')\n" +
                "    echo \"groovy NULLED=${env.NULLED}\"\n" +
                "  }\n" +
                "  isUnix() ? sh('echo outside CUSTOM=$CUSTOM NOVEL=$NOVEL NULLED=outside') : bat('echo outside CUSTOM=%CUSTOM% NOVEL=%NOVEL% NULLED=outside')\n" +
                "}", true));
            WorkflowRun b = story.j.assertBuildStatusSuccess(p.scheduleBuild2(0));
            story.j.assertLogContains(Functions.isWindows() ? "inside CUSTOM=override NOVEL=val BUILD_TAG=custom NULLED= FOOPATH=C:\\ball;C:\\foos;" : "inside CUSTOM=override NOVEL=val BUILD_TAG=custom NULLED= FOOPATH=/opt/ball:/opt/foos:", b);
            story.j.assertLogContains("groovy NULLED=null", b);
            story.j.assertLogContains("outside CUSTOM=initial NOVEL= NULLED=outside", b);
            List<FlowNode> coreStepNodes = new DepthFirstScanner().filteredNodes(b.getExecution(), Predicates.and(new NodeStepTypePredicate("withEnv"), new Predicate<FlowNode>() {
                @Override public boolean apply(FlowNode n) {
                    return n instanceof StepStartNode && !((StepStartNode) n).isBody();
                }
            }));
            assertThat(coreStepNodes, Matchers.hasSize(1));
            assertEquals("CUSTOM, NOVEL, BUILD_TAG, NULLED, FOOPATH+BALL", ArgumentsAction.getStepArgumentsAsString(coreStepNodes.get(0)));
        }
    });
}
 

开发者ID:10000TB,
项目名称:Jenkins-Plugin-Examples,
代码行数:30,
代码来源:EnvStepTest.java

示例22: forEach

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
/**
 * Traverses through all the nodes invoking the given callback
 */
public static void forEach(List<FlowNode> nodes, Callback<FlowNode> callback) {
    if (nodes != null) {
        for (FlowNode node : nodes) {
            callback.invoke(node);
            forEach(node.getParents(), callback);
        }
    }
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:12,
代码来源:FlowNodes.java

示例23: getNextNode

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static FlowNode getNextNode(FlowNode node) {
    List<FlowNode> list = getSortedFlowNodes(node.getExecution());
    if (list.isEmpty()) {
        return null;
    }
    int idx = list.indexOf(node);
    if (idx >= 0) {
        if (++idx < list.size()) {
            return list.get(idx);
        }
    }
    return null;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:14,
代码来源:FlowNodes.java

示例24: sortInNodeIdOrder

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static void sortInNodeIdOrder(List<FlowNode> answer) {
    // lets sort by node id
    Comparator<? super FlowNode> comparator = new Comparator<FlowNode>() {
        @Override
        public int compare(FlowNode o1, FlowNode o2) {
            return getNodeIdNumber(o1) - getNodeIdNumber(o2);
        }
    };
    Collections.sort(answer, comparator);
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:11,
代码来源:FlowNodes.java

示例25: getNodeIdNumber

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static int getNodeIdNumber(FlowNode node) {
    String id = node.getId();
    if (id != null && id.length() > 0) {
        try {
            return Integer.parseInt(id);
        } catch (NumberFormatException e) {
            LOG.warning("Failed to parse FlowNode id " + id + ". " + e);
        }
    }
    return 0;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:12,
代码来源:FlowNodes.java

示例26: getDuration

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static long getDuration(FlowNode startNode, FlowNode endNode) {
    long startTime = TimingAction.getStartTime(startNode);
    if (endNode != null) {
        long endTime = TimingAction.getStartTime(endNode);
        return endTime - startTime;
    } else {
        return 0;
    }
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:10,
代码来源:FlowNodes.java

示例27: getNodeUrlOrNull

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static String getNodeUrlOrNull(FlowNode node) {
    String url = null;
    try {
        url = node.getUrl();
    } catch (IOException e) {
        LOG.warning("Failed to create node URL or " + node + ". " + e);
    }
    return url;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:10,
代码来源:FlowNodes.java

示例28: getUrl

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static String getUrl(FlowNode node) {
    StaplerRequest currentRequest = Stapler.getCurrentRequest();
    String path = currentRequest.getContextPath();
    if (!path.endsWith("/")) {
        path += "/";
    }
    return path + "fabric8/";
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:9,
代码来源:FlowNodeAction.java

示例29: createFor

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
@Nonnull
@Override
public Collection<FlowNodeAction> createFor(FlowNode target) {
    try {
        FlowNodeAction action = getClass().newInstance();
        action.setTarget(target);
        List<FlowNodeAction> answer = new ArrayList<FlowNodeAction>();
        answer.add(action);
        return answer;
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:14,
代码来源:FlowNodeAction.java

示例30: resolveTask

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private static Task resolveTask(WorkflowRun build, FlowNode stageStartNode, FlowNode taskNode)
        throws PipelineException {
    TaskAction action = taskNode.getAction(TaskAction.class);
    Status status = resolveTaskStatus(build, stageStartNode, taskNode, action);
    return new Task(taskNode.getId(), action.getTaskName(), build.getNumber(), status,
            taskLinkFor(build), null, null,
            StatusType.PAUSED_PENDING_INPUT.equals(status.getType()));
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:9,
代码来源:Task.java

示例31: getStage

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private static Stage getStage(WorkflowRun build, FlowNode stageStartNode) throws PipelineException {
    List<Run> runs = workflowApi.getRunsFor(build.getParent());
    Run run = getRunById(runs, build.getNumber());
    Stage stage = run.getStageByName(stageStartNode.getDisplayName());
    if (stage == null) {
        throw new PipelineException("Could not resolve stage " + stageStartNode.getDisplayName()
                + " for pipeline " + build.getDisplayName());
    }
    return stage;
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:11,
代码来源:Task.java

示例32: resolve

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static Pipeline resolve(WorkflowJob project, WorkflowRun build) throws PipelineException {
    String pipelineTimestamp = PipelineUtils.formatTimestamp(build.getTimeInMillis());

    List<FlowNode> stageNodes = FlowNodeUtil.getStageNodes(build.getExecution());
    return new Pipeline(project.getName(),
            build.getDisplayName(),
            Stage.extractStages(build, stageNodes),
            Change.getChanges(build.getChangeSets()),
            TriggerCause.getTriggeredBy(project, build),
            pipelineTimestamp);
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:12,
代码来源:Pipeline.java

示例33: extractStages

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
static List<Stage> extractStages(WorkflowRun build, List<FlowNode> stageNodes) throws PipelineException {
    List<Stage> result = resolveStageNodes(build, stageNodes);
    for (int i = 0; i < result.size(); i++) {
        Stage stage = result.get(i);
        if (i + 1 < result.size()) {
            stage.downstreamStages = singletonList(result.get(i + 1));
            stage.downstreamStageIds = singletonList(result.get(i + 1).getId());
        }
        stage.setColumn(i);
        stage.setRow(0);
    }
    return result;
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:14,
代码来源:Stage.java

示例34: resolveStageNodes

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private static List<Stage> resolveStageNodes(WorkflowRun build, List<FlowNode> stageNodes)
        throws PipelineException {
    List<Stage> result = new ArrayList<>();
    for (FlowNode stageNode : stageNodes) {
        List<Task> tasks = Task.resolve(build, stageNode);
        result.add(new Stage(stageNode.getDisplayName(), tasks));
    }
    return result;
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:10,
代码来源:Stage.java

示例35: getTaskNodes

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static List<FlowNode> getTaskNodes(List<FlowNode> stageNodes) {
    List<FlowNode> result = new ArrayList<>();
    for (FlowNode stageNode : stageNodes) {
        if (isTaskNode(stageNode)) {
            result.add(stageNode);
        }
    }
    return result;
}
 

开发者ID:Diabol,
项目名称:delivery-pipeline-plugin,
代码行数:10,
代码来源:Util.java

示例36: isStageEndNode

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private boolean isStageEndNode(FlowNode node, String startNodeId) {
    return startNodeId != null && node instanceof StepEndNode && ((StepEndNode) node).getStartNode().getId().equals(startNodeId);
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:4,
代码来源:GitLabSCMPublishAction.java

示例37: isNamedStageStartNode

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
private boolean isNamedStageStartNode(FlowNode node) {
    return node instanceof StepStartNode && Objects.equals(((StepStartNode) node).getStepName(), "Stage") && !Objects.equals(node.getDisplayFunctionName(), "stage");
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:4,
代码来源:GitLabSCMPublishAction.java

示例38: push

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
String push(FlowNode node) {
    return push(node.getId(), node.getDisplayName());
}
 

开发者ID:Argelbargel,
项目名称:gitlab-branch-source-plugin,
代码行数:4,
代码来源:GitLabSCMPublishAction.java

示例39: createErrorDTO

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
public static ErrorDTO createErrorDTO(FlowNode node) {
    if (node != null) {
        return createErrorDTO(node.getError());
    }
    return null;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:7,
代码来源:ErrorDTO.java

示例40: isStageNode

点赞 2

import org.jenkinsci.plugins.workflow.graph.FlowNode; //导入依赖的package包/类
/**
 * Returns true if the given node is a stage node
 */
public static boolean isStageNode(FlowNode node) {
    return node != null && node.getAction(StageAction.class) != null;
}
 

开发者ID:fabric8io,
项目名称:fabric8-jenkins-workflow-steps,
代码行数:7,
代码来源:FlowNodes.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)