在Jenkins的BlueOcean中,修改Pipeline,结果发现,如果编写过程中,凡是能导致jenkinsFile有中文信息的,点击 save and run之后 Console 中出现错误,无法保存。
根据错误信息,定位到问题来源jenkins-js-extension.js,该问题和 js的btoa和atob 不支持unicode有关。
./webapps/plugins/blueocean-pipeline-editor/WEB-INF/lib/blueocean-pipeline-editor.jar
下载到本地,./webapps/plugins/blueocean-pipeline-editor/WEB-INF/lib/blueocean-pipeline-editor.jar
var Base64 = {
encode: function encode(data) {
return btoa(unescape(encodeURIComponent(data)));
},
decode: function decode(str) {
return decodeURIComponent(escape(atob(str)));
}
};
该JS的黑魔法解决方案来自这里。
本解决方案原创,转载需要注明
jenkins BlueOcean修复Pipeline不支持中文的问题
原文:https://www.cnblogs.com/slankka/p/12581254.html