Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-14407] Allow multi-value default for Scheduled runs
- Loading branch information
Showing
11 changed files
with
228 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/org/jvnet/jenkins/plugins/nodelabelparameter/NodeUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.jvnet.jenkins.plugins.nodelabelparameter; | ||
|
||
import hudson.model.Computer; | ||
import hudson.model.Node; | ||
import jenkins.model.Jenkins; | ||
|
||
public final class NodeUtil { | ||
|
||
private NodeUtil() { | ||
} | ||
|
||
/** | ||
* checks whether the given node is available for an execution of the job | ||
* @param nodeName the name of the node to check | ||
* @return <code>true</code> if the job is ok to be used | ||
*/ | ||
public static boolean isNodeOnline(String nodeName){ | ||
if("master".equals(nodeName)){ | ||
return true; | ||
} | ||
final Computer c = Jenkins.getInstance().getComputer(nodeName); | ||
if(c != null){ | ||
Node n = c.getNode(); | ||
return n!=null && c.isOnline() && c.getNumExecutors()>0; | ||
} | ||
return false; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.