如何通过Jenkins构建/后期构建步骤

时间:2015-10-16 18:11:14

标签: plugins jenkins kubernetes

我尝试寻找Jenkins插件(如AWS codeDeploy),以便将应用程序部署到Kubernetes集群。到目前为止,我已成功将其推送到Docker注册表并添加一些命令行构建步骤以部署到Kubernetes。 看看CloudBees公告,这似乎是可能的 http://blog.cloudbees.com/2015/07/orchestrating-deployments-with-jenkins.html

安装Kubernetes插件给了我错误...如果有帮助我可以附上截图... 此外,似乎这个插件允许您在Docker容器中运行slave而不是部署自己的应用程序。

观看此视频后https://www.youtube.com/watch?v=PFCSSiT-UUQ ,似乎我可以做到这一点 使用'withKubernetes'工作流程......

但是,将该行添加到我的工作流脚本会出现以下错误

java.lang.NoSuchMethodError:在[archive,bat,build,catchError,checkout,dir,dockerFingerprintFrom,dockerFingerprintRun,echo,error,fileExists,git,input,load,mail,node,parallel)中找不到这样的带有Kubernetes的DSL方法,publishHTML,pwd,readFile,retry,sh,sleep,stage,stash,step,svn,timeout,tool,unarchive,unstash,waitUntil,withDockerContainer,withDockerRegistry,withDockerServer,withEnv,wrap,writeFile,ws]     在org.jenkinsci.plugins.workflow.cps.DSL.invokeMethod(DSL.java:107)     在org.jenkinsci.plugins.workflow.cps.CpsScript.invokeMethod(CpsScript.java:112)     at groovy.lang.GroovyObject $ invokeMethod.call(Unknown Source)     在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:42)     在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)     在org.kohsuke.groovy.sandbox.impl.Checker $ 1.call(Checker.java:151)     在org.kohsuke.groovy.sandbox.GroovyInterceptor.onMethodCall(GroovyInterceptor.java:21)     在org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.SandboxInterceptor.onMethodCall(SandboxInterceptor.java:75)     在org.kohsuke.groovy.sandbox.impl.Checker $ 1.call(Checker.java:149)     在org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:146)     在org.kohsuke.groovy.sandbox.impl.Checker.checkedCall(Checker.java:123)     在com.cloudbees.groovy.cps.sandbox.SandboxInvoker.methodCall(SandboxInvoker.java:15)     在WorkflowScript.run(WorkflowScript:17)     at Unknown.Unknown(未知)     在 cps.transform (原生方法)     在com.cloudbees.groovy.cps.impl.ContinuationGroup.methodCall(ContinuationGroup.java:69)     在com.cloudbees.groovy.cps.impl.FunctionCallBlock $ ContinuationImpl.dispatchOrArg(FunctionCallBlock.java:106)     在com.cloudbees.groovy.cps.impl.FunctionCallBlock $ ContinuationImpl.fixArg(FunctionCallBlock.java:79)     at sun.reflect.GeneratedMethodAccessor290.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:606)     在com.cloudbees.groovy.cps.impl.ContinuationPtr $ ContinuationImpl.receive(ContinuationPtr.java:72)     在com.cloudbees.groovy.cps.impl.ClosureBlock.eval(ClosureBlock.java:40)     在com.cloudbees.groovy.cps.Next.step(Next.java:58)     在com.cloudbees.groovy.cps.Continuable.run0(Continuable.java:145)     在org.jenkinsci.plugins.workflow.cps.SandboxContinuable.access $ 001(SandboxContinuable.java:19)     在org.jenkinsci.plugins.workflow.cps.SandboxContinuable $ 1.call(SandboxContinuable.java:33)     在org.jenkinsci.plugins.workflow.cps.SandboxContinuable $ 1.call(SandboxContinuable.java:30)     在org.jenkinsci.plugins.scriptsecurity.sandbox.groovy.GroovySandbox.runInSandbox(GroovySandbox.java:106)     在org.jenkinsci.plugins.workflow.cps.SandboxContinuable.run0(SandboxContinuable.java:30)     在org.jenkinsci.plugins.workflow.cps.CpsThread.runNextChunk(CpsThread.java:164)     在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.run(CpsThreadGroup.java:271)     at org.jenkinsci.plugins.workflow.cps.CpsThreadGroup.access $ 000(CpsThreadGroup.java:71)     在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup $ 2.call(CpsThreadGroup.java:180)     在org.jenkinsci.plugins.workflow.cps.CpsThreadGroup $ 2.call(CpsThreadGroup.java:178)     在org.jenkinsci.plugins.workflow.cps.CpsVmExecutorService $ 2.call(CpsVmExecutorService.java:47)     在java.util.concurrent.FutureTask.run(FutureTask.java:262)     在hudson.remoting.SingleLaneExecutorService $ 1.run(SingleLaneExecutorService.java:112)     在jenkins.util.ContextResettingExecutorService $ 1.run(ContextResettingExecutorService.java:28)     at java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:471)     在java.util.concurrent.FutureTask.run(FutureTask.java:262)     在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)     at java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)     在java.lang.Thread.run(Thread.java:745)

1 个答案:

答案 0 :(得分:1)

Jenkins Kubernetes plugin(目前为止)仅在Kubernetes集群中动态运行从属

从Jenkins部署到Kubernetes并不是很多,也许这篇文章Continuous Delivery Pipelines with Fabric8 and Jenkins on OpenShift有帮助