Hello I have the following Shared Library:

#!/usr/bin/env groovy

import com.mycom.Logger

/**
 * Clone the selected git repository.
 *
 * Example usage within a declarative pipeline:
 *
 *    steps {
 *        gitCheckout (["htpp://myrepo1.git": "branch1", "htpp://myrepo2.git": 
"branch2"])
 *    }
 *
 * @param repositories (HashMap) git url and branch of the git project to be 
downloaded.
 */
def call(repositories = ["htpp://myrepo1.git": "branch1", 
"htpp://myrepo2.git": "branch2"]) {
    def logger = new Logger()
    for (repo in repositories) {
        def repository = repo.key
        def branch = repo.value
        def foldername = repository.tokenize('/')[-1].toLowerCase()
        logger.info("Clonning '${repository} - (${branch}
 branch)' repository.")
        println("Foldername: " + foldername)
        println("Repository: " + repository)
        println("Branch: " + branch)
        checkout([$class: 'GitSCM', branches: [[name: branch]], 
                    doGenerateSubmoduleConfigurations: false, 
                    extensions: [
                        [$class: 'CloneOption', depth: 1, noTags: false
, reference: '', shallow: true], 
                        [$class: 'RelativeTargetDirectory'
, relativeTargetDir: foldername]
                    ], 
                    submoduleCfg: [], 
                    userRemoteConfigs: [[credentialsId: 'gittfscredentials'
, 
                                    url: repository]]])
    } // endfor

}


When using it in Jenkins pipeline 

#!/usr/bin/env groovy

@Library('mylib')

import com.mycom.*

pipeline {
    agent { label 'master' }

    options { 
        timestamps ()
        disableConcurrentBuilds()
    }

    stages {
        stage('Checkout') {
            steps {
                gitCheckoutMultipleRepositories()
            }   
        }
    }
    
}



I get the following error:


*............*

*00:00:00.963*  INFO: Clonning 'htpp://myrepo1.git - (branch1 branch)' 
repository.[Pipeline] echo 
<http://172.28.103.82:8080/view/DevOps/job/cip-environmens-local-cloud/17/console#>*00:00:00.972*
  Foldername: myrepo1.git[Pipeline] echo 
<http://172.28.103.82:8080/view/DevOps/job/cip-environmens-local-cloud/17/console#>*00:00:00.980*
  Repository: htpp://myrepo1.git[Pipeline] echo 
<http://172.28.103.82:8080/view/DevOps/job/cip-environmens-local-cloud/17/console#>*00:00:00.987*
  Branch: branch1[Pipeline] checkout 
<http://172.28.103.82:8080/view/DevOps/job/cip-environmens-local-cloud/17/console#>*00:00:00.998*
  using credential gittfscredentials*00:00:01.002*   > git rev-parse 
--is-inside-work-tree # timeout=10*00:00:01.010*  Fetching changes from the 
remote Git repository*00:00:01.010*   > git config remote.origin.url 
htpp://myrepo1.git # timeout=10
*00:00:01.018*  Using shallow fetch with depth 1*00:00:01.018*  Fetching 
upstream changes from htpp://myrepo1.git*00:00:01.018*   > git --version # 
timeout=10[Pipeline] }[Pipeline] // stage[Pipeline] }[Pipeline] // 
ansiColor[Pipeline] }[Pipeline] // timestamps[Pipeline] }[Pipeline] // 
node[Pipeline] End of Pipelinean exception which occurred:
        in field com.cloudbees.groovy.cps.impl.BlockScopeEnv.locals
        in object com.cloudbees.groovy.cps.impl.LoopBlockScopeEnv@469abe44
        in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
        in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@71325a45
        in field com.cloudbees.groovy.cps.impl.ProxyEnv.parent
        in object com.cloudbees.groovy.cps.impl.BlockScopeEnv@4955b455
        in field com.cloudbees.groovy.cps.impl.CallEnv.caller
        in object com.cloudbees.groovy.cps.impl.FunctionCallEnv@451fb812
        in field com.cloudbees.groovy.cps.Continuable.e
        in object org.jenkinsci.plugins.workflow.cps.SandboxContinuable@747dbee2
        in field org.jenkinsci.plugins.workflow.cps.CpsThread.program
        in object org.jenkinsci.plugins.workflow.cps.CpsThread@4b1cbc4d
        in field org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.threads
        in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4312dc7f
        in object org.jenkinsci.plugins.workflow.cps.CpsThreadGroup@4312dc7f
Caused: java.io.NotSerializableException: java.util.LinkedHashMap$Entry
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
        at 
org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
        at 
org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
        at 
org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
        at 
org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
        at java.util.HashMap.internalWriteEntries(HashMap.java:1793)
        at java.util.HashMap.writeObject(HashMap.java:1363)
        at sun.reflect.GeneratedMethodAccessor1288.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
        at 
org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1019)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.BlockMarshaller.doWriteObject(BlockMarshaller.java:65)
        at 
org.jboss.marshalling.river.BlockMarshaller.writeObject(BlockMarshaller.java:56)
        at 
org.jboss.marshalling.MarshallerObjectOutputStream.writeObjectOverride(MarshallerObjectOutputStream.java:50)
        at 
org.jboss.marshalling.river.RiverObjectOutputStream.writeObjectOverride(RiverObjectOutputStream.java:179)
        at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:344)
        at 
java.util.concurrent.ConcurrentSkipListMap.writeObject(ConcurrentSkipListMap.java:1437)
        at sun.reflect.GeneratedMethodAccessor1304.invoke(Unknown Source)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at 
org.jboss.marshalling.reflect.JDKSpecific$SerMethods.callWriteObject(JDKSpecific.java:156)
        at 
org.jboss.marshalling.reflect.SerializableClass.callWriteObject(SerializableClass.java:191)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1028)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteSerializableObject(RiverMarshaller.java:1040)
        at 
org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:920)
        at 
org.jboss.marshalling.AbstractObjectOutput.writeObject(AbstractObjectOutput.java:58)
        at 
org.jboss.marshalling.AbstractMarshaller.writeObject(AbstractMarshaller.java:111)
        at 
org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.lambda$writeObject$0(RiverWriter.java:144)
        at 
org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:237)
        at 
org.jenkinsci.plugins.workflow.support.pickles.serialization.RiverWriter.writeObject(RiverWriter.java:143)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:557)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgram(CpsThreadGroup.java:534)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.saveProgramIfPossible(CpsThreadGroup.java:521)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:445)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$400(CpsThreadGroup.java:96)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:317)
        at 
org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:281)
        at 
org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:67)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
hudson.remoting.SingleLaneExecutorService$1.run(SingleLaneExecutorService.java:131)
        at 
jenkins.util.ContextResettingExecutorService$1.run(ContextResettingExecutorService.java:28)
        at 
jenkins.security.ImpersonatingExecutorService$1.run(ImpersonatingExecutorService.java:59)
        at 
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE


I don´t guess what could be bad.

Any help please?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/0b30dfd0-8721-4b00-b670-bf331e5dcebf%40googlegroups.com.

Reply via email to