-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from dwnusbaum/JENKINS-39203
[JENKINS-39203] Create new action to mark a FlowNode with a result such as unstable
- Loading branch information
Showing
4 changed files
with
140 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/main/java/org/jenkinsci/plugins/workflow/actions/WarningAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.jenkinsci.plugins.workflow.actions; | ||
|
||
import hudson.model.Result; | ||
import javax.annotation.CheckForNull; | ||
import javax.annotation.Nonnull; | ||
import org.jenkinsci.plugins.workflow.graph.FlowNode; | ||
|
||
/** | ||
* Action to be attached to a {@link FlowNode} to signify that some non-fatal event occurred | ||
* during execution of a {@code Step} but execution continued normally. | ||
* | ||
* {@link #withMessage} should be used whenever possible to give context to the warning. | ||
* Visualizations should treat FlowNodes with this action as if the FlowNode's result was {@link #result}. | ||
*/ | ||
public class WarningAction implements PersistentAction { | ||
private @Nonnull Result result; | ||
private @CheckForNull String message; | ||
|
||
public WarningAction(@Nonnull Result result) { | ||
this.result = result; | ||
} | ||
|
||
public WarningAction withMessage(String message) { | ||
this.message = message; | ||
return this; | ||
} | ||
|
||
public @CheckForNull String getMessage() { | ||
return message; | ||
} | ||
|
||
public @Nonnull Result getResult() { | ||
return result; | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return "Warning" + (message != null ? ": " + message : ""); | ||
} | ||
|
||
@Override | ||
public String getIconFileName() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public String getUrlName() { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters