[JIRA] (JENKINS-40642) @NonCPS and @Library not visible in utility classes when used in pipeline model

7 views
Skip to first unread message

andrew.bayer@gmail.com (JIRA)

unread,
Dec 22, 2016, 12:27:02 PM12/22/16
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
 
Jenkins / Bug JENKINS-40642
@NonCPS and @Library not visible in utility classes when used in pipeline model
Change By: Andrew Bayer
Summary: @NonCPS and @Library not visible in utility classes when used in pipeline model
It seems that {{@NonCPS}} is and {{@Library}} are not visible in the context of a pipeline model definition and must be fully qualified. ...but to be honest, I have no idea what FQN of this class is. In a "normal" pipeline script, this class is visible by default.

the error I get is:

{noformat}
> git config core.sparsecheckout # timeout=10
> git checkout -f 925b9e05a9e0f6e9717275ad8215e9f07714f38b
> git rev-list 925b9e05a9e0f6e9717275ad8215e9f07714f38b # timeout=10
[Pipeline] End of Pipeline
hudson.remoting.ProxyException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
file:/home/yooture/hudson_home/jobs/ci/jobs/dummy/builds/90/libs/yooture/src/yooture/jenkins/cloudfoundry/Cloudfoundry.groovy: 214: unable to resolve class NonCPS ,  unable to find class for annotation
@ line 214, column 1.
   @NonCPS
   ^

file:/home/yooture/hudson_home/jobs/ci/jobs/dummy/builds/90/libs/yooture/src/yooture/jenkins/cloudfoundry/Cloudfoundry.groovy: 220: unable to resolve class NonCPS ,  unable to find class for annotation
@ line 220, column 1.
   @NonCPS
   ^

2 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:310)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:946)
at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:593)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:542)
at org.codehaus.groovy.control.CompilationUnit$compile$1.call(Unknown Source)
at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.compilationUnitToPipelineDef(Converter.groovy:136)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
{noformat}
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

andrew.bayer@gmail.com (JIRA)

unread,
Dec 22, 2016, 1:07:01 PM12/22/16
to jenkinsc...@googlegroups.com
Andrew Bayer commented on Bug JENKINS-40642
 
Re: @NonCPS and @Library not visible in utility classes when used in pipeline model

Ah, with @Library added in, I've got a test case, so an initial PR is coming momentarily.

andrew.bayer@gmail.com (JIRA)

unread,
Jan 5, 2017, 11:12:01 AM1/5/17
to jenkinsc...@googlegroups.com

scm_issue_link@java.net (JIRA)

unread,
Jan 5, 2017, 11:12:02 AM1/5/17
to jenkinsc...@googlegroups.com
SCM/JIRA link daemon commented on Bug JENKINS-40642
 
Re: @NonCPS and @Library not visible in utility classes when used in pipeline model

Code changed in jenkins
User: Andrew Bayer
Path:
pipeline-model-definition/pom.xml
pipeline-model-definition/src/main/groovy/org/jenkinsci/plugins/pipeline/modeldefinition/parser/Converter.groovy
pipeline-model-definition/src/main/java/org/jenkinsci/plugins/pipeline/modeldefinition/parser/GroovyShellDecoratorImpl.java
pipeline-model-definition/src/test/java/org/jenkinsci/plugins/pipeline/modeldefinition/BasicModelDefTest.java
pipeline-model-definition/src/test/resources/libraryAnnotation.groovy
http://jenkins-ci.org/commit/pipeline-model-definition-plugin/29da05355dc0bcb543ce376bd07eefd39d8ca10d
Log:
[FIXED JENKINS-40642] Add additional imports for parse/translate

@NonCPS and @Library were the most glaring missing import, but I
replicated the standard CpsGroovyShell imports - @NonCPS's package,
hudson.model, jenkins.model, and anything provided by a GroovyShellDecorator.

bitwiseman@gmail.com (JIRA)

unread,
Oct 22, 2019, 11:24:06 PM10/22/19
to jenkinsc...@googlegroups.com
Liam Newman closed an issue as Fixed
 

Bulk closing resolved issues.

Change By: Liam Newman
Status: Resolved Closed
This message was sent by Atlassian Jira (v7.13.6#713006-sha1:cc4451f)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages