[JIRA] (JENKINS-48466) Provide JUnit 5 support for JenkinsRule
Title: Message Title Thomas Weißschuh commented on JENKINS-48466 Re: Provide JUnit 5 support for JenkinsRule To get it to work with TestExtension I had to modify the JenkinsRule from Chris Hunt: JenkinsRule(ParameterContext context, ExtensionContext extensionContext) { this.context = context; this.testDescription = Description.createTestDescription( extensionContext.getTestClass().map(Class::getName).orElse(null), extensionContext.getTestMethod().map(Method::getName).orElse(null) ); } To make it work with @RegisterExtension (to interact with the rule from @BeforeEach methods) the following works: public static class JenkinsExtension extends org.jvnet.hudson.test.JenkinsRule implements BeforeEachCallback, AfterEachCallback { @Override public void beforeEach(ExtensionContext context) throws Exception { this.testDescription = Description.createTestDescription( context.getTestClass().map(Class::getName).orElse(null), context.getTestMethod().map(Method::getName).orElse(null) ); try { before(); } catch (Throwable throwable) { throw new Exception(throwable); } } @Override public void afterEach(ExtensionContext context) throws Exception { after(); } @Override public void recipe() throws Exception { } Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh commented on JENKINS-52189 Re: GraphListener does not receive FlowStartNode Devin Nusbaum: https://github.com/jenkinsci/workflow-job-plugin/pull/129 Unfortunately the plugin that needs it is not (yet?) public. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh assigned an issue to Devin Nusbaum Jenkins / JENKINS-52189 GraphListener does not receive FlowStartNode Change By: Thomas Weißschuh Assignee: Sam Van Oort Devin Nusbaum Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh commented on JENKINS-52189 Re: GraphListener does not receive FlowStartNode Devin Nusbaum so the easy way would be to just fire the listeners before the execution This however would break the behaviour of the `FlowExecution.onRunning()` method which is documented to receive an already started listener. (The testsuite however passes) We could also introduce a new method `FlowExecution.beforeRunning()` (or `onCreated()`) that fires before the flow is actually started. WDYT? Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh commented on JENKINS-52189 Re: GraphListener does not receive FlowStartNode Allan Lewis you assigned this to yourself, are you planning on working on this? Otherwise I may find the time to take a shot at it. Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh commented on JENKINS-52189 Re: GraphListener does not receive FlowStartNode My current code is nicer to implement with customly created listeners. I can rewrite it to use the global one but wanted to ask before, as maybe it should actually work. My FlowExecutionListener creates a GraphListener for every new Flow (and stores it). The following snippet works around the currently missing functionality by triggering the creation of the GraphListener "manually": import hudson.Extension; import org.jenkinsci.plugins.workflow.flow.GraphListener; import org.jenkinsci.plugins.workflow.graph.FlowNode; import org.jenkinsci.plugins.workflow.graph.FlowStartNode; /* * This class works around https://issues.jenkins-ci.org/browse/JENKINS-52189 * Especially the part where GraphListeners attached during FlowExecutionListener.onRunning() do not receive the FlowStartNode. * As the per instance logic is nicer to reason about and may work properly in a future version of Jenkins, * this class will be the bridge until then. */ @Extension public class WorkaroundGraphListener implements GraphListener, GraphListener.Synchronous { @Override public void onNewHead(FlowNode node) { final OTFlowExecutionListener flowExecutionListener = OTFlowExecutionListener.get(); if (node instanceof FlowStartNode) { flowExecutionListener.getListener(node.getExecution()).onNewHead(node); } } } Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh edited a comment on JENKINS-52189 Re: GraphListener does not receive FlowStartNode Another point (also raised on the PR):Should it be possible to use the instantiation based usage of GraphListener (asexplained by its javadoc?Something like the follow following test:{code} @Issue("JENKINS-52189")@Testpublic void notifyFlowStartNodeViaFlowExecutionListener() {story.then(s->{WorkflowJob j = jenkins().createProject(WorkflowJob.class, "bob");j.setDefinition(new CpsFlowDefinition("echo 'I did a thing'", true));WorkflowRun r = story.j.buildAndAssertSuccess(j);FlowStartNodeFlowExectionListener listener = jenkins().getExtensionList(FlowStartNodeFlowExectionListener.class).get(0);assertThat(listener.heads, Matchers.greaterThan(1));assertThat(listener.execNames, Matchers.contains(r.getExecution().toString()));});}@TestExtension("notifyFlowStartNodeViaFlowExecutionListener")public static class FlowStartNodeFlowExectionListener extends FlowExecutionListener {int heads = 0;final List execNames = new ArrayList<>();@Overridepublic void onRunning(@Nonnull FlowExecution execution) {execution.addListener(node -> {heads++;if (node instanceof FlowStartNode) {execNames.add(node.getExecution().toString());}});}}{code} Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-52189) GraphListener does not receive FlowStartNode
Title: Message Title Thomas Weißschuh reopened an issue Jenkins / JENKINS-52189 GraphListener does not receive FlowStartNode Change By: Thomas Weißschuh Resolution: Fixed Status: Resolved Reopened Assignee: Sam Van Oort Devin Nusbaum Add Comment This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-51170) Workflowstep-specific environment variables
Title: Message Title Thomas Weißschuh commented on JENKINS-51170 Re: Workflowstep-specific environment variables There is now a prototype. Should I just open PRs against workflow-step-api, workflow-support (and workflow-cps) or only against the API for now? (I did not find explicit docs about contributing to (multiple) plugins (at once). Add Comment This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e) -- You received this message because you are subscribed to the Google Groups "Jenkins Issues" group. To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-issues+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[JIRA] (JENKINS-51170) Workflowstep-specific environment variables
Title: Message Title Thomas Weißschuh created an issue Jenkins / JENKINS-51170 Workflowstep-specific environment variables Issue Type: Improvement Assignee: Unassigned Components: workflow-step-api-plugin, workflow-support-plugin Created: 2018-05-07 07:24 Labels: api Priority: Minor Reporter: Thomas Weißschuh For monitoring purposes it can be useful to be able to have access to the current FlowNode/Step via environment variables. This could be done by only injecting the current FlowNode id as environment variable. A more flexible approach would be a new extension point, similar to an `EnvironmentContributor`, but called with the current `StepContext`. If this idea gets a general go-ahead I will present a prototype. Cc Sam Van Oort, Andrew Bayer Previous discussion: https://groups.google.com/forum/#!topic/jenkinsci-dev/VBYvIv3S_r4 Add Comment