代码之家  ›  专栏  ›  技术社区  ›  ImranRazaKhan

MissingPropertyException:没有此类属性:GIT_COMMITTER_NAME

  •  0
  • ImranRazaKhan  · 技术社区  · 6 年前

    我试图在我的jenkins声明性piepline中获取GIT_COMMITTER_NAME值。

    echo "Git Commiter  ${env.GIT_COMMITTER_NAME}"
    echo "Git Commiter  ${GIT_COMMITTER_NAME}"
    

    但是得到了以下错误,其中as$GIT_COMMIT和$GIT_URL按照预期提供值

    groovy.lang.MissingPropertyException: No such property: GIT_COMMITTER_NAME for class: groovy.lang.Binding
        at groovy.lang.Binding.getVariable(Binding.java:63)
        at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onGetProperty(SandboxInterceptor.java:242)
        at org.kohsuke.groovy.sandbox.impl.Checker$6.call(Checker.java:288)
        at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:292)
        at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
        at org.kohsuke.groovy.sandbox.impl.Checker.checkedGetProperty(Checker.java:268)
        at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.getProperty(SandboxInvoker.java:29)
        at com.cloudbees.groovy.cps.impl.PropertyAccessBlock.rawGet(PropertyAccessBlock.java:20)
        at WorkflowScript.run(WorkflowScript:42)
    

    根据Git插件文档

    GIT_AUTHOR_NAME and GIT_COMMITTER_NAME - The name entered if the "Custom user name/e-mail address" behaviour is enabled; falls back to the value entered in the Jenkins system config under "Global Config user.name Value" (if any)
    

    $ git config --global user.name
    imran raza khan
    
    0 回复  |  直到 6 年前