尝试从Cloudbees Jenkins部署到Cloudfoundry时'403 Forbidden'

时间:2013-05-30 06:57:02

标签: grails jenkins cloudfoundry cloudbees

我正在尝试在Cloudbees上设置持续集成,运行Jenkins并将我的Grails应用程序部署到Cloudfoundry。

我按照this blog post中的步骤进行操作,但Jenkins构建在尝试将WAR部署到Cloudfoundry时失败。

异常消息是'403 Forbidden(内存容量不足,你被允许:2048M)'。我在Jenkins / Cloudfoundry部署配置中指定的最大值仅为2048MB,因此此消息对我没有意义。我已经尝试将内存分配减少到1024MB,但我仍然得到相同的消息。

如果我使用Grails Cloudfoundry插件手动部署,我的应用程序在Cloudfoundry上运行没有任何问题,只需1GB即可正常运行。

有什么想法吗?

[cloudbees-deployer:cloudfoundry]   Processing matched resources: 9395721
[cloudbees-deployer:cloudfoundry]   done.
[cloudbees-deployer:cloudfoundry] Setting number of instances... done.
[cloudbees-deployer:cloudfoundry] Application state: unknown
[cloudbees-deployer:cloudfoundry] Starting application...
com.cloudbees.plugins.deployer.exceptions.DeployException: remote file operation failed: /scratch/jenkins/workspace/myApp/target/myApp-0.1.war at hudson.remoting.Channel@1c179d4c:s-c0eee604
    at com.cloudbees.plugins.deployer.engines.Engine.process(Engine.java:162)
    at com.cloudbees.plugins.deployer.engines.Engine.perform(Engine.java:96)
    at com.cloudbees.plugins.deployer.DeployPublisher.perform(DeployPublisher.java:95)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:728)
    at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:703)
    at hudson.model.Build$BuildExecution.post2(Build.java:183)
    at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:650)
    at hudson.model.Run.execute(Run.java:1530)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
    at hudson.model.ResourceController.execute(ResourceController.java:88)
    at hudson.model.Executor.run(Executor.java:237)
Caused by: hudson.util.IOException2: remote file operation failed: /scratch/jenkins/workspace/myApp/target/myApp-0.1.war at hudson.remoting.Channel@1c179d4c:s-c0eee604
    at hudson.FilePath.act(FilePath.java:877)
    at hudson.FilePath.act(FilePath.java:863)
    at com.cloudbees.plugins.deployer.engines.Engine.process(Engine.java:156)
    ... 11 more
Caused by: hudson.remoting.ProxyException: org.cloudfoundry.client.lib.CloudFoundryException: 403 Forbidden (Not enough memory capacity, you're allowed: 2048M)
    at org.cloudfoundry.client.lib.rest.AbstractCloudControllerClient$ErrorHandler.handleError(AbstractCloudControllerClient.java:357)
    at com.cloudbees.shaded.org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486)
    at com.cloudbees.shaded.org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443)
    at org.cloudfoundry.client.lib.rest.LoggingRestTemplate.doExecute(LoggingRestTemplate.java:54)
    at com.cloudbees.shaded.org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401)
    at com.cloudbees.shaded.org.springframework.web.client.RestTemplate.put(RestTemplate.java:327)
    at org.cloudfoundry.client.lib.rest.CloudControllerClientV1.doUpdateApplication(CloudControllerClientV1.java:615)
    at org.cloudfoundry.client.lib.rest.CloudControllerClientV1.startApplication(CloudControllerClientV1.java:342)
    at com.cloudbees.plugins.deployer.impl.cloudfoundry.EngineImpl$DeployFileCallable.invoke(EngineImpl.java:637)
    at com.cloudbees.plugins.deployer.impl.cloudfoundry.EngineImpl$DeployFileCallable.invoke(EngineImpl.java:307)
    at com.cloudbees.plugins.deployer.engines.Engine$FingerprintingWrapper.invoke(Engine.java:248)
    at com.cloudbees.plugins.deployer.engines.Engine$FingerprintingWrapper.invoke(Engine.java:236)
    at hudson.FilePath$FileCallableWrapper.call(FilePath.java:2275)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:722)
Build step 'Deploy applications' marked build as failure
Finished: FAILURE

1 个答案:

答案 0 :(得分:1)

在CloudFoundry v1上,每个帐户在所有已部署的活动应用程序中的总内存使用量为2048mb。

如果您已经部署了一些应用程序,并尝试再添加一个应用程序,那么它会将总内存推到2048以上,那么您将看到此错误。

解决方案是减少部署的应用程序数量,以便您的帐户中有足够的可用内存来部署应用程序。