tabeyti / jenkins-jack

Jack into your Jenkins to execute Pipeline scripts, provide Pipeline step autocompletions, pull Shared Library step documenation, run console groovy scripts across multiple nodes, and more! Honestly, not that much more.
Other
97 stars 32 forks source link

Script console appliance won't work with the master node having French locale #44

Open dliakh opened 3 years ago

dliakh commented 3 years ago

The reason: it uses the displayName property for forming the URL to connect which the master node reports as maître, not 'master' (so the URL becomes like /computer/maître/scriptText instead of the /computer/(master)/scriptText.

(Jenkins version 2.164.2)

Below is the Jenkins' reply example:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /computer/ma�tre/scriptText. Reason:
<pre>    Not Found</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/>

</body>
</html>
dliakh commented 3 years ago

The naïve fix (that actually works) would be like below (not sure that's the best and the most universal solution though)

diff --git a/src/scriptConsoleJack.ts b/src/scriptConsoleJack.ts
index 7e9ee20..ac6af92 100644
--- a/src/scriptConsoleJack.ts
+++ b/src/scriptConsoleJack.ts
@@ -66,7 +66,7 @@ export class ScriptConsoleJack extends JackBase {
             if (undefined === targetNodes) { return undefined; }
             for (let m of targetNodes) {
                 let promise = undefined;
-                if ('master' === m) {
+                if ('master' === m || 'maître' === m) {
                     promise = new Promise(async (resolve) => {
                         let result = await ext.connectionsManager.host.runConsoleScript(source, undefined, token);
                         return resolve({ node: 'master', output: result });