Jenkinsfile 踩过的坑

1. 

未在properties 中定义,

build job 使用时,也未携带parameter

```

build job: 'ema/ema-internal-create-learn-instance', wait: true, parameters: [

    string( name: 'K8S_NAMESPACE', value: k8sNamespace ),
    string( name: 'INSTANCE_NAME', value: instanceName ),
    string( name: 'STACK', value: stackType ),
    string( name: 'LEARN_BRANCH', value: learnBranch ),
    string( name: 'LEARN_VERSION', value: learnVersion ),
    string( name: 'ULTRA_BRANCH', value: ultraBranch ),
    string( name: 'ULTRA_VERSION', value: ultraVersion ),
    textParam( name: 'INSTANCE_PROPERTIES', value: env.INSTANCE_PROPERTIES ),
    textParam( name: 'DEV_FEATURES', value: env.DEV_FEATURES ),
    string( name: 'S3_K8S_SECRET', value: s3K8sSecret ),
    booleanParam( name: 'USE_AURORA', value: false ),
    booleanParam( name: 'USE_NEWRIELIC', value: true ),
    string( name: 'BUILD_USER_EMAIL', value: env.BUILD_USER_EMAIL ),
    string( name: 'LEARN_CPU_REQUEST', value: env.LEARN_CPU_REQUEST ),
    string( name: 'LEARN_CPU_LIMITS', value: env.LEARN_CPU_LIMITS ),
    string( name: 'LEARN_LIVENESS_CHECK_PERIOD', value: env.LEARN_LIVENESS_CHECK_PERIOD ),
    string( name: 'LEARN_LIVENESS_TIMEOUT', value: env.LEARN_LIVENESS_TIMEOUT ),
    string( name: 'LEARN_MEM_REQUEST', value: env.LEARN_MEM_REQUEST ),
    string( name: 'LEARN_MEM_LIMITS', value: env.LEARN_MEM_LIMITS ),
    string( name: 'POSTGRES_CPU_REQUEST', value: env.POSTGRES_CPU_REQUEST ),
    string( name: 'POSTGRES_CPU_LIMITS', value: env.POSTGRES_CPU_LIMITS ),
    string( name: 'POSTGRES_MAINTENANCE_WORK_MEM', value: env.POSTGRES_MAINTENANCE_WORK_MEM ),
    string( name: 'POSTGRES_MAX_CONNECTIONS', value: env.POSTGRES_MAX_CONNECTIONS ),
    string( name: 'POSTGRES_MEM_REQUEST', value: env.POSTGRES_MEM_REQUEST ),
    string( name: 'POSTGRES_MEM_LIMITS', value: env.POSTGRES_MEM_LIMITS ),
    string( name: 'POSTGRES_SHARED_BUFFERS', value: env.POSTGRES_SHARED_BUFFERS ),

  ]

```

但在job运行程序中,使用 

ultraRouterVersion = params.ULTRA_ROUTER_VERSION

发生如下exception

hudson.remoting.ProxyException: groovy.lang.MissingMethodException: No signature of method: groovy.lang.MissingPropertyException.call() is applicable for argument types: (java.lang.String) values: [Failed to send notification by slack!]
Possible solutions: wait(), any(), wait(long), any(groovy.lang.Closure), each(groovy.lang.Closure), collect()
	at org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:131)
	at org.kohsuke.groovy.sandbox.impl.Checker$1.call(Checker.java:155)
	at org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:159)
	at com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:17)
	at WorkflowScript.notifySlack(WorkflowScript:519)
	at WorkflowScript.withSlackNotification(WorkflowScript:482)
	at WorkflowScript.withNode(WorkflowScript:210)
	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.GeneratedMethodAccessor106.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)
Finished: FAILURE

你可能感兴趣的:(测试)