在将代码从Jenkins部署到弹性beanstalk时构建失败

时间:2016-11-09 00:18:10

标签: jenkins amazon-elastic-beanstalk

我正在尝试将java webapp部署到弹性beanstalk。构建设置在jenkins中配置,它自动从git存储库构建代码。有一个当前环境在elatic benastalk上运行,我正在尝试将更改部署到相同的环境中。任何帮助将不胜感激。

[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

1 个答案:

答案 0 :(得分:1)

根据AWS Java docs版本标签应该是唯一的:

  

每个应用程序必须是唯一的。如果已经有应用程序版本   存在此标签用于指定的应用程序AWS Elastic   Beanstalk返回InvalidParameterValue错误。

这正是您的部署违反的原因:

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)

尝试在AWS ElasticBeanstalk插件步骤中更改版本标签格式,使其唯一。 AWS ElasticBeanstalk Jenkins plugin setup