Skip to content

Introduce Named, FullyNamed, FullyNamedModelObject interfaces#10827

Merged
MarkEWaite merged 8 commits intojenkinsci:masterfrom
Vlatombe:fully-nameable-model-object
Aug 8, 2025
Merged

Introduce Named, FullyNamed, FullyNamedModelObject interfaces#10827
MarkEWaite merged 8 commits intojenkinsci:masterfrom
Vlatombe:fully-nameable-model-object

Conversation

@Vlatombe
Copy link
Copy Markdown
Member

These correspond to methods getName, getFullName, getFullDisplayName that did not have any common interface to call them, causing some inconvenient usages of switch statements or even reflection in CloudBees CI HA.

See JENKINS-XXXXX.

Testing done

Proposed changelog entries

  • Developer: objects with getName, getFullName, getFullDisplayName can now be referred through dedicated interfaces.

Proposed changelog category

/label

Proposed upgrade guidelines

N/A

Submitter checklist

  • The Jira issue, if it exists, is well-described.
  • The changelog entries and upgrade guidelines are appropriate for the audience affected by the change (users or developers, depending on the change) and are in the imperative mood (see examples). Fill in the Proposed upgrade guidelines section only if there are breaking changes or changes that may require extra steps from users during upgrade.
  • There is automated testing or an explanation as to why this change has no tests.
  • New public classes, fields, and methods are annotated with @Restricted or have @since TODO Javadocs, as appropriate.
  • New deprecations are annotated with @Deprecated(since = "TODO") or @Deprecated(forRemoval = true, since = "TODO"), if applicable.
  • New or substantially changed JavaScript is not defined inline and does not call eval to ease future introduction of Content Security Policy (CSP) directives (see documentation).
  • For dependency updates, there are links to external changelogs and, if possible, full differentials.
  • For new APIs and extension points, there is a link to at least one consumer.

Desired reviewers

@mention

Before the changes are marked as ready-for-merge:

Maintainer checklist

  • There are at least two (2) approvals for the pull request and no outstanding requests for change.
  • Conversations in the pull request are over, or it is explicit that a reviewer is not blocking the change.
  • Changelog entries in the pull request title and/or Proposed changelog entries are accurate, human-readable, and in the imperative mood.
  • Proper changelog labels are set so that the changelog can be generated automatically.
  • If the change needs additional upgrade steps from users, the upgrade-guide-needed label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).
  • If it would make sense to backport the change to LTS, a Jira issue must exist, be a Bug or Improvement, and be labeled as lts-candidate to be considered (see query).

…erfaces

These correspond to methods `getName`, `getFullName`, `getFullDisplayName` that did not have any common interface to call them, causing some inconvenient usages of switch statements or even reflection in CloudBees CI HA.
@krisstern krisstern requested a review from a team July 10, 2025 18:54
@Vlatombe Vlatombe changed the title Introduce Nameable, FullyNameable, FullyNameableModelObject interfaces Introduce Named, FullyNamed, FullyNamedModelObject interfaces Jul 16, 2025
@Vlatombe Vlatombe requested a review from jglick July 16, 2025 12:43
Comment on lines +76 to +77
// TODO review usage of this method and replace with getFullDisplayName() where appropriate
return getTask().getFullDisplayName();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand the comment. Did you mean

Suggested change
// TODO review usage of this method and replace with getFullDisplayName() where appropriate
return getTask().getFullDisplayName();
return getTask().getDisplayName();

? And should ResourceActivity implement ModelObject?

Copy link
Copy Markdown
Member Author

@Vlatombe Vlatombe Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name of the method implies this would be the natural implementation, but since it actually uses the full display name, these could cause some UI inconsistencies if changed without reviewing all current usages.

Copy link
Copy Markdown
Member Author

@Vlatombe Vlatombe Jul 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And should ResourceActivity implement ModelObject?

I had missed this interface, I guess it should, for consistency with ITask

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do I understand the comment to mean that you propose switching QueueItem.displayName to use Task.displayName but looking up existing callers (probably in Jelly) and switching them from ${i.displayName} to ${i.fullDisplayName} where appropriate? If so, that was not clear to me from the comment text.

Comment on lines +76 to +77
// TODO review usage of this method and replace with getFullDisplayName() where appropriate
return getTask().getFullDisplayName();
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So do I understand the comment to mean that you propose switching QueueItem.displayName to use Task.displayName but looking up existing callers (probably in Jelly) and switching them from ${i.displayName} to ${i.fullDisplayName} where appropriate? If so, that was not clear to me from the comment text.

Copy link
Copy Markdown

@A1exKH A1exKH left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Copy Markdown
Member

@NotMyFault NotMyFault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/label ready-for-merge


This PR is now ready for merge. We will merge it after ~24 hours if there is no negative feedback.
Please see the merge process documentation for more information about the merge process.
Thanks!

@comment-ops-bot comment-ops-bot bot added the ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback label Aug 7, 2025
@MarkEWaite MarkEWaite merged commit 0673bc6 into jenkinsci:master Aug 8, 2025
18 checks passed
MarkEWaite added a commit to MarkEWaite/extensible-choice-parameter-plugin that referenced this pull request Aug 13, 2025
Fix two tests that are blocking the Jenkins plugin BOM upgrade from
Jenkins 2.522 to 2.523.  Blocked pull request is:

* jenkinsci/bom#5519

New interface was added in Jenkins core pull request:

* jenkinsci/jenkins#10827

Add a script approval for jenkins.model.FullyNamed.getFullName() since the
tests already have a script approval for hudson.model.Item.getFullName().
Keeps the tests consistent and allows the tests to pass with both older
and newer Jenkins versions.

Testing done:

Confirmed that tests pass with Jenkins 2.523 and with default Jenkins version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

developer Changes which impact plugin developers ready-for-merge The PR is ready to go, and it will be merged soon if there is no negative feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants