Jenkins issue
- Publish over SSH 插件 SSH issue
$ ssh-keygen -f remote-key -m PEM -t rsa -b 4096
$ ll
-rw------- 1 tester tester 365 Nov 10 23:28 remote-key
-rw-r--r-- 1 tester tester 269 Nov 10 23:28 remote-key.pub
配置私钥后,将公钥放入目标服务器 ${user_home}/.ssh/authorized_keys
# 使用以下命令可以连入目标服务器
$ ssh -i remote-key ${user}@${target_host}
但在Jenkins Publish over SSH module 配置完私钥后死活不能通过远程连接且报如下错误
jenkins.plugins.publish_over.BapPublisherException: Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [Jenkins-env]. Message [*Auth fail*]].
通常出现这种是因为 Jenkins已经不再支持rsa
生成公私钥,可以使用 ecdsa
方式替换
$ ssh-keygen -t ecdsa -b 521 -m PEM
- java -jar jenkins.war issue
2022-11-26 09:00:53.224+0000 [id=1] SEVERE hudson.util.BootFailure#publish: Failed to initialize Jenkins
java.lang.NullPointerException: Cannot load from short array because "sun.awt.FontConfiguration.head" is null
at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:224)
at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:106)
at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:706)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:358)
at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:315)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:315)
at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
Caused: java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499)
at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480)
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:85)
Caused: java.lang.InternalError
at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:87)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:318)
at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:75)
at java.desktop/java.awt.Font.getFont2D(Font.java:526)
at java.desktop/java.awt.Font.getFamily(Font.java:1436)
at java.desktop/java.awt.Font.getFamily_NoClientCode(Font.java:1410)
at java.desktop/java.awt.Font.getFamily(Font.java:1402)
at java.desktop/java.awt.Font.toString(Font.java:1895)
at hudson.util.ChartUtil.<clinit>(ChartUtil.java:270)
at hudson.WebAppMain.contextInitialized(WebAppMain.java:217)
出现以上问题,需按照提示安装
$ sudo apt-get install xvfb
# 安装以上还是会提示报错,继续安装
$ sudo apt-get install fontconfig
reference
https://github.com/jenkinsci/publish-over-ssh-plugin/issues/247
https://wiki.jenkins.io/display/JENKINS/Jenkins+got+java.awt.headless+problem