-
-
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
Extract interfaces for objects to be used through the executors widget #9749
Conversation
This is required for CloudBees CI HA support: we provide alternate implementations of these interfaces to represent computers and related objects that exist in different physical replicas of the same logical instance. This allows to be build an aggregated view of computers and executors, some local, some remote.
/** | ||
* A value class to provide a consistent snapshot view of the state of an executor to avoid race conditions | ||
* during rendering of the executors list. | ||
* | ||
* @since 1.607 | ||
*/ | ||
@Restricted(NoExternalUse.class) | ||
public static class DisplayExecutor implements ModelObject { |
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.
Moved to its own file.
return executor.equals(that.executor); | ||
} | ||
|
||
@Extension(ordinal = Double.MAX_VALUE) |
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.
(ignore WS)
/** | ||
* Works just like {@link #checkAbortPermission()} except it indicates the status by a return value, | ||
* instead of exception. | ||
* Also used by default for {@link hudson.model.Queue.Item#hasCancelPermission}. | ||
* <p> | ||
* NOTE: If you have implemented {@link AccessControlled} this returns by default | ||
* {@code return hasPermission(hudson.model.Item.CANCEL);} | ||
* | ||
* @return false | ||
* if the user doesn't have the permission. | ||
*/ | ||
default boolean hasAbortPermission() { | ||
if (this instanceof AccessControlled) { | ||
return ((AccessControlled) this).hasPermission(CANCEL); | ||
} | ||
return true; | ||
} | ||
|
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.
Moved to ITask
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.
Minor questions about Javadoc and nullability.
*/ | ||
@Exported | ||
public String getIconClassName() { | ||
return getIcon(); | ||
return IComputer.super.getIconClassName(); |
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.
Only here for @Exported
* <p> | ||
* Plugins are encouraged to extend from {@link AbstractSubTask} | ||
* instead of implementing this interface directly, to maintain | ||
* compatibility with future changes to this interface. | ||
* |
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.
While I'm here... something missed in https://github.com/jenkinsci/jenkins/pull/2879/files#diff-fe633c0d4d59f5cbd8fc0437fc0ac478b781deb33afaba9d6ed142a1154ac1f0R27
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.
#2879 FTR
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.
Still unsure about ITask.getUrl
(#9749 (comment)).
* <p> | ||
* Plugins are encouraged to extend from {@link AbstractSubTask} | ||
* instead of implementing this interface directly, to maintain | ||
* compatibility with future changes to this interface. | ||
* |
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.
#2879 FTR
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.
#9749 (comment) still unclear
/label ready-for-merge This PR is now ready for merge, after the pending security release, we will merge it if there's no negative feedback. Thanks! |
This is required for CloudBees CI HA support: we provide alternate implementations of these interfaces to represent computers and related objects that exist in different physical replicas of the same logical instance.
This allows to build an aggregated view of computers and executors, some local, some remote.
To avoid wording conflicts with existing concrete classes, the new interfaces are prefixed with
I
e.g.IComputer
. I'm open to alternative naming suggestions, but unfortunately the names that would represent them the most accurately are already taken.This introduces a new extension point,
ComputerSource
, allowing to override the list of computers that is returned viaComputerSet
. Only the implementation with the highest ordinal among those registered will be picked up. The default implementation returns localComputer
instances, and has ordinal-1
, allowing a plugin to override it with a simple@Extension
without any explicit ordinal being set.See JENKINS-XXXXX.
Testing done
Proposed changelog entries
Proposed upgrade guidelines
N/A
Submitter checklist
Desired reviewers
@mention
Before the changes are marked as
ready-for-merge
:Maintainer checklist