-
Notifications
You must be signed in to change notification settings - Fork 272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JENKINS-39203] Mark publishIssues steps with QualityGateStatus.WARNING with WarningAction #58
Changes from 2 commits
2c45a38
f2df273
8209b48
bc5b9b6
8eccb30
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
import org.kohsuke.stapler.DataBoundConstructor; | ||
import org.kohsuke.stapler.DataBoundSetter; | ||
import org.kohsuke.stapler.QueryParameter; | ||
import org.jenkinsci.plugins.workflow.graph.FlowNode; | ||
import org.jenkinsci.plugins.workflow.steps.Step; | ||
import org.jenkinsci.plugins.workflow.steps.StepContext; | ||
import org.jenkinsci.plugins.workflow.steps.StepDescriptor; | ||
|
@@ -38,6 +39,7 @@ | |
import io.jenkins.plugins.analysis.core.util.QualityGate.QualityGateResult; | ||
import io.jenkins.plugins.analysis.core.util.QualityGate.QualityGateType; | ||
import io.jenkins.plugins.analysis.core.util.QualityGateEvaluator; | ||
import io.jenkins.plugins.analysis.core.util.QualityGateStatusHandler; | ||
|
||
/** | ||
* Publish issues created by a static analysis build. The recorded issues are stored as a {@link ResultAction} in the | ||
|
@@ -569,10 +571,13 @@ protected ResultAction run() throws IOException, InterruptedException, IllegalSt | |
} | ||
report.addAll(reports); | ||
|
||
QualityGateStatusHandler statusHandler = new QualityGateStatusHandler.PipelineStatusHandler(getRun(), | ||
getContext().get(FlowNode.class)); | ||
IssuesPublisher publisher = new IssuesPublisher(getRun(), report, healthDescriptor, qualityGate, | ||
name, referenceJobName, ignoreQualityGate, ignoreFailedBuilds, | ||
getCharset(sourceCodeEncoding), getLogger(report)); | ||
return publisher.attachAction(); | ||
getCharset(sourceCodeEncoding), getLogger(report), statusHandler); | ||
ResultAction resultAction = publisher.attachAction(); | ||
return resultAction; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it makes more sense if this code is called in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that was what I had in mind with this comment from the PR description:
Unfortunately no, I don't think there is any way to make this work without changing the API of There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, that would prevent all plugins that just implement Maybe it would make sense to provide an additional action There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I think the idea behind I guess the crux of the issue is that tracking per-step failures is very much a Pipeline-specific behavior, but it seems like you are using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Creating another step seems like a simpler solution. I already extracted the behavior of
Shouldn't moving the symbol from There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Yeah that would be the easiest approach as long as the only uses of the symbol today are in Pipeline and so we wouldn't break anything for anyone else. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, I've just force-pushed with a new commit that introduces EDIT: It would also be good to know if you like the way that I moved the actual result handling into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be better if we would rather have a new Interface that has two different implementations: one sets the status of the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The overall approach of copying the recorder to a new step class looks ok. I think we can't avoid the duplication here (this is a similar and ugly thing that I already had with the maven plugin support and the scan and publish steps). |
||
} | ||
|
||
private LogHandler getLogger(final AnnotatedReport report) throws InterruptedException { | ||
|
@@ -590,7 +595,7 @@ public static class Descriptor extends StepDescriptor { | |
|
||
@Override | ||
public Set<Class<?>> getRequiredContext() { | ||
return Sets.immutable.of(Run.class, TaskListener.class).castToSet(); | ||
return Sets.immutable.of(FlowNode.class, Run.class, TaskListener.class).castToSet(); | ||
} | ||
|
||
@Override | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Required by the new version of workflow-api.