Question

I'm trying to set up continuous integration on Cloudbees, running Jenkins and deploying my Grails application to Cloudfoundry.

I followed the steps in this blog post, but the Jenkins build fails at the point at which it tries to deploy the WAR to Cloudfoundry.

The exception message is '403 Forbidden (Not enough memory capacity, you're allowed: 2048M)'. The maximum I can specify in the Jenkins / Cloudfoundry deployment configuration is only 2048MB, so this message doesn't make sense to me. I've tried reducing the memory allocation to 1024MB, but I still get the same message.

My application runs on Cloudfoundry without any problems if I deploy it manually using the Grails Cloudfoundry plugin, and runs fine with just 1GB.

Any ideas?

[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
Was it helpful?

Solution

On CloudFoundry v1 each account is allowed a total memory usage of 2048mb across all deployed active applications.

If you already have some applications deployed and try to add one more where it will push the total memory above 2048 then you will see this error.

The solution is to reduce the number of applications deployed so that you have enough free memory in your account to deploy your application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top