Jenkins从2.319升级到2.346后,Jenkins启动失败,报错:
java.nio.file.InvalidPathException: Illegal char <:> at index 87: C:Users$DEVTO~1AppDataLocalTempJenkins-doCheckRawBuildsDir18416011757244540585foo:bar
at java.base/sun.nio.fs.WindowsPathParser.normalize(WindowsPathParser.java:182)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:153)
at java.base/sun.nio.fs.WindowsPathParser.parse(WindowsPathParser.java:77)
at java.base/sun.nio.fs.WindowsPath.parse(WindowsPath.java:92)
at java.base/sun.nio.fs.WindowsFileSystem.getPath(WindowsFileSystem.java:229)
at java.base/java.io.File.toPath(File.java:2290)
at jenkins.model.Jenkins.checkRawBuildsDir(Jenkins.java:3364)
Caused: jenkins.model.InvalidBuildsDir: D:JenkinsDatajobs${ITEM_FULLNAME}builds contains ${ITEM_FULLNAME} but your system does not support it (JENKINS-12251). Use ${ITEM_FULL_NAME} instead
at jenkins.model.Jenkins.checkRawBuildsDir(Jenkins.java:3366)
at jenkins.model.Jenkins.loadConfig(Jenkins.java:3300)
Caused: java.io.IOException
at jenkins.model.Jenkins.loadConfig(Jenkins.java:3303)
at jenkins.model.Jenkins.access$1200(Jenkins.java:340)
at jenkins.model.Jenkins$12.run(Jenkins.java:3398)
at org.jvnet.hudson.reactor.TaskGraphBuilder$TaskImpl.run(TaskGraphBuilder.java:175)
at org.jvnet.hudson.reactor.Reactor.runTask(Reactor.java:305)
at jenkins.model.Jenkins$5.runTask(Jenkins.java:1158)
at org.jvnet.hudson.reactor.Reactor$2.run(Reactor.java:222)
at org.jvnet.hudson.reactor.Reactor$Node.run(Reactor.java:121)
at jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:68)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused: org.jvnet.hudson.reactor.ReactorException
at org.jvnet.hudson.reactor.Reactor.execute(Reactor.java:291)
at jenkins.InitReactorRunner.run(InitReactorRunner.java:49)
at jenkins.model.Jenkins.executeReactor(Jenkins.java:1193)
at jenkins.model.Jenkins.<init>(Jenkins.java:983)
at hudson.model.Hudson.<init>(Hudson.java:86)
at hudson.model.Hudson.<init>(Hudson.java:82)
at hudson.WebAppMain$3.run(WebAppMain.java:247)
Caused: hudson.util.HudsonFailedToLoad
at hudson.WebAppMain$3.run(WebAppMain.java:264)
之前的升级没有任何问题。我没有在发布说明中找到关于这些变量的任何参考。同样,在升级指南中,没有找到与这些变量相关的更改的参考。
经过调查和检查Jenkins代码,我找到了原因。
在config.xml文件中,我必须改变2个标签的值:
<workspaceDir>D:JenkinsDataWorkspaces${ITEM_FULLNAME}</workspaceDir>
<buildsDir>D:JenkinsDatajobs${ITEM_FULLNAME}builds</buildsDir>
<workspaceDir>D:JenkinsDataWorkspaces${ITEM_FULL_NAME}</workspaceDir>
<buildsDir>D:JenkinsDatajobs${ITEM_FULL_NAME}builds</buildsDir>
修改后,Jenkins可以正常运行。