-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
Add WithConsoleUrl
interface
#9645
Changes from 3 commits
39d30c8
44602bb
2d30cfc
49618a0
2f6d77c
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 |
---|---|---|
|
@@ -109,6 +109,7 @@ | |
import java.util.stream.Collectors; | ||
import javax.servlet.ServletException; | ||
import javax.servlet.http.HttpServletResponse; | ||
import jenkins.console.WithConsoleUrl; | ||
import jenkins.model.Jenkins; | ||
import jenkins.model.queue.AsynchronousExecution; | ||
import jenkins.model.queue.CompositeCauseOfBlockage; | ||
|
@@ -2088,7 +2089,7 @@ | |
* used to render the HTML that indicates this executable is executing. | ||
*/ | ||
@StaplerAccessibleType | ||
public interface Executable extends Runnable { | ||
public interface Executable extends Runnable, WithConsoleUrl { | ||
/** | ||
* Task from which this executable was created. | ||
* | ||
|
@@ -2131,6 +2132,16 @@ | |
return Executables.getParentOf(this).getEstimatedDuration(); | ||
} | ||
|
||
/** | ||
* Handles cases such as {@code PlaceholderExecutable} for Pipeline node steps. | ||
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. Did you test this case to make sure it works? 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. This is actually moved code 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. Ok, thanks, it just wasn't obvious to me that the recursion was quite the same. |
||
* @return by default, that of {@link #getParentExecutable} if defined | ||
*/ | ||
@Override | ||
default String getConsoleUrl() { | ||
Executable parent = getParentExecutable(); | ||
return parent != null ? parent.getConsoleUrl() : null; | ||
} | ||
|
||
/** | ||
* Used to render the HTML. Should be a human readable text of what this executable is. | ||
*/ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* The MIT License | ||
* | ||
* Copyright 2024 CloudBees, Inc. | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package jenkins.console; | ||
|
||
import edu.umd.cs.findbugs.annotations.CheckForNull; | ||
import org.kohsuke.accmod.Restricted; | ||
import org.kohsuke.accmod.restrictions.Beta; | ||
|
||
/** | ||
* A model object that may have a console URL. | ||
*/ | ||
@Restricted(Beta.class) | ||
public interface WithConsoleUrl { | ||
|
||
/** | ||
* @return a URL relative to the context root without leading slash, such as {@code job/xxx/123/console}; | ||
* or null if unknown or not applicable | ||
*/ | ||
@CheckForNull | ||
String getConsoleUrl(); | ||
} |
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.
After the last rework it isn't an object any longer, maybe also adjust the javadoc here
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.
Well, a “model object”. Seems OK to me.