forked from jenkinsci/scriptler-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to built-in node instead of controller
The comment about running Scriptler scripts on the controller is somewhat incorrect and we should be talking about running on the built- in node instead. Make this change, as well as in the configuration data.
- Loading branch information
Showing
14 changed files
with
91 additions
and
54 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
src/main/java/org/jenkinsci/plugins/scriptler/NodeNames.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,36 @@ | ||
package org.jenkinsci.plugins.scriptler; | ||
|
||
import edu.umd.cs.findbugs.annotations.NonNull; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public final class NodeNames { | ||
public static final String BUILT_IN = "(built-in)"; | ||
public static final String ALL = "(all)"; | ||
public static final String ALL_AGENTS = "(all agents)"; | ||
private static final Map<String, String> DEPRECATED_ALIASES; | ||
|
||
static { | ||
Map<String, List<String>> deprecatedNames = | ||
Map.of(BUILT_IN, List.of("(master)", "(controller)"), ALL_AGENTS, List.of("(all slaves)")); | ||
|
||
Map<String, String> aliases = new HashMap<>(); | ||
deprecatedNames.forEach( | ||
(newName, oldNames) -> oldNames.forEach(oldName -> aliases.put(normalizeName(oldName), newName))); | ||
|
||
DEPRECATED_ALIASES = Map.copyOf(aliases); | ||
} | ||
|
||
@NonNull | ||
private static String normalizeName(@NonNull String name) { | ||
return name.toLowerCase(); | ||
} | ||
|
||
@NonNull | ||
public static String normalizeNodeName(@NonNull String nodeName) { | ||
return DEPRECATED_ALIASES.getOrDefault(normalizeName(nodeName), nodeName); | ||
} | ||
|
||
private NodeNames() {} | ||
} |
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
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
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
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
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