微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Jenkins WorkflowScript:加载库失败

如何解决Jenkins WorkflowScript:加载库失败

我使用 jenkins 作为我的 CI/CD,这突然开始发生。 Jenkins 文件从不同的存储库加载库,但位于同一个 git 帐户,并且工作正常。现在所有声明性管道都不起作用并抛出这个奇怪的错误
詹金斯版本:2.263.3
Java 11
詹金斯档案:
#!/usr/bin/env groovy

@Library('jenkins-shared-library') _

MyPipeline()

java.lang.NullPointerException
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.lambda$retrieve$0(SCMSourceRetriever.java:83)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrySCMOperation(SCMSourceRetriever.java:98)
    at org.jenkinsci.plugins.workflow.libs.SCMSourceRetriever.retrieve(SCMSourceRetriever.java:83)
    at org.jenkinsci.plugins.workflow.libs.LibraryAdder.retrieve(LibraryAdder.java:157)
    at org.jenkinsci.plugins.workflow.libs.LibraryAdder.add(LibraryAdder.java:138)
    at org.jenkinsci.plugins.workflow.libs.LibraryDecorator$1.call(LibraryDecorator.java:125)
    at org.codehaus.groovy.control.compilationunit.applyToPrimaryClassNodes(compilationunit.java:1065)
    at org.codehaus.groovy.control.compilationunit.doPhaSEOperation(compilationunit.java:603)
    at org.codehaus.groovy.control.compilationunit.processphaSEOperations(compilationunit.java:581)
    at org.codehaus.groovy.control.compilationunit.compile(compilationunit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.groovyshell.parseClass(groovyshell.java:688)
    at groovy.lang.groovyshell.parse(groovyshell.java:700)
    at org.jenkinsci.plugins.workflow.cps.cpsgroovyshell.doParse(cpsgroovyshell.java:133)
    at org.jenkinsci.plugins.workflow.cps.cpsgroovyshell.reparse(cpsgroovyshell.java:126)
    at org.jenkinsci.plugins.workflow.cps.cpsFlowExecution.parseScript(cpsFlowExecution.java:561)
    at org.jenkinsci.plugins.workflow.cps.cpsFlowExecution.start(cpsFlowExecution.java:522)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup Failed:
WorkflowScript: Loading libraries Failed

1 error

    at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
    at org.codehaus.groovy.control.compilationunit.applyToPrimaryClassNodes(compilationunit.java:1085)
    at org.codehaus.groovy.control.compilationunit.doPhaSEOperation(compilationunit.java:603)
    at org.codehaus.groovy.control.compilationunit.processphaSEOperations(compilationunit.java:581)
    at org.codehaus.groovy.control.compilationunit.compile(compilationunit.java:558)
    at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:298)
    at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:268)
    at groovy.lang.groovyshell.parseClass(groovyshell.java:688)
    at groovy.lang.groovyshell.parse(groovyshell.java:700)
    at org.jenkinsci.plugins.workflow.cps.cpsgroovyshell.doParse(cpsgroovyshell.java:133)
    at org.jenkinsci.plugins.workflow.cps.cpsgroovyshell.reparse(cpsgroovyshell.java:126)
    at org.jenkinsci.plugins.workflow.cps.cpsFlowExecution.parseScript(cpsFlowExecution.java:561)
    at org.jenkinsci.plugins.workflow.cps.cpsFlowExecution.start(cpsFlowExecution.java:522)
    at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:337)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Finished: FAILURE ```

解决方法

您能否签入:管理 jenkins > 配置系统 > 全局管道库? 你应该有这样的事情: enter image description here

,

我想在这里添加的一件事是,您需要在根级别或文件夹级别添加共享库。你真的不能在Job级别添加

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。