groovy.lang.MissingPropertyException: No such property: jenkins for class: groovy.lang.Binding

前端 未结 4 1214
北恋
北恋 2020-12-16 14:37

We\'re upgrading to a newer version of Jenkins (2.60.1) and a groovy script which was working in the previous Jenkins version (1.596/2) no longer works.

This is a Je

相关标签:
4条回答
  • 2020-12-16 14:57

    Please double check that jenkins is not blocking this import. Go to script approvals and check to see if it is blocking it. If it is click allow.

    https://jenkins.io/doc/book/managing/script-approval/

    0 讨论(0)
  • 2020-12-16 15:05

    As pointed out by @Jayan in another post, the solution was to do the following

    import jenkins.model.*
    jenkins = Jenkins.instance
    

    Then I was able to do the rest of my scripting the way it was.

    0 讨论(0)
  • 2020-12-16 15:19

    For me this problem occurred because I had a some invalid character in my Groovy script. In our case this was an extra blank line after the closing bracket of the script.

    0 讨论(0)
  • 2020-12-16 15:19

    in my case I have used - (Hyphen) in my script name in case of Jenkinsfile Library. Got resolved after replacing Hyphen(-) with Underscore(_)

    0 讨论(0)
提交回复
热议问题