将代码从Jenkins部署到弹性豆茎时出现异常

vvppvyoh  于 2022-11-21  发布在  Jenkins
关注(0)|答案(3)|浏览(141)

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

Cleaning up temporary file /tmp/awseb-3661917639223333659.zip
ERROR: Failed to parse POMs
java.io.IOException: Deployment Failure
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.AWSEBDeploymentBuilder.perform(AWSEBDeploymentBuilder.java:197)
    at hudson.tasks.BuildStepCompatibilityLayer.perform(BuildStepCompatibilityLayer.java:79)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:741)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.build(MavenModuleSetBuild.java:946)
    at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:896)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
    at hudson.model.Run.execute(Run.java:1818)
    at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
    at hudson.model.ResourceController.execute(ResourceController.java:97)
    at hudson.model.Executor.run(Executor.java:429)
Caused by: java.util.concurrent.ExecutionException: com.amazonaws.services.elasticbeanstalk.model.TooManyApplicationVersionsException: You cannot have more than 1000 Application Versions. Either remove some Application Versions or request a limit increase. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: TooManyApplicationVersionsException; Request ID: 742c1239-08e0-463f-8471-8e52cbc1fb77)
    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:71)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.AWSEBDeploymentBuilder.perform(AWSEBDeploymentBuilder.java:193)
    ... 10 more
Caused by: com.amazonaws.services.elasticbeanstalk.model.TooManyApplicationVersionsException: You cannot have more than 1000 Application Versions. Either remove some Application Versions or request a limit increase. (Service: AWSElasticBeanstalk; Status Code: 400; Error Code: TooManyApplicationVersionsException; Request ID: 742c1239-08e0-463f-8471-8e52cbc1fb77)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.handleErrorResponse(AmazonHttpClient.java:1712)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeOneRequest(AmazonHttpClient.java:1367)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeHelper(AmazonHttpClient.java:1113)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.doExecute(AmazonHttpClient.java:770)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.executeWithTimer(AmazonHttpClient.java:744)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.execute(AmazonHttpClient.java:726)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutor.access$500(AmazonHttpClient.java:686)
    at com.amazonaws.http.AmazonHttpClient$RequestExecutionBuilderImpl.execute(AmazonHttpClient.java:668)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:532)
    at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:512)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.doInvoke(AWSElasticBeanstalkClient.java:3191)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.invoke(AWSElasticBeanstalkClient.java:3158)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.invoke(AWSElasticBeanstalkClient.java:3147)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.executeCreateApplicationVersion(AWSElasticBeanstalkClient.java:703)
    at com.amazonaws.services.elasticbeanstalk.AWSElasticBeanstalkClient.createApplicationVersion(AWSElasticBeanstalkClient.java:674)
    at br.com.ingenieux.jenkins.plugins.awsebdeployment.cmd.DeployerCommand$CreateApplicationVersion.perform(DeployerCommand.java:174)
    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:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Finished: FAILURE
tyg4sfes

tyg4sfes1#

有04个选项

#1手动删除

在aws Web控制台中手动删除版本


#2手动配置自动删除

单击设置

配置版本生命周期

详细步骤:https://www.bluekeyboard.com/2021/09/14/managing-application-versions-in-aws-elastic-beanstalk/
官方资料来源:https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/applications-lifecycle.html

#3使用CLI配置自动删除

AWS_ACCOUNT=$(aws sts get-caller-identity | jq -r '.Account')

SERVICE_ROLE=arn:aws:iam::${AWS_ACCOUNT}:role/aws-elasticbeanstalk-service-role

aws elasticbeanstalk update-application-resource-lifecycle \
--application-name <<parameters.eb_app_name>> \
--resource-lifecycle-config "ServiceRole=${SERVICE_ROLE},VersionLifecycleConfig={MaxCountRule={Enabled=true,MaxCount=10,DeleteSourceFromS3=true}}"

来源:https://circleci.com/developer/orbs/orb/nikkei/nikkei-aws-eb
差官鉴:https://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/update-application-resource-lifecycle.html
第四名Maven
https://stackoverflow.com/a/71945930/3957754

tnkciper

tnkciper2#

基于TooManyApplicationVersionsException You cannot have more than 1000 Application Versions
您需要从Elastic beanstalk中删除一些旧的应用程序版本。您可以通过as described here来完成

z9gpfhce

z9gpfhce3#

你需要删除以前的版本-你不能永远这样做。请参阅this page上的“删除以前的版本”。根据文档,你似乎要运行

mvn beanstalk:clean-previous-versions -Dbeanstalk.daysToKeep=1

如果要按天删除或

mvn beanstalk:clean-previous-versions -Dbeanstalk.versionsToKeep=1

如果您想要依版本移除。这应该在您的建置管道早期,以清除旧的版本。

相关问题