Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
JENKINS-25286: Export assigned labels for slaves and the label expres…
…sion for jobs in JSON and XML APIs

Adds @export attribute to assignedLabels for Computer and AbstractProject
Also adjusts visibility on Label "name" parameter so it appears by default
  • Loading branch information
benru authored and Ben Russell committed Nov 13, 2017
1 parent 6fb6e6f commit 3a0a575
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions core/src/main/java/hudson/model/AbstractProject.java
Expand Up @@ -407,6 +407,7 @@ public Set<Label> getRelevantLabels() {
/**
* Gets the textual representation of the assigned label as it was entered by the user.
*/
@Exported(name="labelExpression")
public String getAssignedLabelString() {
if (canRoam || assignedNode==null) return null;
try {
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/hudson/model/Computer.java
Expand Up @@ -776,6 +776,12 @@ public String getUrl() {
return "computer/" + Util.rawEncode(getName()) + "/";
}

@Exported
public Set<LabelAtom> getAssignedLabels() {
Node node = getNode();
return (node != null) ? node.getAssignedLabels() : Collections.EMPTY_SET;
}

/**
* Returns projects that are tied on this node.
*/
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/model/Label.java
Expand Up @@ -127,7 +127,7 @@ protected boolean matches(Queue.Item item, SubTask subTask) {
/**
* Alias for {@link #getDisplayName()}.
*/
@Exported
@Exported(visibility=2)
public final String getName() {
return getDisplayName();
}
Expand Down

0 comments on commit 3a0a575

Please sign in to comment.