Created
August 9, 2018 15:20
-
-
Save bemeyert/3f88cc0c458d9d8c2dc5e853fdf4e7b4 to your computer and use it in GitHub Desktop.
Scripted pipeline aborts for unknown reasons
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hudson.remoting.ProxyException: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object '{clean-composer=null, clean-qucli=null}' with class 'java.util.HashMap' to class 'org.jenkinsci.plugins.pipeline.modeldefinition.model.Root' due to: groovy.lang.GroovyRuntimeException: Could not find matching constructor for: org.jenkinsci.plugins.pipeline.modeldefinition.model.Root(java.util.HashMap) | |
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:403) | |
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319) | |
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232) | |
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:603) | |
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter$castToType.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:20) | |
at org.jenkinsci.plugins.pipeline.modeldefinition.ModelInterpreter.call(jar:file:/data/jenkins/plugins/pipeline-model-definition/WEB-INF/lib/pipeline-model-definition.jar!/org/jenkinsci/plugins/pipeline/modeldefinition/ModelInterpreter.groovy:59) | |
at WorkflowScript.runPipeline(WorkflowScript:23) | |
at WorkflowScript.run(WorkflowScript:10) | |
at ___cps.transform___(Native Method) | |
at com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:57) | |
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:109) | |
at com.cloudbees.groovy.cps.impl.FunctionCallBlock$ContinuationImpl.fixArg(FunctionCallBlock.java:82) | |
at sun.reflect.GeneratedMethodAccessor204.invoke(Unknown Source) | |
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) | |
at java.lang.reflect.Method.invoke(Method.java:498) | |
at com.cloudbees.groovy.cps.impl.ContinuationPtr$ContinuationImpl.receive(ContinuationPtr.java:72) | |
at com.cloudbees.groovy.cps.impl.ConstantBlock.eval(ConstantBlock.java:21) | |
at com.cloudbees.groovy.cps.Next.step(Next.java:83) | |
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:174) | |
at com.cloudbees.groovy.cps.Continuable$1.call(Continuable.java:163) | |
at org.codehaus.groovy.runtime.GroovyCategorySupport$ThreadCategoryInfo.use(GroovyCategorySupport.java:122) | |
at org.codehaus.groovy.runtime.GroovyCategorySupport.use(GroovyCategorySupport.java:261) | |
at com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:163) | |
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access$101(SandboxContinuable.java:34) | |
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.lambda$run0$0(SandboxContinuable.java:59) | |
at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:108) | |
at org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:58) | |
at org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:174) | |
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:332) | |
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access$200(CpsThreadGroup.java:83) | |
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:244) | |
at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup$2.call(CpsThreadGroup.java:232) | |
at org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService$2.call(CpsVmExecutorService.java:64) | |
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
properties([[$class: 'BuildDiscarderProperty', | |
strategy: [$class: 'LogRotator', numToKeepStr: '10']], | |
pipelineTriggers([cron( env.BRANCH_NAME == 'master' ? '@daily' : '' )]), | |
]) | |
try { | |
timeout(time:1, unit:'HOURS') { | |
runPipeline() | |
} | |
} catch (e) { | |
currentBuild.result = 'FAILED' | |
mail body: "project build error is here: ${env.BUILD_URL}" , | |
from: 'jenkins@mail.com', | |
subject: 'project build failed', | |
to: 'mail@mail.com' | |
throw e | |
} finally { | |
} | |
def runPipeline() { | |
pipeline { | |
node('node'){ | |
def LAST_SUCCESSFUL_COMMIT_SHA | |
withEnv([ | |
'JENKINS_API_TOKEN=token', | |
'JENKINS_API_USER=user', | |
'JENKINS_FOLDER=job/folder/job/name', | |
'GIT_DIFF_SIZE=0', | |
'REF_NAME_FOR_DIFF=master' | |
]) { | |
// Checkout | |
stage('Checkout'){ | |
checkout scm | |
LAST_SUCCESSFUL_COMMIT_SHA = sh(returnStdout: true, script: "script.sh").trim() | |
} | |
// Prepare | |
withEnv([ | |
"LAST_SUCCESSFUL_COMMIT_SHA=${LAST_SUCCESSFUL_COMMIT_SHA}" | |
]) { | |
stage('Prep'){ | |
sh('otherscript.sh') | |
} | |
} | |
// Build | |
withEnv([ | |
"SMR_CommandOptions=build" | |
]) { | |
parallel build_parallel_job_map( env.SMR_CommandOptions ) | |
} | |
// Test | |
withEnv([ | |
"SMR_CommandOptions=test" | |
]) { | |
parallel build_parallel_job_map( env.SMR_CommandOptions ) | |
} | |
// Push in master | |
if (env.BRANCH_NAME == 'master') { | |
withEnv([ | |
"SMR_CommandOptions=push" | |
]) { | |
parallel build_parallel_job_map( env.SMR_CommandOptions ) | |
} | |
} | |
// Clean | |
withEnv([ | |
"SMR_CommandOptions=clean" | |
]) { | |
parallel build_parallel_job_map( env.SMR_CommandOptions ) | |
} | |
} // END outer withEnv() | |
} //END node() | |
} //END pipeline() | |
} // END def runPipeline | |
def build_parallel_job_map( String name ) { | |
def stages = [:] | |
for ( line in readFile('SMR_CHANGES').split('\n') ) { | |
if ( line.trim() ) { | |
def ( target, command ) = line.split('::') | |
stages["${name}-${target}"] = { | |
node ('node') { | |
stage("$name parallel $target") { | |
sh("echo Running command $command") | |
} | |
} | |
} | |
} | |
} | |
return stages | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment