0

I have a groovy class which I am attempting to import from a folder-level shared library.

Here is the groovy class -



    package abc.esmm

    @Singleton
    class JiraCommands implements Serializable 
    {
        def steps
        def jiraCommandsTool

        def Initialize(steps)
        {
            this.steps = steps

            jiraCommandsTool = "${steps.WORKSPACE}/JenkinsPipeline/UtilityScripts/bin/JiraCommands"
        }

        def AddFixVersionToJiraIssues(jiraIssues, fixVersion, overwriteFixVersionParam=false)
        {
            def overwriteFixVersion = "False"
            if(overwriteFixVersionParam)
            {
                overwriteFixVersion = "True"
            }

            steps.sh(returnStdout: true, script: "${jiraCommandsTool} -command addFixVersionToJira -jiraIssues \"${jiraIssues}\" -fixVersion ${fixVersion} -overwriteFixVersion ${overwriteFixVersion}").trim()
        }
    }

I try to create an instance of this class with this pipeline code :



    @Library('LotteryFolderPipelineLibs') 
    import abc.esmm.JiraCommands

    node('All_LinuxBuildPool')
    {
        JiraCommands.instance.Initialize(this)
    }

This works ok when called from a Jenkins Global shared library, but not when called from a folder-level shared library. The global shared library and the folder-level shared library point to the same code. When called from a folder-level shared library I receive this error :

CpsCallableInvocation{methodName=getInstance, call=null, receiver=class abc.esmm.JiraCommands, arguments=[]}
Finished: FAILURE

Does anyone know why this is happening ?

user1751044
  • 71
  • 1
  • 2
  • The folder level library cannot escape sandbox. What is the full error? – Jayan Jun 10 '20 at 17:51
  • The error information that I see in the job console output is "CpsCallableInvocation{methodName=getInstance, call=null, receiver=class abc.esmm.JiraCommands, arguments=[]}" – user1751044 Jun 10 '20 at 18:03
  • This code does work ok outside of the jenkins sandbox. The problem is that I don't see how to disable the sandbox for a Pipeline SCM script (I want to keep the script in SCM). – user1751044 Jun 10 '20 at 19:08

0 Answers0