Skip to content

Commit

Permalink
Merge pull request #1437 from benru/JENKINS-25286
Browse files Browse the repository at this point in the history
[FIXED JENKINS-25286] Export assignedLabels for agents and jobs in JSON and XML APIs
  • Loading branch information
oleg-nenashev committed Dec 10, 2017
2 parents 59b9658 + 3a0a575 commit 972257b
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 972257b

Please sign in to comment.