pipeline{
agent { label "docker-slave2" }
options {
timestamps()
}
stages {
stage('parallel stage'){
steps {
script {
def nodejsmap = [ "/home/tcl/customer": "sales-customer-ui-prod", "/home/tcl/platform": "sales-platform-ui-prod" ]
for (element in nodejsmap) {
stage('Preparation') {
sh 'printenv'
cleanWs()
git branch: "${env.gitlabBranch}", credentialsId: "12345678", url: "http://172.16.200.112:8000/${element.value}.git"
}
stage('Build') {
nodejs('nodejs_16.16') {
sh 'npm install --location=global yarn'
sh 'yarn install'
sh 'rm -f package-lock.json'
sh 'npm run build:dev'
sh 'tar -zcvf dist/dist.tar dist/*'
}
}
When I run this jenkinsfile , it report this error :
an exception which occurred:
in field com.cloudbees.groovy.cps.impl.ForInLoopBlock$ContinuationImpl.itr
in object com.cloudbees.groovy.cps.impl.ForInLoopBlock$ContinuationImpl@4d9df4d9
in field com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.target
in object com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl@1af3614
in field com.cloudbees.groovy.cps.impl.SequenceBlock$ContinuationImpl.k
in object com.cloudbees.groovy.cps.impl.SequenceBlock$ContinuationImpl@1cbb7b70
Caused: java.io.NotSerializableException: java.util.LinkedHashMap$LinkedEntryIterator
at org.jboss.marshalling.river.RiverMarshaller.doWriteObject(RiverMarshaller.java:926)
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.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.RiverMarshaller.doWriteFields(RiverMarshaller.java:1082)
I write code in jenkinsfile
When I run this jenkinsfile , it report this error :
How to solve the above problem ?