[JIRA] (JENKINS-40640) @Library not working with pipeline model

10 views
Skip to first unread message

domi@fortysix.ch (JIRA)

unread,
Dec 22, 2016, 10:43:01 AM12/22/16
to jenkinsc...@googlegroups.com
Dominik Bartholdi created an issue
 
Jenkins / Bug JENKINS-40640
@Library not working with pipeline model
Issue Type: Bug Bug
Assignee: Andrew Bayer
Components: pipeline-model-definition-plugin, workflow-cps-global-lib-plugin
Created: 2016/Dec/22 3:42 PM
Priority: Minor Minor
Reporter: Dominik Bartholdi

while the following works fine:

@Library('yooture') 
import yooture.jenkins.yooture.Yooture

def yoo = new Yooture()
node {
    yoo.sendChatMessage("hello")
}

the same definition of a utility library does not work when used in a pipeline model definition:

@Library('yooture') 
import yooture.jenkins.yooture.Yooture

def yoo = new Yooture()

pipeline {
  agent any
  stages {
    stage ('prepare') {
      steps {
        script {
            yoo.sendChatMessage("hello")
        }
      }
    }
  }
}

it fails with:

 > git rev-parse refs/remotes/origin/master^{commit} # timeout=10
 > git rev-parse refs/remotes/origin/origin/master^{commit} # timeout=10
Checking out Revision 925b9e05a9e0f6e9717275ad8215e9f07714f38b (refs/remotes/origin/master)
 > 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:
WorkflowScript: 1: unable to resolve class Library ,  unable to find class for annotation
 @ line 1, column 1.
   @Library('yooture') 
   ^

1 error

	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)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite$StaticMetaMethodSiteNoUnwrapNoCoerce.invoke(StaticMetaMethodSite.java:151)
	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.callStatic(StaticMetaMethodSite.java:102)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callStatic(AbstractCallSite.java:206)
	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.scriptToPipelineDef(Converter.groovy:116)
	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter.parseFromCpsScript(Converter.groovy:177)
	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter$parseFromCpsScript.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.jenkinsci.plugins.pipeline.modeldefinition.parser.Converter$parseFromCpsScript.call(Unknown Source)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.attachExecutionModel(Utils.groovy:183)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$attachExecutionModel.call(Unknown Source)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
	at com.cloudbees.groovy.cps.sandbox.DefaultInvoker.methodCall(DefaultInvoker.java:18)
	at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/home/yooture/hudson_home/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:52)
	at WorkflowScript.run(WorkflowScript:7)
	at ___cps.transform___(Native Method)
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, 12:26:01 PM12/22/16
to jenkinsc...@googlegroups.com
Andrew Bayer resolved as Duplicate
 

Folding this in with JENKINS-40642 since it'll be the same fix.

Change By: Andrew Bayer
Status: Open Resolved
Resolution: Duplicate

bitwiseman@gmail.com (JIRA)

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

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

dprabhushankar@gmail.com (JIRA)

unread,
Feb 24, 2020, 7:45:03 AM2/24/20
to jenkinsc...@googlegroups.com
Change By: Prabhu Shankar
Resolution: Duplicate
Status: Closed In Review

dprabhushankar@gmail.com (JIRA)

unread,
Feb 24, 2020, 7:45:06 AM2/24/20
to jenkinsc...@googlegroups.com

dprabhushankar@gmail.com (JIRA)

unread,
Feb 24, 2020, 7:46:02 AM2/24/20
to jenkinsc...@googlegroups.com
Prabhu Shankar stopped work on Bug JENKINS-40640
 
Change By: Prabhu Shankar
Status: In Progress Open

dprabhushankar@gmail.com (JIRA)

unread,
Feb 24, 2020, 7:49:02 AM2/24/20
to jenkinsc...@googlegroups.com
Prabhu Shankar commented on Bug JENKINS-40640
 
Re: @Library not working with pipeline model

The issue is reproducible in Jenkins ver. 2.204.2 too, Is this really a duplicate for JENKINS-40642?

igorce@outlook.com (JIRA)

unread,
Mar 18, 2020, 6:34:03 PM3/18/20
to jenkinsc...@googlegroups.com

I can replicate the same problem on 2.225 with a very basic script:
 

package com.something

class Foo {
    def helloWorld() {
        echo "Hello World!"
    }
}

and then

@Library('global-library')
import com.something.Foo

throws the error.

At the same time importing from vars/ using

@Library('global-library') _

works fine

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages