Nitesh Rai
Nitesh Rai

Reputation: 35

Build failure while deploying code from Jenkins to elastic beanstalk

I am trying to deploy java webapp to elastic beanstalk. The build setup is configured in jenkins which automatically builds the code from git repository. There is a current environment running on elatic benastalk and I am trying to deploy the changes to same environmment. Any help would be appreciated.

[INFO] Cobertura Report generation was successful.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 10.502s
[INFO] Finished at: Wed Nov 09 00:02:10 UTC 2016
[INFO] Final Memory: 26M/314M
[INFO] ------------------------------------------------------------------------
[ASAscorecard] $ /bin/sh -xe /tmp/hudson6830774317375150036.sh
AWSEB Deployment Plugin Version 0.3.10
Root File Object is a file. We assume its a zip file, which is okay.
Uploading file awseb-4915284155058919867.zip as s3://asaelasticdeployer/asa/builds/asa-prod/ASAscorecard-9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca.zip
Creating application version 9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca for application ASAscorecard for path s3://asaelasticdeployer/asa/builds/asa-prod/ASAscorecard-9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca.zip
Cleaning up temporary file /tmp/awseb-4915284155058919867.zip
FATAL: Deployment Failure
java.io.IOException: Deployment Failure
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.AWSEBDeploymentBuilder.perform(AWSEBDeploymentBuilder.java:171)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:534)
    at hudson.model.Run.execute(Run.java:1720)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:410)
Caused by: java.util.concurrent.ExecutionException: com.amazonaws.services.elasticbeanstalk.model.AWSElasticBeanstalkException: Application Version 9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca already exists. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: ec7d658e-a60f-11e6-a8bf-d9695b214a29)
    at java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.util.concurrent.FutureTask.get(FutureTask.java:192)
    at hudson.remoting.LocalChannel$2.get(LocalChannel.java:77)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.DeployerRunner.perform(DeployerRunner.java:66)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.AWSEBDeploymentBuilder.perform(AWSEBDeploymentBuilder.java:167)
    ... 9 more
Caused by: com.amazonaws.services.elasticbeanstalk.model.AWSElasticBeanstalkException: Application Version 9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca already exists. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: ec7d658e-a60f-11e6-a8bf-d9695b214a29)
    at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1343)
    at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:961)
    at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:738)
    at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:489)
    at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:448)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:397)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:378)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.doInvoke(AWSElasticBeanstalkClient.java:1978)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.invoke(AWSElasticBeanstalkClient.java:1954)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.createApplicationVersion(AWSElasticBeanstalkClient.java:525)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.DeployerCommand$CreateApplicationVersion.perform(DeployerCommand.java:167)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.DeployerChain.perform(DeployerChain.java:54)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.SlaveDeployerCallable.call(SlaveDeployerCallable.java:42)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.SlaveDeployerCallable.call(SlaveDeployerCallable.java:27)
    at hudson.remoting.LocalChannel$1.call(LocalChannel.java:52)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Skipping Cobertura coverage report as build was not UNSTABLE or better ...
Finished: FAILURE

Upvotes: 1

Views: 2014

Answers (1)

Pavel Bely
Pavel Bely

Reputation: 2415

As per AWS Java docs version label should be unique:

Must be unique per application. If an application version already exists with this label for the specified application, AWS Elastic Beanstalk returns an InvalidParameterValue error.

And that's exactly what your deployment violates:

Caused by: java.util.concurrent.ExecutionException: com.amazonaws.services.elasticbeanstalk.model.AWSElasticBeanstalkException: Application Version 9fa0aed367c3fe65ddbaedb9d9c6f921b4fbfdca already exists. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: InvalidParameterValue; Request ID: ec7d658e-a60f-11e6-a8bf-d9695b214a29)

Try changing version label format in AWS ElasticBeanstalk plugin step to make it unique. AWS ElasticBeanstalk Jenkins plugin setup

Upvotes: 4

Related Questions